Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Z
zhichan
Overview
Overview
Details
Activity
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
蒋勇
zhichan
Commits
37ce8e7c
Commit
37ce8e7c
authored
Aug 21, 2020
by
Sxy
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'center-manage' of gitlab.gongsibao.com:jiangyong/zhichan into center-manage
parents
a5ef9ee3
a780b11f
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
24 additions
and
13 deletions
+24
-13
center-manage/app/base/db/models/auth/user.js
+4
-0
center-manage/app/base/service/impl/auth/userSve.js
+14
-7
center-manage/app/base/service/sve.base.js
+5
-6
center-manage/app/config/settings.js
+1
-0
No files found.
center-manage/app/base/db/models/auth/user.js
View file @
37ce8e7c
...
@@ -45,6 +45,10 @@ module.exports = (db, DataTypes) => {
...
@@ -45,6 +45,10 @@ module.exports = (db, DataTypes) => {
type
:
DataTypes
.
BOOLEAN
,
type
:
DataTypes
.
BOOLEAN
,
defaultValue
:
false
defaultValue
:
false
},
},
last_change_date
:
{
type
:
DataTypes
.
BOOLEAN
,
defaultValue
:
false
},
isSuper
:
{
isSuper
:
{
type
:
DataTypes
.
BOOLEAN
,
type
:
DataTypes
.
BOOLEAN
,
defaultValue
:
false
defaultValue
:
false
...
...
center-manage/app/base/service/impl/auth/userSve.js
View file @
37ce8e7c
...
@@ -155,15 +155,22 @@ class UserService extends ServiceBase {
...
@@ -155,15 +155,22 @@ class UserService extends ServiceBase {
let
consumer
=
await
this
.
cget
(
UserService
.
consumerUrl
(
p
.
userName
));
let
consumer
=
await
this
.
cget
(
UserService
.
consumerUrl
(
p
.
userName
));
if
(
!
consumer
.
data
)
{
if
(
!
consumer
.
data
)
{
return
null
;
return
null
;
}
else
{
}
console
.
log
(
JSON
.
stringify
(
consumer
.
data
))
var
rtn
=
{}
let
password
=
consumer
.
data
.
tags
[
1
].
split
(
"_"
)[
1
]
;
let
u
=
await
this
.
findOne
({
userName
:
p
.
userName
})
;
let
inpassword
=
this
.
getEncryptStr
(
p
.
password
);
let
inpassword
=
this
.
getEncryptStr
(
p
.
password
);
if
(
password
!=
inpassword
)
{
if
(
u
.
password
!=
inpassword
)
{
return
null
;
return
null
;
}
let
last
=
new
Date
(
u
.
last_change_date
).
getTime
();
//注意月份
let
differ
=
Date
.
now
()
-
last
;
let
days
=
Math
.
round
(
differ
/
(
24
*
60
*
60
*
1000
));
if
(
days
>=
settings
.
changepwdcycle
)
{
//禁用用户
await
this
.
dao
.
updateByWhere
({
isEnabled
:
false
},
{
userName
:
p
.
userName
})
return
null
}
else
if
((
settings
.
changepwdcycle
-
7
)
<=
days
){
rtn
.
hint
=
"请尽快修改密码,否则会禁用您的账户"
}
}
}
var
rtn
=
{}
return
this
.
db
.
transaction
(
async
function
(
t
)
{
return
this
.
db
.
transaction
(
async
function
(
t
)
{
//从缓存中取得
//从缓存中取得
// let userfind = await self.dao.model.findOne({
// let userfind = await self.dao.model.findOne({
...
...
center-manage/app/base/service/sve.base.js
View file @
37ce8e7c
...
@@ -11,11 +11,11 @@ class ServiceBase {
...
@@ -11,11 +11,11 @@ class ServiceBase {
this
.
daoName
=
daoName
;
this
.
daoName
=
daoName
;
this
.
dao
=
system
.
getObject
(
"db."
+
gname
+
"."
+
daoName
);
this
.
dao
=
system
.
getObject
(
"db."
+
gname
+
"."
+
daoName
);
this
.
restS
=
system
.
getObject
(
"util.restClient"
);
this
.
restS
=
system
.
getObject
(
"util.restClient"
);
this
.
md5
=
require
(
"MD5"
);
this
.
crypto
=
require
(
'crypto'
);
}
}
/**
/**
*
*
* @param {*} str
* @param {*} str
* @param {*} isComplexVerification 是否复杂验证
* @param {*} isComplexVerification 是否复杂验证
*/
*/
getEncryptStr
(
str
,
isComplexVerification
)
{
getEncryptStr
(
str
,
isComplexVerification
)
{
...
@@ -25,9 +25,8 @@ class ServiceBase {
...
@@ -25,9 +25,8 @@ class ServiceBase {
if
(
isComplexVerification
)
{
if
(
isComplexVerification
)
{
this
.
complexVerification
(
str
)
this
.
complexVerification
(
str
)
}
}
let
pwd
=
this
.
crypto
.
createHash
(
"sha256"
).
update
(
str
+
"_"
+
settings
.
salt
,
"utf8"
).
digest
(
"base64"
);
var
md5
=
this
.
md5
(
str
+
"_"
+
settings
.
salt
);
return
pwd
.
toLowerCase
();
return
md5
.
toString
().
toLowerCase
();
}
}
complexVerification
(
str
)
{
complexVerification
(
str
)
{
...
...
center-manage/app/config/settings.js
View file @
37ce8e7c
...
@@ -20,6 +20,7 @@ var settings = {
...
@@ -20,6 +20,7 @@ var settings = {
encrypt_secret
:
ENVINPUT
.
ENCRYPT_SECRET
,
encrypt_secret
:
ENVINPUT
.
ENCRYPT_SECRET
,
salt
:
"%iatpD1gcxz7iF#B"
,
salt
:
"%iatpD1gcxz7iF#B"
,
defaultpwd
:
"Temp123456"
,
defaultpwd
:
"Temp123456"
,
changepwdcycle
:
60
,
//密码更换周期 7天前登录提示更改密码 到期后直接禁用账户
basepath
:
path
.
normalize
(
path
.
join
(
__dirname
,
'../..'
)),
basepath
:
path
.
normalize
(
path
.
join
(
__dirname
,
'../..'
)),
port
:
process
.
env
.
NODE_PORT
||
80
,
port
:
process
.
env
.
NODE_PORT
||
80
,
logindex
:
"center_manage"
,
logindex
:
"center_manage"
,
...
...
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