1. added merge-account-confirm page 2. fixed config for google-auth-provider
This commit is contained in:
parent
e4516ef0ed
commit
5387a2c3df
|
@ -28,7 +28,7 @@ export class AuthProviders {
|
||||||
public findOrGetDefault(providerName: string, culture: string): AuthProvider {
|
public findOrGetDefault(providerName: string, culture: string): AuthProvider {
|
||||||
const authProvider = this.find(providerName, culture);
|
const authProvider = this.find(providerName, culture);
|
||||||
|
|
||||||
if (authProvider === null) return this.defaultAuthProvider;
|
if (authProvider === undefined) return this.defaultAuthProvider;
|
||||||
|
|
||||||
return authProvider;
|
return authProvider;
|
||||||
}
|
}
|
||||||
|
|
|
@ -107,6 +107,14 @@ export class UserService {
|
||||||
catchError((error: any) => throwError(error)));
|
catchError((error: any) => throwError(error)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
confirmMergeAccount(token: Guid): Observable<boolean> {
|
||||||
|
const url = `${this.apiBase}/mine/confirm-merge-account/token/${token}`;
|
||||||
|
|
||||||
|
return this.http
|
||||||
|
.get<boolean>(url).pipe(
|
||||||
|
catchError((error: any) => throwError(error)));
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Autocomplete Commons
|
// Autocomplete Commons
|
||||||
//
|
//
|
||||||
|
|
|
@ -3,10 +3,15 @@ import { RouterModule, Routes } from '@angular/router';
|
||||||
import { LoginComponent } from './login.component';
|
import { LoginComponent } from './login.component';
|
||||||
import { MergeEmailConfirmation } from './merge-email-confirmation/merge-email-confirmation.component';
|
import { MergeEmailConfirmation } from './merge-email-confirmation/merge-email-confirmation.component';
|
||||||
import { UnlinkEmailConfirmation } from './unlink-email-confirmation/unlink-email-confirmation.component';
|
import { UnlinkEmailConfirmation } from './unlink-email-confirmation/unlink-email-confirmation.component';
|
||||||
|
import { AuthGuard } from '@app/core/auth-guard.service';
|
||||||
|
|
||||||
const routes: Routes = [
|
const routes: Routes = [
|
||||||
{ path: '', component: LoginComponent },
|
{ path: '', component: LoginComponent },
|
||||||
{ path: 'merge/confirmation/:token', component: MergeEmailConfirmation },
|
{
|
||||||
|
path: 'merge/confirmation/:token',
|
||||||
|
component: MergeEmailConfirmation,
|
||||||
|
canActivate: [AuthGuard]
|
||||||
|
},
|
||||||
{ path: 'unlink/confirmation/:token', component: UnlinkEmailConfirmation },
|
{ path: 'unlink/confirmation/:token', component: UnlinkEmailConfirmation },
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
|
@ -1 +1,27 @@
|
||||||
|
<div class="merge-account">
|
||||||
|
<div class="container-fluid">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col merge-account-title">{{'MERGE-ACCOUNT.TITLE' | translate}}</div>
|
||||||
|
</div>
|
||||||
|
<div *ngIf="showForm" class="row merge-account-content">
|
||||||
|
<div class="col">
|
||||||
|
<div class="row justify-content-center">
|
||||||
|
<div class="col-auto">
|
||||||
|
<span>
|
||||||
|
{{ 'MERGE-ACCOUNT.MESSAGES.CONFIRMATION' | translate }}
|
||||||
|
</span>
|
||||||
|
<!-- <span>Duo ea clita doming eu stet. Nonummy voluptua accusam sit eos aliquyam sit kasd lorem ut feugait no et soluta invidunt ea sanctus. Ut erat molestie sit sit diam dolores lorem nonumy quis consetetur. Elitr sed euismod illum sit consetetur esse at eum elitr sit dolores ut facer. Autem in aliquyam magna eos dolore eos amet ut magna sadipscing sea eum. Justo elitr aliquip praesent est exerci dolore commodo accusam dolor hendrerit rebum feugiat aliquyam sadipscing sed. Dolores dolore autem in et dolor at adipiscing ullamcorper invidunt vel. Et takimata ea amet et at sit kasd erat magna sed.</span> -->
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row justify-content-center">
|
||||||
|
<div class="col-auto mt-4">
|
||||||
|
<!-- -->
|
||||||
|
<button type="button" class="normal-btn" (click)="onConfirm()">{{ 'MERGE-ACCOUNT.ACTIONS.CONFIRM' | translate }}</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<ng-template #loading>
|
||||||
|
</ng-template>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
|
@ -0,0 +1,19 @@
|
||||||
|
.merge-account {
|
||||||
|
height: fit-content;
|
||||||
|
//margin-top: 80px;
|
||||||
|
min-height: 100vh;
|
||||||
|
background-color: #ffffff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.merge-account-title {
|
||||||
|
font-size: 1.25rem;
|
||||||
|
color: #212121;
|
||||||
|
padding-top: 4.1875rem;
|
||||||
|
padding-left: 3.75rem;
|
||||||
|
padding-bottom: 4.0625rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.merge-account-content {
|
||||||
|
margin-left: 9rem;
|
||||||
|
margin-right: 11rem;
|
||||||
|
}
|
|
@ -1,30 +1,41 @@
|
||||||
import { Component, OnInit } from "@angular/core";
|
import { Component, OnInit } from "@angular/core";
|
||||||
import { UntypedFormControl } from '@angular/forms';
|
import { UntypedFormControl } from '@angular/forms';
|
||||||
|
import { MatDialog } from "@angular/material/dialog";
|
||||||
import { ActivatedRoute, Router } from "@angular/router";
|
import { ActivatedRoute, Router } from "@angular/router";
|
||||||
import { AuthService } from "@app/core/services/auth/auth.service";
|
import { AuthService } from "@app/core/services/auth/auth.service";
|
||||||
import { SnackBarNotificationLevel, UiNotificationService } from '@app/core/services/notification/ui-notification-service';
|
import { SnackBarNotificationLevel, UiNotificationService } from '@app/core/services/notification/ui-notification-service';
|
||||||
|
import { UserService } from "@app/core/services/user/user.service";
|
||||||
|
import { PopupNotificationDialogComponent } from "@app/library/notification/popup/popup-notification.component";
|
||||||
import { BaseComponent } from '@common/base/base.component';
|
import { BaseComponent } from '@common/base/base.component';
|
||||||
|
import { Guid } from "@common/types/guid";
|
||||||
import { TranslateService } from '@ngx-translate/core';
|
import { TranslateService } from '@ngx-translate/core';
|
||||||
import { takeUntil } from "rxjs/operators";
|
import { takeUntil } from "rxjs/operators";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-email-confirmation-component',
|
selector: 'app-email-confirmation-component',
|
||||||
templateUrl: './merge-email-confirmation.component.html'
|
templateUrl: './merge-email-confirmation.component.html',
|
||||||
|
styleUrls: ['./merge-email-confirmation.component.scss']
|
||||||
})
|
})
|
||||||
export class MergeEmailConfirmation extends BaseComponent implements OnInit {
|
export class MergeEmailConfirmation extends BaseComponent implements OnInit {
|
||||||
|
|
||||||
|
private token: Guid;
|
||||||
public emailFormControl = new UntypedFormControl('');
|
public emailFormControl = new UntypedFormControl('');
|
||||||
public showForm: boolean = false;
|
|
||||||
public mailSent: boolean = false;
|
public mailSent: boolean = false;
|
||||||
|
|
||||||
|
|
||||||
|
get showForm(): boolean {
|
||||||
|
return this.token != null;
|
||||||
|
}
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
//TODO: refactor
|
//TODO: refactor
|
||||||
// private emailConfirmationService: MergeEmailConfirmationService,
|
// private emailConfirmationService: MergeEmailConfirmationService,
|
||||||
private authService: AuthService,
|
// private authService: AuthService,
|
||||||
|
private userService: UserService,
|
||||||
private route: ActivatedRoute,
|
private route: ActivatedRoute,
|
||||||
private router: Router,
|
private router: Router,
|
||||||
private language: TranslateService,
|
private language: TranslateService,
|
||||||
private uiNotificationService: UiNotificationService
|
private uiNotificationService: UiNotificationService,
|
||||||
) { super(); }
|
) { super(); }
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
|
@ -33,7 +44,8 @@ export class MergeEmailConfirmation extends BaseComponent implements OnInit {
|
||||||
.subscribe(params => {
|
.subscribe(params => {
|
||||||
const token = params['token']
|
const token = params['token']
|
||||||
if (token != null) {
|
if (token != null) {
|
||||||
this.showForm = false;
|
this.token = token;
|
||||||
|
// this.showForm = false;
|
||||||
//TODO: refactor
|
//TODO: refactor
|
||||||
// this.emailConfirmationService.emailConfirmation(token)
|
// this.emailConfirmationService.emailConfirmation(token)
|
||||||
// .pipe(takeUntil(this._destroyed))
|
// .pipe(takeUntil(this._destroyed))
|
||||||
|
@ -48,11 +60,25 @@ export class MergeEmailConfirmation extends BaseComponent implements OnInit {
|
||||||
// error => this.onCallbackError(error)
|
// error => this.onCallbackError(error)
|
||||||
// )
|
// )
|
||||||
} else {
|
} else {
|
||||||
this.showForm = true;
|
// this.showForm = true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onConfirm(): void {
|
||||||
|
console.log('onConfirm');
|
||||||
|
if (this.showForm === false) return;
|
||||||
|
console.log('active');
|
||||||
|
|
||||||
|
this.userService.confirmMergeAccount(this.token)
|
||||||
|
.subscribe(result => {
|
||||||
|
if (result) {
|
||||||
|
this.onCallbackEmailConfirmationSuccess();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
error => this.onCallbackError(error));
|
||||||
|
}
|
||||||
|
|
||||||
onCallbackEmailConfirmationSuccess() {
|
onCallbackEmailConfirmationSuccess() {
|
||||||
this.router.navigate(['home']);
|
this.router.navigate(['home']);
|
||||||
}
|
}
|
||||||
|
@ -63,7 +89,6 @@ export class MergeEmailConfirmation extends BaseComponent implements OnInit {
|
||||||
this.router.navigate(['home']);
|
this.router.navigate(['home']);
|
||||||
} else {
|
} else {
|
||||||
this.uiNotificationService.snackBarNotification(this.language.instant('EMAIL-CONFIRMATION.EXPIRED-EMAIL'), SnackBarNotificationLevel.Error);
|
this.uiNotificationService.snackBarNotification(this.language.instant('EMAIL-CONFIRMATION.EXPIRED-EMAIL'), SnackBarNotificationLevel.Error);
|
||||||
this.router.navigate(['login']);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -99,10 +99,6 @@ export class UserProfileComponent extends BaseComponent implements OnInit, OnDes
|
||||||
return providerNames;
|
return providerNames;
|
||||||
}
|
}
|
||||||
|
|
||||||
public getProviderIcon(providerName:string, culture:string): string {
|
|
||||||
return this.configurationService.authProviders.find(providerName, culture).providerClass;
|
|
||||||
}
|
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.matomoService.trackPageView('User Profile');
|
this.matomoService.trackPageView('User Profile');
|
||||||
this.route.params
|
this.route.params
|
||||||
|
@ -345,7 +341,7 @@ export class UserProfileComponent extends BaseComponent implements OnInit, OnDes
|
||||||
data: {
|
data: {
|
||||||
title: this.language.instant('USER-PROFILE.MERGING-EMAILS-DIALOG.TITLE'),
|
title: this.language.instant('USER-PROFILE.MERGING-EMAILS-DIALOG.TITLE'),
|
||||||
message: this.language.instant('USER-PROFILE.MERGING-EMAILS-DIALOG.MESSAGE')
|
message: this.language.instant('USER-PROFILE.MERGING-EMAILS-DIALOG.MESSAGE')
|
||||||
}//, maxWidth: '30em'
|
}, maxWidth: '30em'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -55,12 +55,12 @@
|
||||||
},
|
},
|
||||||
"authProviders": [
|
"authProviders": [
|
||||||
{
|
{
|
||||||
"name": "Google",
|
"name": "google",
|
||||||
"providerClass": "googleIcon",
|
"providerClass": "googleIcon",
|
||||||
"cultures": ["en"]
|
"cultures": ["en"]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Facebook",
|
"name": "facebook",
|
||||||
"providerClass": "facebookIcon",
|
"providerClass": "facebookIcon",
|
||||||
"cultures": ["en"]
|
"cultures": ["en"]
|
||||||
}
|
}
|
||||||
|
|
|
@ -1881,5 +1881,15 @@
|
||||||
"ACTIONS": {
|
"ACTIONS": {
|
||||||
"LEARN-MORE": "Learn more"
|
"LEARN-MORE": "Learn more"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"MERGE-ACCOUNT": {
|
||||||
|
"TITLE": "Merge Your Account",
|
||||||
|
"MESSAGES": {
|
||||||
|
"CONFIRMATION": "Are you sure that you want to merge this account?"
|
||||||
|
},
|
||||||
|
"ACTIONS": {
|
||||||
|
"CONFIRM": "Confirm",
|
||||||
|
"CANCEL": "Cancel"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue