aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/+verify-account
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2019-05-29 14:39:49 +0200
committerChocobozzz <me@florianbigard.com>2019-05-29 14:39:49 +0200
commitb247a132709eb212fef4f77c4912dc0ec108f36b (patch)
treeb2700e6ed55e00cd213c44e8afdeea4c327ae904 /client/src/app/+verify-account
parent1d5342abc43df02cf0bd69b1e865c0f179182eef (diff)
downloadPeerTube-b247a132709eb212fef4f77c4912dc0ec108f36b.tar.gz
PeerTube-b247a132709eb212fef4f77c4912dc0ec108f36b.tar.zst
PeerTube-b247a132709eb212fef4f77c4912dc0ec108f36b.zip
Add success icon on registration
Diffstat (limited to 'client/src/app/+verify-account')
-rw-r--r--client/src/app/+verify-account/index.ts2
-rw-r--r--client/src/app/+verify-account/verify-account-ask-send-email/verify-account-ask-send-email.component.html22
-rw-r--r--client/src/app/+verify-account/verify-account-ask-send-email/verify-account-ask-send-email.component.scss12
-rw-r--r--client/src/app/+verify-account/verify-account-ask-send-email/verify-account-ask-send-email.component.ts57
-rw-r--r--client/src/app/+verify-account/verify-account-email/verify-account-email.component.html15
-rw-r--r--client/src/app/+verify-account/verify-account-email/verify-account-email.component.ts53
-rw-r--r--client/src/app/+verify-account/verify-account-routing.module.ts42
-rw-r--r--client/src/app/+verify-account/verify-account.module.ts27
8 files changed, 0 insertions, 230 deletions
diff --git a/client/src/app/+verify-account/index.ts b/client/src/app/+verify-account/index.ts
deleted file mode 100644
index 733f5ba77..000000000
--- a/client/src/app/+verify-account/index.ts
+++ /dev/null
@@ -1,2 +0,0 @@
1export * from '@app/+verify-account/verify-account-routing.module'
2export * from '@app/+verify-account/verify-account.module'
diff --git a/client/src/app/+verify-account/verify-account-ask-send-email/verify-account-ask-send-email.component.html b/client/src/app/+verify-account/verify-account-ask-send-email/verify-account-ask-send-email.component.html
deleted file mode 100644
index 2e4180632..000000000
--- a/client/src/app/+verify-account/verify-account-ask-send-email/verify-account-ask-send-email.component.html
+++ /dev/null
@@ -1,22 +0,0 @@
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/+verify-account/verify-account-ask-send-email/verify-account-ask-send-email.component.scss b/client/src/app/+verify-account/verify-account-ask-send-email/verify-account-ask-send-email.component.scss
deleted file mode 100644
index efec6b706..000000000
--- a/client/src/app/+verify-account/verify-account-ask-send-email/verify-account-ask-send-email.component.scss
+++ /dev/null
@@ -1,12 +0,0 @@
1@import '_variables';
2@import '_mixins';
3
4input:not([type=submit]) {
5 @include peertube-input-text(340px);
6 display: block;
7}
8
9input[type=submit] {
10 @include peertube-button;
11 @include orange-button;
12}
diff --git a/client/src/app/+verify-account/verify-account-ask-send-email/verify-account-ask-send-email.component.ts b/client/src/app/+verify-account/verify-account-ask-send-email/verify-account-ask-send-email.component.ts
deleted file mode 100644
index cfd471fa4..000000000
--- a/client/src/app/+verify-account/verify-account-ask-send-email/verify-account-ask-send-email.component.ts
+++ /dev/null
@@ -1,57 +0,0 @@
1import { Component, OnInit } from '@angular/core'
2import { I18n } from '@ngx-translate/i18n-polyfill'
3import { Notifier, RedirectService } from '@app/core'
4import { ServerService } from '@app/core/server'
5import { FormReactive, UserService } from '@app/shared'
6import { FormValidatorService } from '@app/shared/forms/form-validators/form-validator.service'
7import { 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
15export 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}
diff --git a/client/src/app/+verify-account/verify-account-email/verify-account-email.component.html b/client/src/app/+verify-account/verify-account-email/verify-account-email.component.html
deleted file mode 100644
index a83d4a3c2..000000000
--- a/client/src/app/+verify-account/verify-account-email/verify-account-email.component.html
+++ /dev/null
@@ -1,15 +0,0 @@
1<div class="margin-content">
2 <div i18n class="title-page title-page-single">
3 Verify account email confirmation
4 </div>
5
6 <div i18n *ngIf="success; else verificationError">
7 Your email has been verified and you may now login. Redirecting...
8 </div>
9 <ng-template #verificationError>
10 <div>
11 <span i18n>An error occurred. </span>
12 <a i18n routerLink="/verify-account/ask-send-email">Request new verification email.</a>
13 </div>
14 </ng-template>
15</div>
diff --git a/client/src/app/+verify-account/verify-account-email/verify-account-email.component.ts b/client/src/app/+verify-account/verify-account-email/verify-account-email.component.ts
deleted file mode 100644
index f9ecf664b..000000000
--- a/client/src/app/+verify-account/verify-account-email/verify-account-email.component.ts
+++ /dev/null
@@ -1,53 +0,0 @@
1import { Component, OnInit } from '@angular/core'
2import { ActivatedRoute, Router } from '@angular/router'
3import { I18n } from '@ngx-translate/i18n-polyfill'
4import { Notifier } from '@app/core'
5import { UserService } from '@app/shared'
6
7@Component({
8 selector: 'my-verify-account-email',
9 templateUrl: './verify-account-email.component.html'
10})
11
12export class VerifyAccountEmailComponent implements OnInit {
13 success = false
14
15 private userId: number
16 private verificationString: string
17
18 constructor (
19 private userService: UserService,
20 private notifier: Notifier,
21 private router: Router,
22 private route: ActivatedRoute,
23 private i18n: I18n
24 ) {
25 }
26
27 ngOnInit () {
28 this.userId = this.route.snapshot.queryParams['userId']
29 this.verificationString = this.route.snapshot.queryParams['verificationString']
30
31 if (!this.userId || !this.verificationString) {
32 this.notifier.error(this.i18n('Unable to find user id or verification string.'))
33 } else {
34 this.verifyEmail()
35 }
36 }
37
38 verifyEmail () {
39 this.userService.verifyEmail(this.userId, this.verificationString)
40 .subscribe(
41 () => {
42 this.success = true
43 setTimeout(() => {
44 this.router.navigate([ '/login' ])
45 }, 2000)
46 },
47
48 err => {
49 this.notifier.error(err.message)
50 }
51 )
52 }
53}
diff --git a/client/src/app/+verify-account/verify-account-routing.module.ts b/client/src/app/+verify-account/verify-account-routing.module.ts
deleted file mode 100644
index a038f0336..000000000
--- a/client/src/app/+verify-account/verify-account-routing.module.ts
+++ /dev/null
@@ -1,42 +0,0 @@
1import { NgModule } from '@angular/core'
2import { RouterModule, Routes } from '@angular/router'
3
4import { MetaGuard } from '@ngx-meta/core'
5
6import { VerifyAccountEmailComponent } from '@app/+verify-account/verify-account-email/verify-account-email.component'
7import {
8 VerifyAccountAskSendEmailComponent
9} from '@app/+verify-account/verify-account-ask-send-email/verify-account-ask-send-email.component'
10
11const verifyAccountRoutes: Routes = [
12 {
13 path: '',
14 canActivateChild: [ MetaGuard ],
15 children: [
16 {
17 path: 'email',
18 component: VerifyAccountEmailComponent,
19 data: {
20 meta: {
21 title: 'Verify account email'
22 }
23 }
24 },
25 {
26 path: 'ask-send-email',
27 component: VerifyAccountAskSendEmailComponent,
28 data: {
29 meta: {
30 title: 'Verify account ask send email'
31 }
32 }
33 }
34 ]
35 }
36]
37
38@NgModule({
39 imports: [ RouterModule.forChild(verifyAccountRoutes) ],
40 exports: [ RouterModule ]
41})
42export class VerifyAccountRoutingModule {}
diff --git a/client/src/app/+verify-account/verify-account.module.ts b/client/src/app/+verify-account/verify-account.module.ts
deleted file mode 100644
index 9092c6b4f..000000000
--- a/client/src/app/+verify-account/verify-account.module.ts
+++ /dev/null
@@ -1,27 +0,0 @@
1import { NgModule } from '@angular/core'
2
3import { VerifyAccountRoutingModule } from '@app/+verify-account/verify-account-routing.module'
4import { VerifyAccountEmailComponent } from '@app/+verify-account/verify-account-email/verify-account-email.component'
5import {
6 VerifyAccountAskSendEmailComponent
7} from '@app/+verify-account/verify-account-ask-send-email/verify-account-ask-send-email.component'
8import { SharedModule } from '@app/shared'
9
10@NgModule({
11 imports: [
12 VerifyAccountRoutingModule,
13 SharedModule
14 ],
15
16 declarations: [
17 VerifyAccountEmailComponent,
18 VerifyAccountAskSendEmailComponent
19 ],
20
21 exports: [
22 ],
23
24 providers: [
25 ]
26})
27export class VerifyAccountModule { }