web/satellite: logout added after password change

functionality moved from reset password where no cookie and causes error to proper place
added redirect with 2 sec delay after success

Change-Id: I9cfe7e88bed7cfaf04fc7dc7fde58702b0040c5c
This commit is contained in:
NickolaiYurchenko 2022-07-18 10:10:46 +03:00
parent 7aaab3c4c4
commit 0317c819dc
2 changed files with 13 additions and 1 deletions

View File

@ -77,10 +77,13 @@ import CloseCrossIcon from '@/../static/images/common/closeCross.svg';
import { AuthHttpApi } from '@/api/auth';
import { APP_STATE_ACTIONS } from '@/utils/constants/actionNames';
import { Validator } from '@/utils/validation';
import { RouteConfig } from "@/router";
import { AnalyticsHttpApi } from '@/api/analytics';
import { AnalyticsEvent } from '@/utils/constants/analyticsEventNames';
const DELAY_BEFORE_REDIRECT = 2000; // 2 sec
// @vue/component
@Component({
components: {
@ -169,6 +172,16 @@ export default class ChangePasswordPopup extends Vue {
return;
}
try {
await this.auth.logout();
setTimeout(() => {
this.$router.push(RouteConfig.Login.path);
}, DELAY_BEFORE_REDIRECT);
} catch (error) {
await this.$notify.error(error.message);
}
this.analytics.eventTriggered(AnalyticsEvent.PASSWORD_CHANGED);
await this.$notify.success('Password successfully changed!');
this.$store.dispatch(APP_STATE_ACTIONS.TOGGLE_CHANGE_PASSWORD_POPUP);

View File

@ -181,7 +181,6 @@ export default class ResetPassword extends Vue {
try {
await this.auth.resetPassword(this.token, this.password, this.passcode.trim(), this.recoveryCode.trim());
await this.auth.logout();
this.$store.dispatch(APP_STATE_ACTIONS.TOGGLE_SUCCESSFUL_PASSWORD_RESET);
} catch (error) {
this.isLoading = false;