diff options
author | Chocobozzz <me@florianbigard.com> | 2023-01-19 09:29:47 +0100 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2023-01-19 13:53:40 +0100 |
commit | 9589907c89d29a6c0acd52c8cb789af9f93ce9af (patch) | |
tree | f1d238e6144231bbfbed5614e05a21eca8aa6fc2 /client/src/app/+login | |
parent | b379759f55a35837b803a3b988674972db2903d1 (diff) | |
download | PeerTube-9589907c89d29a6c0acd52c8cb789af9f93ce9af.tar.gz PeerTube-9589907c89d29a6c0acd52c8cb789af9f93ce9af.tar.zst PeerTube-9589907c89d29a6c0acd52c8cb789af9f93ce9af.zip |
Implement signup approval in client
Diffstat (limited to 'client/src/app/+login')
-rw-r--r-- | client/src/app/+login/login.component.ts | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/client/src/app/+login/login.component.ts b/client/src/app/+login/login.component.ts index 5f6aa842e..c03af38f2 100644 --- a/client/src/app/+login/login.component.ts +++ b/client/src/app/+login/login.component.ts | |||
@@ -9,7 +9,7 @@ import { FormReactive, FormReactiveService, InputTextComponent } from '@app/shar | |||
9 | import { InstanceAboutAccordionComponent } from '@app/shared/shared-instance' | 9 | import { InstanceAboutAccordionComponent } from '@app/shared/shared-instance' |
10 | import { NgbAccordion, NgbModal, NgbModalRef } from '@ng-bootstrap/ng-bootstrap' | 10 | import { NgbAccordion, NgbModal, NgbModalRef } from '@ng-bootstrap/ng-bootstrap' |
11 | import { getExternalAuthHref } from '@shared/core-utils' | 11 | import { getExternalAuthHref } from '@shared/core-utils' |
12 | import { RegisteredExternalAuthConfig, ServerConfig } from '@shared/models' | 12 | import { RegisteredExternalAuthConfig, ServerConfig, ServerErrorCode } from '@shared/models' |
13 | 13 | ||
14 | @Component({ | 14 | @Component({ |
15 | selector: 'my-login', | 15 | selector: 'my-login', |
@@ -197,6 +197,8 @@ The link will expire within 1 hour.` | |||
197 | } | 197 | } |
198 | 198 | ||
199 | private handleError (err: any) { | 199 | private handleError (err: any) { |
200 | console.log(err) | ||
201 | |||
200 | if (this.authService.isOTPMissingError(err)) { | 202 | if (this.authService.isOTPMissingError(err)) { |
201 | this.otpStep = true | 203 | this.otpStep = true |
202 | 204 | ||
@@ -208,8 +210,26 @@ The link will expire within 1 hour.` | |||
208 | return | 210 | return |
209 | } | 211 | } |
210 | 212 | ||
211 | if (err.message.indexOf('credentials are invalid') !== -1) this.error = $localize`Incorrect username or password.` | 213 | if (err.message.includes('credentials are invalid')) { |
212 | else if (err.message.indexOf('blocked') !== -1) this.error = $localize`Your account is blocked.` | 214 | this.error = $localize`Incorrect username or password.` |
213 | else this.error = err.message | 215 | return |
216 | } | ||
217 | |||
218 | if (err.message.includes('blocked')) { | ||
219 | this.error = $localize`Your account is blocked.` | ||
220 | return | ||
221 | } | ||
222 | |||
223 | if (err.body?.code === ServerErrorCode.ACCOUNT_WAITING_FOR_APPROVAL) { | ||
224 | this.error = $localize`This account is awaiting approval by moderators.` | ||
225 | return | ||
226 | } | ||
227 | |||
228 | if (err.body?.code === ServerErrorCode.ACCOUNT_APPROVAL_REJECTED) { | ||
229 | this.error = $localize`Registration approval has been rejected for this account.` | ||
230 | return | ||
231 | } | ||
232 | |||
233 | this.error = err.message | ||
214 | } | 234 | } |
215 | } | 235 | } |