diff --git a/src/_helpers/router.js b/src/_helpers/router.js index 35617d0..3335028 100644 --- a/src/_helpers/router.js +++ b/src/_helpers/router.js @@ -15,6 +15,7 @@ import LogoutPage from '../auth/LogoutPage' import ForgotPasswordPage from '../auth/ForgotPasswordPage' import MultifactorAuthPage from '../auth/MultifactorAuthPage' import AppLoginPage from '../auth/AppLoginPage' +import RestorePage from "../auth/RestorePage" import DashboardPage from '../account/DashboardPage' import ProfilePage from '../account/profile/ProfilePage' import ActionPage from '../account/profile/ActionPage' @@ -111,6 +112,7 @@ export const router = new Router({ { path: '/logout', component: LogoutPage }, { path: '/forgotPassword', component: ForgotPasswordPage }, { path: '/appLogin', component: AppLoginPage }, + { path: '/restore', component: RestorePage }, { path: '/admin/accounts', component: AccountsPage }, { path: '/admin/new_account', component: ProfilePage }, @@ -128,7 +130,7 @@ export const router = new Router({ }); const publicPages = [ - '/login', '/logout', '/register', '/appLogin', + '/login', '/logout', '/register', '/appLogin', '/restore', '/forgotPassword', '/resetPassword', '/action', '/auth', '/activate', '/legal' diff --git a/src/auth/LoginPage.vue b/src/auth/LoginPage.vue index 4893bb2..790cf34 100644 --- a/src/auth/LoginPage.vue +++ b/src/auth/LoginPage.vue @@ -1,85 +1,43 @@ - {{ messages.form_title_restore }} - {{ messages.form_title_login }} - + {{messages.form_title_login}} {{messages.message_resetPassword_sent}} {{ errors.first('approvalToken') }} - - - - {{messages.field_label_restore_short_key}} - - Required - - {{ errors.first('restoreShortKey') }} - - - - - {{messages.field_label_restore_long_key}} - - Required - - {{ errors.first('restoreLongNetworkKey') }} - - - - - {{messages.field_label_password}} - - - {{ errors.first('password') }} - - - - - - {{ messages.button_label_restore }} - - - - - - - {{messages.field_label_email}} - - Name is required - {{ errors.first('account') }} - {{ errors.first('name') }} - - - {{messages.field_label_password}} - - {{ errors.first('password') }} - - - {{messages.message_login_authenticator_auth}} - {{messages.field_label_totp_code}} - - {{ errors.first('totpToken') }} - - - {{messages.field_label_unlock_key}} - - Unlock Key is required - {{ errors.first('unlockKey') }} - - - - {{messages.button_label_login}} - - {{messages.button_label_register}} - - - {{messages.button_label_forgotPassword}} - - + + {{messages.field_label_email}} + + Name is required + {{ errors.first('account') }} + {{ errors.first('name') }} + + + {{messages.field_label_password}} + + {{ errors.first('password') }} + + + {{messages.message_login_authenticator_auth}} + {{messages.field_label_totp_code}} + + {{ errors.first('totpToken') }} + + + {{messages.field_label_unlock_key}} + + Unlock Key is required + {{ errors.first('unlockKey') }} + + + + {{messages.button_label_login}} + + {{messages.button_label_register}} + + + {{messages.button_label_forgotPassword}} + @@ -95,9 +53,6 @@ export default { password: '', totpToken: null, unlockKey: (this.$route.query && this.$route.query.k) ? this.$route.query.k : null, - restoreShortKey: (this.$route.query && this.$route.query.k) ? this.$route.query.k : null, - restoreLongNetworkKey: null, - // reuse password for this restoreLongNetworkKey's password showTotp: false, submitted: false, loadingImgSrc: loadingImgSrc @@ -105,24 +60,20 @@ export default { }, created () { this.loadSystemConfigs(); + if (this.configs && this.configs.isInRestoringStatus) this.$router.replace('/restore'); }, computed: { ...mapState('account', ['status', 'loginError', 'resetPasswordMessageSent']), ...mapState('system', ['configs', 'messages']) }, methods: { - ...mapActions('account', ['login', 'logout', 'restore']), + ...mapActions('account', ['login', 'logout']), ...mapActions('system', ['loadSystemConfigs']), handleSubmit (e) { this.errors.clear(); this.submitted = true; - const { name, password, totpToken, unlockKey, restoreShortKey, restoreLongNetworkKey } = this; - if (this.configs && this.configs.isInRestoringStatus) { - this.restore({ - shortKey: restoreShortKey, longKey: restoreLongNetworkKey, password: password, - systemConfigs: this.configs, messages: this.messages, errors: this.errors - }); - } else if (name && password) { + const { name, password, totpToken, unlockKey } = this; + if (name && password) { this.login({ user: {name, password, totpToken, unlockKey}, systemConfigs: this.configs, diff --git a/src/auth/RestorePage.vue b/src/auth/RestorePage.vue new file mode 100644 index 0000000..73deec7 --- /dev/null +++ b/src/auth/RestorePage.vue @@ -0,0 +1,80 @@ + + + + {{ messages.form_title_restore }} + + + + {{messages.field_label_restore_short_key}} + + Required + + {{ errors.first('restoreShortKey') }} + + + + + {{messages.field_label_restore_long_key}} + + Required + + {{ errors.first('restoreLongNetworkKey') }} + + + + + {{messages.field_label_password}} + + + {{ errors.first('password') }} + + + + + + {{ messages.button_label_restore }} + + + + + + + +
{{messages.message_login_authenticator_auth}}