- if (err.message.indexOf('credentials are invalid') !== -1) this.error = $localize`Incorrect username or password.`
- else if (err.message.indexOf('blocked') !== -1) this.error = $localize`Your account is blocked.`
- else this.error = err.message
+ console.log(err)
+
+ if (this.authService.isOTPMissingError(err)) {
+ this.otpStep = true
+
+ setTimeout(() => {
+ this.form.get('otp-token').setValidators(USER_OTP_TOKEN_VALIDATOR.VALIDATORS)
+ this.otpTokenInput.focus()
+ })
+
+ return
+ }
+
+ if (err.message.includes('credentials are invalid')) {
+ this.error = $localize`Incorrect username or password.`
+ return
+ }
+
+ if (err.message.includes('blocked')) {
+ this.error = $localize`Your account is blocked.`
+ return
+ }
+
+ if (err.body?.code === ServerErrorCode.ACCOUNT_WAITING_FOR_APPROVAL) {
+ this.error = $localize`This account is awaiting approval by moderators.`
+ return
+ }
+
+ if (err.body?.code === ServerErrorCode.ACCOUNT_APPROVAL_REJECTED) {
+ this.error = $localize`Registration approval has been rejected for this account.`
+ return
+ }
+
+ this.error = err.message