prefil email
This commit is contained in:
parent
d59d41e1ee
commit
1532daa061
|
@ -42,6 +42,8 @@ import {
|
||||||
} from '../../shared/service';
|
} from '../../shared/service';
|
||||||
import { customEmailValidator } from '../../shared/validator';
|
import { customEmailValidator } from '../../shared/validator';
|
||||||
|
|
||||||
|
import { LocalStorageService } from './../../shared/service/local-storage.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-unified-login',
|
selector: 'app-unified-login',
|
||||||
standalone: true,
|
standalone: true,
|
||||||
|
@ -98,11 +100,12 @@ export class WelcomeRootComponent implements OnInit {
|
||||||
private readonly router: Router,
|
private readonly router: Router,
|
||||||
private readonly themeService: ThemeService,
|
private readonly themeService: ThemeService,
|
||||||
private readonly el: ElementRef,
|
private readonly el: ElementRef,
|
||||||
private readonly backgroundPatternService: BackgroundPatternService
|
private readonly backgroundPatternService: BackgroundPatternService,
|
||||||
|
private readonly localStorageService: LocalStorageService
|
||||||
) {
|
) {
|
||||||
effect(() => {
|
effect(() => {
|
||||||
if (this.removeQueryParams()) {
|
if (this.removeQueryParams()) {
|
||||||
//this.clearRouteParams();
|
this.clearRouteParams();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -111,6 +114,7 @@ export class WelcomeRootComponent implements OnInit {
|
||||||
this.autologin();
|
this.autologin();
|
||||||
this.setBackground();
|
this.setBackground();
|
||||||
this.initializeForm();
|
this.initializeForm();
|
||||||
|
this.prefillEmail();
|
||||||
this.verifySignupMagicLink();
|
this.verifySignupMagicLink();
|
||||||
this.verifySigninMagicLink();
|
this.verifySigninMagicLink();
|
||||||
}
|
}
|
||||||
|
@ -260,10 +264,11 @@ export class WelcomeRootComponent implements OnInit {
|
||||||
const email: string = this.extractEmail();
|
const email: string = this.extractEmail();
|
||||||
const decodedEmail: string = decodeURIComponent(atob(email));
|
const decodedEmail: string = decodeURIComponent(atob(email));
|
||||||
|
|
||||||
|
this.removeQueryParams.set(true);
|
||||||
|
|
||||||
if (token && email) {
|
if (token && email) {
|
||||||
if (isSignup) {
|
if (isSignup) {
|
||||||
this.setupEmailField(decodedEmail);
|
this.setupEmailField(decodedEmail);
|
||||||
this.removeQueryParams.set(true);
|
|
||||||
this.addPasswordFieldToForm();
|
this.addPasswordFieldToForm();
|
||||||
this.isRegistrationMode.set(true);
|
this.isRegistrationMode.set(true);
|
||||||
}
|
}
|
||||||
|
@ -421,11 +426,24 @@ export class WelcomeRootComponent implements OnInit {
|
||||||
)
|
)
|
||||||
.subscribe((response: SuccessDtoApiModel) => {
|
.subscribe((response: SuccessDtoApiModel) => {
|
||||||
if (response.success) {
|
if (response.success) {
|
||||||
|
this.remeberUserMail(signupCredentials.email);
|
||||||
// Display Modal // You have successfully signed up. Please check your email for the magic link.
|
// Display Modal // You have successfully signed up. Please check your email for the magic link.
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private prefillEmail(): void {
|
||||||
|
const email = this.localStorageService.getItem('email');
|
||||||
|
|
||||||
|
if (email) {
|
||||||
|
this.form.get('email')?.setValue(email);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private remeberUserMail(email: string): void {
|
||||||
|
this.localStorageService.setItem('email', email);
|
||||||
|
}
|
||||||
|
|
||||||
private sendLoginEmail(email: string): void {
|
private sendLoginEmail(email: string): void {
|
||||||
this.isLoading.set(true);
|
this.isLoading.set(true);
|
||||||
const magiclink: MagicLinkDtoApiModel = {
|
const magiclink: MagicLinkDtoApiModel = {
|
||||||
|
@ -442,6 +460,7 @@ export class WelcomeRootComponent implements OnInit {
|
||||||
.subscribe((response: SuccessDtoApiModel) => {
|
.subscribe((response: SuccessDtoApiModel) => {
|
||||||
if (response.success) {
|
if (response.success) {
|
||||||
this.isEmailSent.set(true);
|
this.isEmailSent.set(true);
|
||||||
|
this.remeberUserMail(email);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue