Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 408eeabf authored by theronakpatel's avatar theronakpatel
Browse files

Change made for common error

parent a82838ca
Loading
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -253,13 +253,13 @@ class AccountController extends Controller {
		$response->setStatus(400);

		if (empty($username)) {
			$response->setData(['message' => 'Username is required.', 'success' => false]);
			return $response;
		}

		$validationError = $this->validateInput('username', $username, 30);
		if ($validationError !== null) {
			$response->setData(['message' => $validationError, 'success' => false]);
			$response->setStatus(403);
			return $response;
		}

@@ -268,6 +268,8 @@ class AccountController extends Controller {
			if (!$this->userService->userExists($username) && !$this->userService->isUsernameTaken($username)) {
				$response->setStatus(200);
				$this->session->set(self::SESSION_USERNAME_CHECK, true);
			} else {
				$response->setData(['message' => 'Username is already taken.', 'success' => false]);
			}
		} catch (Exception $e) {
			$this->logger->logException($e, ['app' => Application::APP_ID ]);
+1 −3
Original line number Diff line number Diff line
@@ -299,10 +299,8 @@ export default {
				this.isUsernameAvailable = true
			} catch (error) {
				this.validation.isUsernameNotValid = true
				if (error.response && error.response.status === 403) {
				if (error.response && error.response.status === 400) {
					this.usernameValidationMessage = t(this.appName, error.response.data.message)
				} else if (error.response && error.response.status === 400) {
					this.usernameValidationMessage = t(this.appName, 'Username is already taken.')
				} else {
					this.usernameValidationMessage = t(this.appName, 'Something went wrong.')
				}