From 0ba5f5baade94a051710d9d9d408ac8083c14ac6 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 11 Jun 2019 14:30:49 +0200 Subject: Add ability to change email in client --- .../verify-account-email.component.html | 17 ++++++++++------- .../verify-account-email.component.ts | 19 +++++++++++++++---- 2 files changed, 25 insertions(+), 11 deletions(-) (limited to 'client/src/app/+signup/+verify-account/verify-account-email') diff --git a/client/src/app/+signup/+verify-account/verify-account-email/verify-account-email.component.html b/client/src/app/+signup/+verify-account/verify-account-email/verify-account-email.component.html index 728709ca6..47519c943 100644 --- a/client/src/app/+signup/+verify-account/verify-account-email/verify-account-email.component.html +++ b/client/src/app/+signup/+verify-account/verify-account-email/verify-account-email.component.html @@ -3,13 +3,16 @@ Verify account email confirmation - + - -
- An error occurred. - Request new verification email. -
-
+
+ Email updated. +
+ +
+ An error occurred. + + Request new verification email. +
diff --git a/client/src/app/+signup/+verify-account/verify-account-email/verify-account-email.component.ts b/client/src/app/+signup/+verify-account/verify-account-email/verify-account-email.component.ts index 3fb2d1cd8..054f04310 100644 --- a/client/src/app/+signup/+verify-account/verify-account-email/verify-account-email.component.ts +++ b/client/src/app/+signup/+verify-account/verify-account-email/verify-account-email.component.ts @@ -1,7 +1,7 @@ import { Component, OnInit } from '@angular/core' import { ActivatedRoute, Router } from '@angular/router' import { I18n } from '@ngx-translate/i18n-polyfill' -import { Notifier } from '@app/core' +import { AuthService, Notifier } from '@app/core' import { UserService } from '@app/shared' @Component({ @@ -11,12 +11,15 @@ import { UserService } from '@app/shared' export class VerifyAccountEmailComponent implements OnInit { success = false + failed = false + isPendingEmail = false private userId: number private verificationString: string constructor ( private userService: UserService, + private authService: AuthService, private notifier: Notifier, private router: Router, private route: ActivatedRoute, @@ -25,8 +28,12 @@ export class VerifyAccountEmailComponent implements OnInit { } ngOnInit () { - this.userId = this.route.snapshot.queryParams['userId'] - this.verificationString = this.route.snapshot.queryParams['verificationString'] + const queryParams = this.route.snapshot.queryParams + this.userId = queryParams['userId'] + this.verificationString = queryParams['verificationString'] + this.isPendingEmail = queryParams['isPendingEmail'] === 'true' + + console.log(this.isPendingEmail) if (!this.userId || !this.verificationString) { this.notifier.error(this.i18n('Unable to find user id or verification string.')) @@ -36,13 +43,17 @@ export class VerifyAccountEmailComponent implements OnInit { } verifyEmail () { - this.userService.verifyEmail(this.userId, this.verificationString) + this.userService.verifyEmail(this.userId, this.verificationString, this.isPendingEmail) .subscribe( () => { + this.authService.refreshUserInformation() + this.success = true }, err => { + this.failed = true + this.notifier.error(err.message) } ) -- cgit v1.2.3