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
a4642df5
Commit
a4642df5
authored
Feb 05, 2020
by
蒋勇
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d
parent
ed80e855
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
85 additions
and
3 deletions
+85
-3
bigdata/app/base/api/impl/auth/accessAuth.js
+45
-0
bigdata/app/base/service/impl/auth/userSve.js
+37
-0
bigdata/app/config/localsettings.js
+3
-3
No files found.
bigdata/app/base/api/impl/auth/accessAuth.js
View file @
a4642df5
...
@@ -336,6 +336,51 @@ class AccessAuthAPI extends APIBase {
...
@@ -336,6 +336,51 @@ class AccessAuthAPI extends APIBase {
return
system
.
getResultSuccess
({
auth_url
:
authUrl
,
opencode
:
opencode
});
return
system
.
getResultSuccess
({
auth_url
:
authUrl
,
opencode
:
opencode
});
}
}
/**
/**
* modifyLoginNameByOldMobile
* 按照手机号和密码改变登录账号
* oldmobile
* pwd
* newmobile
* vcode
* 返回
* {
* status:0-成功 -1:失败
* msg:''--消息提示
* data:-130--已经存在账户
* }
*/
async
modifyLoginNameByOldMobile
(
pobj
,
qobj
,
req
){
var
appid
=
req
.
app
.
id
;
var
appkey
=
req
.
app
.
appkey
;
if
(
!
pobj
.
oldmobile
)
{
return
system
.
getResult
(
null
,
"原电话号码不能为空."
);
}
if
(
!
pobj
.
pwd
)
{
return
system
.
getResult
(
null
,
"密码不能为空."
);
}
//检查原账户是否存在
var
u
=
await
this
.
userSve
.
findUserByMobilePwd
(
appid
,
pobj
.
oldmobile
,
pobj
.
pwd
);
if
(
!
u
){
return
system
.
getResult
(
null
,
"要修改的账户不存在."
);
}
if
(
!
pobj
.
newmobile
)
{
return
system
.
getResult
(
null
,
"新电话号码不能未空."
);
}
if
(
!
pobj
.
vcode
)
{
return
system
.
getResult
(
null
,
"验证码不能未空."
);
}
var
cacheCode
=
await
this
.
cacheManager
[
"VCodeCache"
].
cache
(
appkey
+
"_"
+
pobj
.
newmobile
,
null
);
if
(
pobj
.
vcode
!=
cacheCode
.
vcode
)
{
return
system
.
getResultFail
(
-
1
,
"验证码校验不成功,请重新获取验证码验证."
,
system
.
verifyVCodeFail
);
}
//修改为新的账号
var
ruser
=
await
this
.
userSve
.
updateUserMobile
(
u
,
pobj
.
newmobile
);
if
(
!
ruser
){
return
system
.
getResultFail
(
-
1
,
"账号已经存在"
,
-
130
);
}
return
system
.
getResult
(
ruser
);
}
/**
* 按照手机号和验证码修改密码
* 按照手机号和验证码修改密码
*/
*/
async
modiPasswordByMobile
(
pobj
,
qobj
,
req
){
async
modiPasswordByMobile
(
pobj
,
qobj
,
req
){
...
...
bigdata/app/base/service/impl/auth/userSve.js
View file @
a4642df5
...
@@ -11,6 +11,32 @@ class UserService extends ServiceBase {
...
@@ -11,6 +11,32 @@ class UserService extends ServiceBase {
this
.
roleDao
=
system
.
getObject
(
"db.auth.roleDao"
);
this
.
roleDao
=
system
.
getObject
(
"db.auth.roleDao"
);
this
.
compDao
=
system
.
getObject
(
"db.common.companyDao"
);
this
.
compDao
=
system
.
getObject
(
"db.common.companyDao"
);
}
}
//按照电话和密码查询出用户
async
findUserByMobilePwd
(
appid
,
mobile
,
pwd
){
var
pwd
=
await
super
.
getEncryptStr
(
pwd
);
var
mu
=
await
this
.
db
.
models
.
user
.
findOne
({
where
:{
app_id
:
appid
,
mobile
:
mobile
,
password
:
pwd
}
});
return
mu
;
}
//修改为新账号
async
updateUserMobile
(
u
,
newmobile
){
var
existNew
=
await
this
.
db
.
models
.
user
.
findOne
({
where
:{
app_id
:
u
.
app_id
,
mobile
:
newmobile
}
});
if
(
existNew
){
return
null
;
}
u
.
userName
=
newmobile
;
u
.
mobile
=
newmobile
;
u
.
save
();
var
ac
=
await
this
.
db
.
models
.
account
.
findById
(
u
.
account_id
);
ac
.
userName
=
newmobile
;
ac
.
mobile
=
newmobile
;
ac
.
save
();
return
u
;
}
async
modiPasswordByMobile
(
appid
,
mobile
,
newpwd
){
async
modiPasswordByMobile
(
appid
,
mobile
,
newpwd
){
var
self
=
this
;
var
self
=
this
;
var
newp
=
await
super
.
getEncryptStr
(
newpwd
);
var
newp
=
await
super
.
getEncryptStr
(
newpwd
);
...
@@ -388,3 +414,14 @@ module.exports = UserService;
...
@@ -388,3 +414,14 @@ module.exports = UserService;
// }).catch(function(e){
// }).catch(function(e){
// console.log(e);
// console.log(e);
// });
// });
// (async ()=>{
// var us=new UserService();
// var u= await us.findUserByMobilePwd(2,'123456789','123');
// console.log(u.userName);
// var x=await us.updateUserMobile(u,'987456');
// if(!x){
// console.log("exit...");
// }
// console.log("ok...");
// })();
bigdata/app/config/localsettings.js
View file @
a4642df5
...
@@ -7,10 +7,10 @@ var settings = {
...
@@ -7,10 +7,10 @@ var settings = {
},
},
database
:
{
database
:
{
dbname
:
"paas"
,
dbname
:
"paas"
,
user
:
"
write
"
,
user
:
"
root
"
,
password
:
"
write
"
,
password
:
"
123456
"
,
config
:
{
config
:
{
host
:
'192.168.
18.237
'
,
host
:
'192.168.
4.119
'
,
port
:
3306
,
port
:
3306
,
dialect
:
'mysql'
,
dialect
:
'mysql'
,
operatorsAliases
:
false
,
operatorsAliases
:
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