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
Hide 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';
...
@@ -2,7 +2,8 @@ import * as service from '../../services/tos';
import
{
message
}
from
'antd'
;
import
{
message
}
from
'antd'
;
import
{
Link
,
useIntl
,
connect
,
Dispatch
,
history
}
from
'umi'
;
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'
;
import
{
printf
}
from
'@/utils/log'
;
...
@@ -73,7 +74,27 @@ export default {
...
@@ -73,7 +74,27 @@ export default {
{
{
let
Data
=
null
;
let
Data
=
null
;
yield
put
({
type
:
'returnPage'
,
Data
});
yield
put
({
type
:
'returnPage'
,
Data
});
history
.
push
(
'/AccountManagement/account'
);
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
;
break
;
case
38
:
case
38
:
...
...
src/models/login.ts
View file @
da71641e
...
@@ -36,7 +36,7 @@ export interface LoginModelType {
...
@@ -36,7 +36,7 @@ export interface LoginModelType {
changeLoginStatus
:
Reducer
<
StateType
>
;
changeLoginStatus
:
Reducer
<
StateType
>
;
saveToken
:
Reducer
<
StateType
>
;
saveToken
:
Reducer
<
StateType
>
;
resetPwd
:
Reducer
<
StateType
>
;
resetPwd
:
Reducer
<
StateType
>
;
setResultLogin
:
Reducer
<
StateType
>
setResultLogin
:
Reducer
<
StateType
>
;
};
};
}
}
...
@@ -50,7 +50,7 @@ const Model: LoginModelType = {
...
@@ -50,7 +50,7 @@ const Model: LoginModelType = {
password
:
''
,
password
:
''
,
result
:
false
,
result
:
false
,
resultLogin
:
false
,
resultLogin
:
false
,
userStatus
:
0
,
// 0:首次登陆 1:修改密码
userStatus
:
0
,
// 0:首次登陆 1:修改密码
},
},
reducers
:
{
reducers
:
{
...
@@ -74,8 +74,8 @@ const Model: LoginModelType = {
...
@@ -74,8 +74,8 @@ const Model: LoginModelType = {
setResultLogin
(
state
,
{
resultLogin
})
{
setResultLogin
(
state
,
{
resultLogin
})
{
return
{
return
{
...
state
,
...
state
,
resultLogin
resultLogin
,
}
}
;
},
},
},
},
...
@@ -98,16 +98,16 @@ const Model: LoginModelType = {
...
@@ -98,16 +98,16 @@ const Model: LoginModelType = {
payload
:
response
,
payload
:
response
,
});
});
if
(
payload
.
remenber
)
{
if
(
payload
.
remenber
)
{
const
remenberUserName
=
getCookie
(
"remenberUserName"
);
const
remenberUserName
=
getCookie
(
'remenberUserName'
);
const
remenberPwd
=
getCookie
(
"remenberPwd"
);
const
remenberPwd
=
getCookie
(
'remenberPwd'
);
if
(
!
remenberUserName
||
!
remenberPwd
)
{
if
(
!
remenberUserName
||
!
remenberPwd
)
{
// 存储密码
// 存储密码
setCookie
(
"remenberUserName"
,
payload
.
values
.
userName
,
7
)
setCookie
(
'remenberUserName'
,
payload
.
values
.
userName
,
7
);
setCookie
(
"remenberPwd"
,
payload
.
values
.
password
,
7
)
setCookie
(
'remenberPwd'
,
payload
.
values
.
password
,
7
);
}
}
}
else
{
}
else
{
setCookie
(
"remenberUserName"
,
""
,
-
1
)
setCookie
(
'remenberUserName'
,
''
,
-
1
);
setCookie
(
"remenberPwd"
,
""
,
-
1
)
setCookie
(
'remenberPwd'
,
''
,
-
1
);
}
}
const
userMessage
=
yield
call
(
AccountCheckLogin
,
payload
.
values
);
// 请求时间网络
const
userMessage
=
yield
call
(
AccountCheckLogin
,
payload
.
values
);
// 请求时间网络
...
@@ -150,21 +150,20 @@ const Model: LoginModelType = {
...
@@ -150,21 +150,20 @@ const Model: LoginModelType = {
// 只跳到首页
// 只跳到首页
history
.
replace
(
'/'
);
history
.
replace
(
'/'
);
}
else
{
}
else
{
message
.
error
(
"Wrong account or password!"
);
message
.
error
(
'Wrong account or password!'
);
yield
put
({
yield
put
({
type
:
"setResultLogin"
,
type
:
'setResultLogin'
,
resultLogin
:
true
,
resultLogin
:
true
,
})
});
}
}
},
},
*
logout
({
},
{
call
,
put
})
{
*
logout
({},
{
call
,
put
})
{
const
{
redirect
}
=
getPageQuery
();
const
{
redirect
}
=
getPageQuery
();
// Note: There may be security issues, please note
// Note: There may be security issues, please note
// const response = yield call(AccountOut, payload);
// const response = yield call(AccountOut, payload);
if
(
window
.
location
.
pathname
!==
'/user/login'
&&
!
redirect
)
{
if
(
window
.
location
.
pathname
!==
'/user/login'
&&
!
redirect
)
{
// 清
楚
用户信息
// 清
除
用户信息
localStorage
.
removeItem
(
'userInfo'
);
localStorage
.
removeItem
(
'userInfo'
);
localStorage
.
removeItem
(
'permission'
);
localStorage
.
removeItem
(
'permission'
);
localStorage
.
removeItem
(
'CommunityList'
);
localStorage
.
removeItem
(
'CommunityList'
);
...
@@ -209,10 +208,10 @@ const Model: LoginModelType = {
...
@@ -209,10 +208,10 @@ const Model: LoginModelType = {
*
setResult
({
payload
},
{
put
})
{
*
setResult
({
payload
},
{
put
})
{
yield
put
({
yield
put
({
type
:
"setResultLogin"
,
type
:
'setResultLogin'
,
resultLogin
:
payload
.
resultLogin
||
false
,
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