Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
W
web_nangaoclub
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
孙谢炜
web_nangaoclub
Commits
03d77545
Commit
03d77545
authored
May 13, 2024
by
孙谢炜
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加登录检测、密码加密
parent
683f5f9b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
35 additions
and
7 deletions
+35
-7
space.vue
vuetify-project/src/components/space.vue
+9
-2
login.vue
vuetify-project/src/login.vue
+14
-0
user_manage.vue
vuetify-project/src/user_manage.vue
+12
-5
No files found.
vuetify-project/src/components/space.vue
View file @
03d77545
...
...
@@ -245,6 +245,7 @@
import
{
ref
,
watch
}
from
'vue'
;
import
{
reactive
}
from
'vue'
;
import
axios
from
'axios'
;
import
CryptoJS
from
'crypto-js'
;
const
form
=
ref
(
null
);
const
password
=
ref
(
null
);
...
...
@@ -479,9 +480,14 @@ function info(title, text) {
dialog
.
value
=
true
;
}
function
md5Hash
(
password
)
{
return
CryptoJS
.
MD5
(
password
).
toString
();
}
function
setUserinform
()
{
informLoading
.
value
=
true
;
var
user
=
{
user_name
:
username1
.
value
,
user_password
:
password
.
value
}
var
user
=
{
user_name
:
username1
.
value
,
user_password
:
password
.
value
};
user
.
user_password
=
md5Hash
(
user
.
user_password
);
if
(
user
.
user_name
!==
null
||
user
.
user_password
!==
null
)
{
axios
.
post
(
'/api/setUserinform'
,
user
...
...
@@ -490,11 +496,12 @@ function setUserinform() {
const
data
=
response
.
data
;
if
(
data
.
status
==
'SUCCESS'
)
{
info
(
'修改成功!'
,
""
);
username
.
value
=
user
.
user_name
;
//
username.value = user.user_name;
}
else
if
(
data
.
status
==
'FAILED'
)
{
info
(
'用户名已存在!'
,
""
);
}
refresh
();
})
.
catch
(
function
(
error
)
{
console
.
log
(
error
);
...
...
vuetify-project/src/login.vue
View file @
03d77545
...
...
@@ -46,6 +46,20 @@ const tab = ref(null)
</v-app>
</
template
>
<
script
>
import
{
ref
}
from
'vue'
;
import
{
reactive
}
from
'vue'
;
import
axios
from
'axios'
;
axios
.
get
(
'/api/currentUser'
,)
.
then
(
function
(
response
){
const
data
=
response
.
data
;
if
(
data
.
status
===
"SUCCESS"
){
window
.
location
.
href
=
'/main.html'
;
}
})
</
script
>
<
style
>
.main-card
{
width
:
300px
;
...
...
vuetify-project/src/user_manage.vue
View file @
03d77545
...
...
@@ -19,9 +19,9 @@
<
template
v-slot:item
.
realname=
"{ item }"
>
<p
v-if=
"item.user_realname"
style=
"width:50px"
>
{{
item
.
user_realname
}}
</p>
</
template
>
<
template
v-slot:item
.
password=
"{ item }"
>
<
!-- <
template v-slot:item.password="{ item }">
<p v-if="item.user_password" style="width:50px">{{ item.user_password }}</p>
</
template
>
</template>
-->
<
template
v-slot:item
.
is_member=
"{ item }"
>
<p
v-if=
"item.user_is_member"
style=
"width:50px"
>
{{
item
.
user_is_member
}}
</p>
</
template
>
...
...
@@ -44,8 +44,8 @@
color=
"indigo"
label=
"用户名"
></v-text-field>
<v-text-field
v-model=
"selectUser.user_realname"
:rules=
"[rules.usrname]"
variant=
"filled"
color=
"indigo"
label=
"姓名"
></v-text-field>
<v-text-field
v-model=
"
selectUser.
user_password"
:rules=
"[rules.password]"
variant=
"filled"
color=
"indigo"
label=
"密码"
></v-text-field>
<v-text-field
v-model=
"user_password"
:rules=
"[rules.password]"
variant=
"filled"
color=
"indigo"
label=
"
修改
密码"
></v-text-field>
<v-select
v-model=
"selectUser.is_member"
:rules=
"[rules.su]"
:items=
"['是', '否']"
variant=
"filled"
color=
"indigo"
label=
"会员"
></v-select>
<v-select
v-model=
"selectUser.is_su"
:rules=
"[rules.member]"
:items=
"['是', '否']"
...
...
@@ -78,6 +78,7 @@ import { ref } from 'vue';
import
{
reactive
}
from
'vue'
;
// import { computed } from 'vue';
import
axios
from
'axios'
;
import
CryptoJS
from
'crypto-js'
;
const
search
=
ref
(
''
);
// const actions_text = ref('');
...
...
@@ -85,7 +86,7 @@ const headers = reactive([
{
title
:
'ID'
,
key
:
'userid'
},
{
title
:
'用户名'
,
key
:
'username'
},
{
title
:
'姓名'
,
key
:
'realname'
},
{
title
:
'密码'
,
key
:
'password'
},
//
{ title: '密码', key: 'password' },
{
title
:
'会员'
,
key
:
'is_member'
},
{
title
:
'管理员'
,
key
:
'is_su'
},
{
title
:
'编辑'
,
key
:
'actions'
},
...
...
@@ -120,6 +121,7 @@ const selectUser = ref({
is_member
:
''
,
is_su
:
''
,
});
const
user_password
=
ref
(
''
);
const
cardtitle
=
ref
(
null
);
const
cardtext
=
ref
(
null
);
...
...
@@ -175,6 +177,10 @@ function editUser(item) {
selectUser
.
value
=
item
;
}
function
md5Hash
(
password
)
{
return
CryptoJS
.
MD5
(
password
).
toString
();
}
function
changeUser
()
{
userLoading
.
value
=
true
;
if
(
selectUser
.
value
.
is_member
===
'是'
){
...
...
@@ -189,6 +195,7 @@ function changeUser() {
if
(
selectUser
.
value
.
is_su
===
'否'
){
selectUser
.
value
.
user_is_su
=
false
}
selectUser
.
value
.
user_password
=
md5Hash
(
user_password
.
value
);
// 使用MD5进行前端哈希处理
axios
.
post
(
'/api/userManage'
,
selectUser
.
value
)
.
then
(
function
(
response
)
{
const
data1
=
response
.
data
;
...
...
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