diff options
author | Chocobozzz <me@florianbigard.com> | 2019-05-29 14:39:49 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2019-05-29 14:39:49 +0200 |
commit | b247a132709eb212fef4f77c4912dc0ec108f36b (patch) | |
tree | b2700e6ed55e00cd213c44e8afdeea4c327ae904 /client/src/app/+signup/+verify-account/verify-account-ask-send-email | |
parent | 1d5342abc43df02cf0bd69b1e865c0f179182eef (diff) | |
download | PeerTube-b247a132709eb212fef4f77c4912dc0ec108f36b.tar.gz PeerTube-b247a132709eb212fef4f77c4912dc0ec108f36b.tar.zst PeerTube-b247a132709eb212fef4f77c4912dc0ec108f36b.zip |
Add success icon on registration
Diffstat (limited to 'client/src/app/+signup/+verify-account/verify-account-ask-send-email')
3 files changed, 91 insertions, 0 deletions
diff --git a/client/src/app/+signup/+verify-account/verify-account-ask-send-email/verify-account-ask-send-email.component.html b/client/src/app/+signup/+verify-account/verify-account-ask-send-email/verify-account-ask-send-email.component.html new file mode 100644 index 000000000..2e4180632 --- /dev/null +++ b/client/src/app/+signup/+verify-account/verify-account-ask-send-email/verify-account-ask-send-email.component.html | |||
@@ -0,0 +1,22 @@ | |||
1 | <div class="margin-content"> | ||
2 | <div i18n class="title-page title-page-single"> | ||
3 | Request email for account verification | ||
4 | </div> | ||
5 | |||
6 | <form *ngIf="requiresEmailVerification; else emailVerificationNotRequired" role="form" (ngSubmit)="askSendVerifyEmail()" [formGroup]="form"> | ||
7 | <div class="form-group"> | ||
8 | <label i18n for="verify-email-email">Email</label> | ||
9 | <input | ||
10 | type="email" id="verify-email-email" i18n-placeholder placeholder="Email address" required | ||
11 | formControlName="verify-email-email" [ngClass]="{ 'input-error': formErrors['verify-email-email'] }" | ||
12 | > | ||
13 | <div *ngIf="formErrors['verify-email-email']" class="form-error"> | ||
14 | {{ formErrors['verify-email-email'] }} | ||
15 | </div> | ||
16 | </div> | ||
17 | <input type="submit" i18n-value value="Send verification email" [disabled]="!form.valid"> | ||
18 | </form> | ||
19 | <ng-template #emailVerificationNotRequired> | ||
20 | <div i18n>This instance does not require email verification.</div> | ||
21 | </ng-template> | ||
22 | </div> | ||
diff --git a/client/src/app/+signup/+verify-account/verify-account-ask-send-email/verify-account-ask-send-email.component.scss b/client/src/app/+signup/+verify-account/verify-account-ask-send-email/verify-account-ask-send-email.component.scss new file mode 100644 index 000000000..efec6b706 --- /dev/null +++ b/client/src/app/+signup/+verify-account/verify-account-ask-send-email/verify-account-ask-send-email.component.scss | |||
@@ -0,0 +1,12 @@ | |||
1 | @import '_variables'; | ||
2 | @import '_mixins'; | ||
3 | |||
4 | input:not([type=submit]) { | ||
5 | @include peertube-input-text(340px); | ||
6 | display: block; | ||
7 | } | ||
8 | |||
9 | input[type=submit] { | ||
10 | @include peertube-button; | ||
11 | @include orange-button; | ||
12 | } | ||
diff --git a/client/src/app/+signup/+verify-account/verify-account-ask-send-email/verify-account-ask-send-email.component.ts b/client/src/app/+signup/+verify-account/verify-account-ask-send-email/verify-account-ask-send-email.component.ts new file mode 100644 index 000000000..cfd471fa4 --- /dev/null +++ b/client/src/app/+signup/+verify-account/verify-account-ask-send-email/verify-account-ask-send-email.component.ts | |||
@@ -0,0 +1,57 @@ | |||
1 | import { Component, OnInit } from '@angular/core' | ||
2 | import { I18n } from '@ngx-translate/i18n-polyfill' | ||
3 | import { Notifier, RedirectService } from '@app/core' | ||
4 | import { ServerService } from '@app/core/server' | ||
5 | import { FormReactive, UserService } from '@app/shared' | ||
6 | import { FormValidatorService } from '@app/shared/forms/form-validators/form-validator.service' | ||
7 | import { UserValidatorsService } from '@app/shared/forms/form-validators/user-validators.service' | ||
8 | |||
9 | @Component({ | ||
10 | selector: 'my-verify-account-ask-send-email', | ||
11 | templateUrl: './verify-account-ask-send-email.component.html', | ||
12 | styleUrls: [ './verify-account-ask-send-email.component.scss' ] | ||
13 | }) | ||
14 | |||
15 | export class VerifyAccountAskSendEmailComponent extends FormReactive implements OnInit { | ||
16 | |||
17 | constructor ( | ||
18 | protected formValidatorService: FormValidatorService, | ||
19 | private userValidatorsService: UserValidatorsService, | ||
20 | private userService: UserService, | ||
21 | private serverService: ServerService, | ||
22 | private notifier: Notifier, | ||
23 | private redirectService: RedirectService, | ||
24 | private i18n: I18n | ||
25 | ) { | ||
26 | super() | ||
27 | } | ||
28 | |||
29 | get requiresEmailVerification () { | ||
30 | return this.serverService.getConfig().signup.requiresEmailVerification | ||
31 | } | ||
32 | |||
33 | ngOnInit () { | ||
34 | this.buildForm({ | ||
35 | 'verify-email-email': this.userValidatorsService.USER_EMAIL | ||
36 | }) | ||
37 | } | ||
38 | |||
39 | askSendVerifyEmail () { | ||
40 | const email = this.form.value['verify-email-email'] | ||
41 | this.userService.askSendVerifyEmail(email) | ||
42 | .subscribe( | ||
43 | () => { | ||
44 | const message = this.i18n( | ||
45 | 'An email with verification link will be sent to {{email}}.', | ||
46 | { email } | ||
47 | ) | ||
48 | this.notifier.success(message) | ||
49 | this.redirectService.redirectToHomepage() | ||
50 | }, | ||
51 | |||
52 | err => { | ||
53 | this.notifier.error(err.message) | ||
54 | } | ||
55 | ) | ||
56 | } | ||
57 | } | ||