diff --git a/src/api/admin.js b/src/api/admin.js index d3370218..b56391ed 100644 --- a/src/api/admin.js +++ b/src/api/admin.js @@ -59,6 +59,22 @@ adminApi.refreshToken = refreshToken => { }) } +adminApi.sendResetCode = param => { + return service({ + url: `${baseUrl}/password/code`, + data: param, + method: 'post' + }) +} + +adminApi.resetPassword = param => { + return service({ + url: `${baseUrl}/password/reset`, + data: param, + method: 'put' + }) +} + adminApi.updateAdminAssets = () => { return service({ url: `${baseUrl}/halo-admin`, diff --git a/src/config/router.config.js b/src/config/router.config.js index f336de32..981e5711 100644 --- a/src/config/router.config.js +++ b/src/config/router.config.js @@ -218,6 +218,12 @@ export const constantRouterMap = [ meta: { title: '安装向导' }, component: () => import('@/views/system/Installation') }, + { + path: '/password/reset', + name: 'ResetPassword', + meta: { title: '重置密码' }, + component: () => import('@/views/user/ResetPassword') + }, { path: '/404', name: 'NotFound', diff --git a/src/permission.js b/src/permission.js index 9d180d0d..bd20ade5 100644 --- a/src/permission.js +++ b/src/permission.js @@ -1,14 +1,19 @@ import Vue from 'vue' import router from './router' import store from './store' -import { setDocumentTitle, domTitle } from '@/utils/domUtil' +import { + setDocumentTitle, + domTitle +} from '@/utils/domUtil' import NProgress from 'nprogress' // progress bar import 'nprogress/nprogress.css' // progress bar style -NProgress.configure({ showSpinner: false }) // NProgress Configuration +NProgress.configure({ + showSpinner: false +}) // NProgress Configuration -const whiteList = ['Login', 'Install', 'NotFound'] // no redirect whitelist +const whiteList = ['Login', 'Install', 'NotFound', 'ResetPassword'] // no redirect whitelist router.beforeEach((to, from, next) => { NProgress.start() @@ -16,7 +21,9 @@ router.beforeEach((to, from, next) => { Vue.$log.debug('Token', store.getters.token) if (store.getters.token) { if (to.name === 'Login') { - next({ name: 'Dashboard' }) + next({ + name: 'Dashboard' + }) NProgress.done() return } @@ -35,6 +42,11 @@ router.beforeEach((to, from, next) => { return } - next({ name: 'Login', query: { redirect: to.fullPath } }) + next({ + name: 'Login', + query: { + redirect: to.fullPath + } + }) NProgress.done() }) diff --git a/src/utils/service.js b/src/utils/service.js index b3c0787b..3993dfce 100644 --- a/src/utils/service.js +++ b/src/utils/service.js @@ -8,7 +8,7 @@ import router from '@/router' import { isObject } from './util' const service = axios.create({ - timeout: 5000, + timeout: 8000, withCredentials: true }) diff --git a/src/views/user/Login.vue b/src/views/user/Login.vue index 000d4952..979fc420 100644 --- a/src/views/user/Login.vue +++ b/src/views/user/Login.vue @@ -1,9 +1,9 @@