Email Hotfix (#1068)

* Auto approve migration emails if the password is correct. Change Email Link dump to Critical to ensure it makes it into the logs.

* Bump the version
This commit is contained in:
Joseph Milazzo 2022-02-12 14:55:01 -08:00 committed by GitHub
parent 6db81684b2
commit 2193451dfb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 33 additions and 32 deletions

View file

@ -26,7 +26,7 @@ export class AddEmailToAccountMigrationModalComponent implements OnInit {
error: string = '';
constructor(private accountService: AccountService, private modal: NgbActiveModal,
private serverService: ServerService, private confirmService: ConfirmService) {
private serverService: ServerService, private confirmService: ConfirmService, private toastr: ToastrService) {
}
ngOnInit(): void {
@ -40,25 +40,23 @@ export class AddEmailToAccountMigrationModalComponent implements OnInit {
}
save() {
this.serverService.isServerAccessible().subscribe(canAccess => {
const model = this.registerForm.getRawValue();
model.sendEmail = canAccess;
this.accountService.migrateUser(model).subscribe(async (email) => {
console.log(email);
if (!canAccess) {
// Display the email to the user
this.emailLink = email;
await this.confirmService.alert('Please click this link to confirm your email. You must confirm to be able to login. The link is in your logs. You may need to log out of the current account before clicking. <br/> <a href="' + this.emailLink + '" target="_blank">' + this.emailLink + '</a>');
this.modal.close(true);
} else {
await this.confirmService.alert('Please check your email (or logs under "Email Link") for the confirmation link. You must confirm to be able to login.');
this.modal.close(true);
}
const model = this.registerForm.getRawValue();
model.sendEmail = false;
this.accountService.migrateUser(model).subscribe(async () => {
// if (!canAccess) {
// // Display the email to the user
// this.emailLink = email;
// await this.confirmService.alert('Please click this link to confirm your email. You must confirm to be able to login. The link is in your logs. You may need to log out of the current account before clicking. <br/> <a href="' + this.emailLink + '" target="_blank">' + this.emailLink + '</a>');
// this.modal.close(true);
// } else {
// await this.confirmService.alert('Please check your email (or logs under "Email Link") for the confirmation link. You must confirm to be able to login.');
// this.modal.close(true);
// }
this.toastr.success('Email has been validated');
this.modal.close(true);
}, err => {
this.error = err;
});
});
}