Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
T
TOSTUMI
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Maple
TOSTUMI
Commits
da71641e
Commit
da71641e
authored
Feb 23, 2021
by
cellee
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改密码重新登录
Signed-off-by:
cellee
<
893264950@qq.com
>
parent
1c6ae294
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
41 additions
and
21 deletions
+41
-21
Account.ts
src/models/CommunityManagement/Account.ts
+23
-2
login.ts
src/models/login.ts
+18
-19
No files found.
src/models/CommunityManagement/Account.ts
View file @
da71641e
...
...
@@ -2,7 +2,8 @@ import * as service from '../../services/tos';
import
{
message
}
from
'antd'
;
import
{
Link
,
useIntl
,
connect
,
Dispatch
,
history
}
from
'umi'
;
import
{
routerRedux
}
from
'dva/router'
;
import
{
stringify
}
from
'querystring'
;
import
{
setCookie
}
from
'@/utils/method'
;
import
{
printf
}
from
'@/utils/log'
;
...
...
@@ -73,8 +74,28 @@ export default {
{
let
Data
=
null
;
yield
put
({
type
:
'returnPage'
,
Data
});
if
(
resp
.
data
.
isEditPsw
&&
resp
.
data
.
isEditPsw
==
1
)
{
// 这是修改了密码 需要重新登录
// 清除用户信息
localStorage
.
removeItem
(
'userInfo'
);
localStorage
.
removeItem
(
'permission'
);
localStorage
.
removeItem
(
'CommunityList'
);
setCookie
(
'token'
,
''
);
setCookie
(
'id'
,
''
);
setCookie
(
'name'
,
''
);
setCookie
(
'phone'
,
''
);
history
.
replace
({
pathname
:
'/user/login'
,
search
:
stringify
({
redirect
:
window
.
location
.
href
,
}),
});
message
.
success
(
'Password modified successfully, login again!'
);
}
else
{
history
.
push
(
'/AccountManagement/account'
);
}
}
break
;
case
38
:
{
...
...
src/models/login.ts
View file @
da71641e
...
...
@@ -36,7 +36,7 @@ export interface LoginModelType {
changeLoginStatus
:
Reducer
<
StateType
>
;
saveToken
:
Reducer
<
StateType
>
;
resetPwd
:
Reducer
<
StateType
>
;
setResultLogin
:
Reducer
<
StateType
>
setResultLogin
:
Reducer
<
StateType
>
;
};
}
...
...
@@ -74,8 +74,8 @@ const Model: LoginModelType = {
setResultLogin
(
state
,
{
resultLogin
})
{
return
{
...
state
,
resultLogin
}
resultLogin
,
}
;
},
},
...
...
@@ -98,16 +98,16 @@ const Model: LoginModelType = {
payload
:
response
,
});
if
(
payload
.
remenber
)
{
const
remenberUserName
=
getCookie
(
"remenberUserName"
);
const
remenberPwd
=
getCookie
(
"remenberPwd"
);
const
remenberUserName
=
getCookie
(
'remenberUserName'
);
const
remenberPwd
=
getCookie
(
'remenberPwd'
);
if
(
!
remenberUserName
||
!
remenberPwd
)
{
// 存储密码
setCookie
(
"remenberUserName"
,
payload
.
values
.
userName
,
7
)
setCookie
(
"remenberPwd"
,
payload
.
values
.
password
,
7
)
setCookie
(
'remenberUserName'
,
payload
.
values
.
userName
,
7
);
setCookie
(
'remenberPwd'
,
payload
.
values
.
password
,
7
);
}
}
else
{
setCookie
(
"remenberUserName"
,
""
,
-
1
)
setCookie
(
"remenberPwd"
,
""
,
-
1
)
setCookie
(
'remenberUserName'
,
''
,
-
1
);
setCookie
(
'remenberPwd'
,
''
,
-
1
);
}
const
userMessage
=
yield
call
(
AccountCheckLogin
,
payload
.
values
);
// 请求时间网络
...
...
@@ -150,21 +150,20 @@ const Model: LoginModelType = {
// 只跳到首页
history
.
replace
(
'/'
);
}
else
{
message
.
error
(
"Wrong account or password!"
);
message
.
error
(
'Wrong account or password!'
);
yield
put
({
type
:
"setResultLogin"
,
type
:
'setResultLogin'
,
resultLogin
:
true
,
})
});
}
},
*
logout
({
},
{
call
,
put
})
{
*
logout
({},
{
call
,
put
})
{
const
{
redirect
}
=
getPageQuery
();
// Note: There may be security issues, please note
// const response = yield call(AccountOut, payload);
if
(
window
.
location
.
pathname
!==
'/user/login'
&&
!
redirect
)
{
// 清
楚
用户信息
// 清
除
用户信息
localStorage
.
removeItem
(
'userInfo'
);
localStorage
.
removeItem
(
'permission'
);
localStorage
.
removeItem
(
'CommunityList'
);
...
...
@@ -209,10 +208,10 @@ const Model: LoginModelType = {
*
setResult
({
payload
},
{
put
})
{
yield
put
({
type
:
"setResultLogin"
,
type
:
'setResultLogin'
,
resultLogin
:
payload
.
resultLogin
||
false
,
})
}
})
;
}
,
},
};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment