logout after password change

This commit is contained in:
shamoon
2023-11-30 18:55:10 -08:00
parent 954782ca3b
commit 8c206f35c8
2 changed files with 36 additions and 3 deletions

View File

@@ -112,8 +112,6 @@ export class ProfileEditDialogComponent implements OnInit, OnDestroy {
}
onPasswordChange(): void {
console.log(this.currentPassword, this.newPassword)
this.showPasswordConfirm = this.currentPassword !== this.newPassword
if (this.showPasswordConfirm) {
@@ -131,6 +129,7 @@ export class ProfileEditDialogComponent implements OnInit, OnDestroy {
}
save(): void {
const passwordChanged = this.currentPassword !== this.newPassword
const profile = Object.assign({}, this.form.value)
this.networkActive = true
this.profileService
@@ -138,7 +137,16 @@ export class ProfileEditDialogComponent implements OnInit, OnDestroy {
.pipe(takeUntil(this.unsubscribeNotifier))
.subscribe({
next: () => {
console.log('next', passwordChanged)
this.toastService.showInfo($localize`Profile updated successfully`)
if (passwordChanged) {
this.toastService.showInfo(
$localize`Password has been changed, you will be logged out momentarily.`
)
setTimeout(() => {
window.location.href = `${window.location.origin}/accounts/logout/?next=/accounts/login/`
}, 2500)
}
this.activeModal.close()
},
error: (error) => {