Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Chatopera OpenSource
/
ferry_web
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Members
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
7f77654c
authored
Aug 18, 2020
by
Mr. Lan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ldap登陆校验。
parent
35e824d2
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
25 additions
and
15 deletions
src/api/system/sysuser.js
src/api/user.js
src/store/modules/user.js
src/views/login/index.vue
src/views/profile/resetPwd.vue
src/api/system/sysuser.js
View file @
7f77654c
...
@@ -103,10 +103,11 @@ export function updateUserProfile(data) {
...
@@ -103,10 +103,11 @@ export function updateUserProfile(data) {
}
}
// 用户密码重置
// 用户密码重置
export
function
updateUserPwd
(
oldPassword
,
newPassword
)
{
export
function
updateUserPwd
(
oldPassword
,
newPassword
,
passwordType
)
{
const
data
=
{
const
data
=
{
oldPassword
,
oldPassword
,
newPassword
newPassword
,
passwordType
}
}
return
request
({
return
request
({
url
:
'/api/v1/user/pwd'
,
url
:
'/api/v1/user/pwd'
,
...
...
src/api/user.js
View file @
7f77654c
import
request
from
'@/utils/request'
import
request
from
'@/utils/request'
export
function
login
(
data
,
loginType
)
{
export
function
login
(
data
)
{
return
request
({
return
request
({
url
:
`/login
?login_type=
${
loginType
}
`
,
url
:
`/login`
,
method
:
'post'
,
method
:
'post'
,
data
data
})
})
...
...
src/store/modules/user.js
View file @
7f77654c
...
@@ -40,12 +40,8 @@ const mutations = {
...
@@ -40,12 +40,8 @@ const mutations = {
const
actions
=
{
const
actions
=
{
// user login
// user login
login
({
commit
},
userInfo
)
{
login
({
commit
},
userInfo
)
{
var
loginType
=
0
if
(
userInfo
.
loginType
===
true
)
{
loginType
=
1
}
return
new
Promise
((
resolve
,
reject
)
=>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
login
(
userInfo
,
loginType
).
then
(
response
=>
{
login
(
userInfo
).
then
(
response
=>
{
const
{
token
}
=
response
const
{
token
}
=
response
commit
(
'SET_TOKEN'
,
token
)
commit
(
'SET_TOKEN'
,
token
)
setToken
(
token
)
setToken
(
token
)
...
...
src/views/login/index.vue
View file @
7f77654c
...
@@ -89,7 +89,7 @@
...
@@ -89,7 +89,7 @@
<img
style=
"height: 48px;width: 100%;border: 1px solid rgba(0,0,0, 0.1);border-radius:5px;"
:src=
"codeUrl"
@
click=
"getCode"
>
<img
style=
"height: 48px;width: 100%;border: 1px solid rgba(0,0,0, 0.1);border-radius:5px;"
:src=
"codeUrl"
@
click=
"getCode"
>
</div>
</div>
<div
prop=
"code"
style=
"width: 100%;float: left;margin-bottom: 13px"
>
<div
prop=
"code"
style=
"width: 100%;float: left;margin-bottom: 13px"
>
<el-checkbox
v-model=
"login
Form.loginType
"
>
LDAP登陆
</el-checkbox>
<el-checkbox
v-model=
"login
TypeStatus
"
>
LDAP登陆
</el-checkbox>
</div>
</div>
<el-button
:loading=
"loading"
type=
"primary"
style=
"width:100%;padding:12px 20px;margin-bottom:30px;"
@
click
.
native
.
prevent=
"handleLogin"
>
<el-button
:loading=
"loading"
type=
"primary"
style=
"width:100%;padding:12px 20px;margin-bottom:30px;"
@
click
.
native
.
prevent=
"handleLogin"
>
<span
v-if=
"!loading"
>
登 录
</span>
<span
v-if=
"!loading"
>
登 录
</span>
...
@@ -122,6 +122,7 @@ export default {
...
@@ -122,6 +122,7 @@ export default {
components
:
{
SocialSign
},
components
:
{
SocialSign
},
data
()
{
data
()
{
return
{
return
{
loginTypeStatus
:
true
,
codeUrl
:
''
,
codeUrl
:
''
,
cookiePassword
:
''
,
cookiePassword
:
''
,
loginForm
:
{
loginForm
:
{
...
@@ -130,7 +131,7 @@ export default {
...
@@ -130,7 +131,7 @@ export default {
rememberMe
:
false
,
rememberMe
:
false
,
code
:
''
,
code
:
''
,
uuid
:
''
,
uuid
:
''
,
loginType
:
true
loginType
:
1
},
},
loginRules
:
{
loginRules
:
{
username
:
[
username
:
[
...
@@ -221,6 +222,10 @@ export default {
...
@@ -221,6 +222,10 @@ export default {
handleLogin
()
{
handleLogin
()
{
this
.
$refs
.
loginForm
.
validate
(
valid
=>
{
this
.
$refs
.
loginForm
.
validate
(
valid
=>
{
if
(
valid
)
{
if
(
valid
)
{
if
(
!
this
.
loginTypeStatus
)
{
this
.
loginForm
.
loginType
=
0
}
this
.
loading
=
true
this
.
loading
=
true
this
.
$store
.
dispatch
(
'user/login'
,
this
.
loginForm
)
this
.
$store
.
dispatch
(
'user/login'
,
this
.
loginForm
)
.
then
(()
=>
{
.
then
(()
=>
{
...
...
src/views/profile/resetPwd.vue
View file @
7f77654c
...
@@ -6,9 +6,12 @@
...
@@ -6,9 +6,12 @@
<el-form-item
label=
"新密码"
prop=
"newPassword"
>
<el-form-item
label=
"新密码"
prop=
"newPassword"
>
<el-input
v-model=
"user.newPassword"
placeholder=
"请输入新密码"
type=
"password"
/>
<el-input
v-model=
"user.newPassword"
placeholder=
"请输入新密码"
type=
"password"
/>
</el-form-item>
</el-form-item>
<el-form-item
label=
"确认密码"
prop=
"confirmPassword"
>
<el-form-item
label=
"确认密码"
prop=
"confirmPassword"
style=
"/* margin-bottom: 10px */"
>
<el-input
v-model=
"user.confirmPassword"
placeholder=
"请确认密码"
type=
"password"
/>
<el-input
v-model=
"user.confirmPassword"
placeholder=
"请确认密码"
type=
"password"
/>
</el-form-item>
</el-form-item>
<!--
<el-form-item
style=
"margin-bottom: 5px"
>
<el-checkbox
v-model=
"passwordTyleStatus"
>
LDAP密码
</el-checkbox>
</el-form-item>
-->
<el-form-item>
<el-form-item>
<el-button
type=
"primary"
size=
"mini"
@
click=
"submit"
>
保存
</el-button>
<el-button
type=
"primary"
size=
"mini"
@
click=
"submit"
>
保存
</el-button>
<el-button
type=
"danger"
size=
"mini"
@
click=
"close"
>
关闭
</el-button>
<el-button
type=
"danger"
size=
"mini"
@
click=
"close"
>
关闭
</el-button>
...
@@ -29,11 +32,12 @@ export default {
...
@@ -29,11 +32,12 @@ export default {
}
}
}
}
return
{
return
{
test
:
'1test'
,
passwordTyleStatus
:
true
,
user
:
{
user
:
{
oldPassword
:
undefined
,
oldPassword
:
undefined
,
newPassword
:
undefined
,
newPassword
:
undefined
,
confirmPassword
:
undefined
confirmPassword
:
undefined
,
passwordType
:
1
},
},
// 表单校验
// 表单校验
rules
:
{
rules
:
{
...
@@ -55,7 +59,11 @@ export default {
...
@@ -55,7 +59,11 @@ export default {
submit
()
{
submit
()
{
this
.
$refs
[
'form'
].
validate
(
valid
=>
{
this
.
$refs
[
'form'
].
validate
(
valid
=>
{
if
(
valid
)
{
if
(
valid
)
{
updateUserPwd
(
this
.
user
.
oldPassword
,
this
.
user
.
newPassword
).
then
(
if
(
!
this
.
passwordTyleStatus
)
{
this
.
user
.
passwordType
=
0
}
this
.
user
.
passwordType
=
0
updateUserPwd
(
this
.
user
.
oldPassword
,
this
.
user
.
newPassword
,
this
.
user
.
passwordType
).
then
(
response
=>
{
response
=>
{
if
(
response
.
code
===
200
)
{
if
(
response
.
code
===
200
)
{
this
.
msgSuccess
(
'修改成功'
)
this
.
msgSuccess
(
'修改成功'
)
...
...
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