fix: rememberMe bug

This commit is contained in:
xingyu 2023-01-05 15:02:32 +08:00
parent efcbd1ab68
commit 15ef2dbf78
2 changed files with 12 additions and 8 deletions

View File

@ -47,7 +47,9 @@ export type LoginFormType = {
export const getLoginForm = () => { export const getLoginForm = () => {
const loginForm: LoginFormType = wsCache.get(LoginFormKey) const loginForm: LoginFormType = wsCache.get(LoginFormKey)
loginForm.password = decrypt(loginForm.password) as string if (loginForm) {
loginForm.password = decrypt(loginForm.password) as string
}
return loginForm return loginForm
} }

View File

@ -215,13 +215,15 @@ const getTenantId = async () => {
} }
// //
const getCookie = () => { const getCookie = () => {
const { username, password, rememberMe, tenantName } = authUtil.getLoginForm() const loginForm = authUtil.getLoginForm()
loginData.loginForm = { if (loginForm) {
...loginData.loginForm, loginData.loginForm = {
username: username ? username : loginData.loginForm.username, ...loginData.loginForm,
password: password ? password : loginData.loginForm.password, username: loginForm.username ? loginForm.username : loginData.loginForm.username,
rememberMe: rememberMe ? true : false, password: loginForm.password ? loginForm.password : loginData.loginForm.password,
tenantName: tenantName ? tenantName : loginData.loginForm.tenantName rememberMe: loginForm.rememberMe ? true : false,
tenantName: loginForm.tenantName ? loginForm.tenantName : loginData.loginForm.tenantName
}
} }
} }
// //