Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
cloud-platform
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
youjj
cloud-platform
Commits
6f43a352
Commit
6f43a352
authored
Oct 24, 2019
by
周健威
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/dev' into dev
parents
3e47ff97
9e643ee4
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
106 additions
and
4 deletions
+106
-4
AuthController.java
...thub/wxiaoqi/security/auth/controller/AuthController.java
+11
-0
IUserService.java
.../com/github/wxiaoqi/security/auth/feign/IUserService.java
+6
-0
AuthService.java
...com/github/wxiaoqi/security/auth/service/AuthService.java
+4
-0
AppAuthServiceImpl.java
...xiaoqi/security/auth/service/impl/AppAuthServiceImpl.java
+26
-0
AuthServiceImpl.java
...b/wxiaoqi/security/auth/service/impl/AuthServiceImpl.java
+23
-0
AppUserRest.java
...va/com/github/wxiaoqi/security/admin/rpc/AppUserRest.java
+14
-4
AppPermissionService.java
...aoqi/security/admin/rpc/service/AppPermissionService.java
+22
-0
No files found.
ace-auth/ace-auth-server/src/main/java/com/github/wxiaoqi/security/auth/controller/AuthController.java
View file @
6f43a352
...
@@ -247,4 +247,15 @@ public class AuthController {
...
@@ -247,4 +247,15 @@ public class AuthController {
return
authService
.
checkToken
(
token
);
return
authService
.
checkToken
(
token
);
}
}
@RequestMapping
(
value
=
"/updUsername"
,
method
=
RequestMethod
.
POST
)
public
ObjectRestResponse
updUsername
(
@RequestParam
(
value
=
"username"
,
defaultValue
=
""
)
String
username
,
@RequestParam
(
value
=
"mobilecode"
,
defaultValue
=
""
)
String
mobilecode
,
HttpServletRequest
request
)
throws
Exception
{
log
.
info
(
username
+
"----require updUsername..."
);
String
token
=
request
.
getHeader
(
tokenHeader
);
return
appAuthService
.
updUsername
(
username
,
mobilecode
,
token
);
}
}
}
ace-auth/ace-auth-server/src/main/java/com/github/wxiaoqi/security/auth/feign/IUserService.java
View file @
6f43a352
...
@@ -5,6 +5,8 @@ import com.github.wxiaoqi.security.api.vo.user.AppUserInfo;
...
@@ -5,6 +5,8 @@ import com.github.wxiaoqi.security.api.vo.user.AppUserInfo;
import
com.github.wxiaoqi.security.api.vo.user.UserInfo
;
import
com.github.wxiaoqi.security.api.vo.user.UserInfo
;
import
com.github.wxiaoqi.security.auth.configuration.FeignConfiguration
;
import
com.github.wxiaoqi.security.auth.configuration.FeignConfiguration
;
import
com.github.wxiaoqi.security.auth.util.user.JwtAuthenticationRequest
;
import
com.github.wxiaoqi.security.auth.util.user.JwtAuthenticationRequest
;
import
com.github.wxiaoqi.security.common.msg.ObjectRestResponse
;
import
io.swagger.annotations.ApiModelProperty
;
import
org.springframework.cloud.openfeign.FeignClient
;
import
org.springframework.cloud.openfeign.FeignClient
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
...
@@ -78,4 +80,8 @@ public interface IUserService {
...
@@ -78,4 +80,8 @@ public interface IUserService {
@PostMapping
(
"/api/app/imi/login"
)
@PostMapping
(
"/api/app/imi/login"
)
String
loginImiWithToken
();
String
loginImiWithToken
();
@ApiModelProperty
(
"修改手机号码"
)
@GetMapping
(
"/api/app/updUsername"
)
public
ObjectRestResponse
updUsername
(
@RequestParam
(
value
=
"username"
)
String
username
,
@RequestParam
(
value
=
"mobilecode"
)
String
mobilecode
,
@RequestParam
(
value
=
"userId"
,
defaultValue
=
"0"
)
Integer
userId
);
}
}
ace-auth/ace-auth-server/src/main/java/com/github/wxiaoqi/security/auth/service/AuthService.java
View file @
6f43a352
...
@@ -6,6 +6,8 @@ import com.github.wxiaoqi.security.auth.util.user.JwtAuthenticationRequest;
...
@@ -6,6 +6,8 @@ import com.github.wxiaoqi.security.auth.util.user.JwtAuthenticationRequest;
import
com.github.wxiaoqi.security.common.msg.ObjectRestResponse
;
import
com.github.wxiaoqi.security.common.msg.ObjectRestResponse
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
javax.servlet.http.HttpServletRequest
;
public
interface
AuthService
{
public
interface
AuthService
{
String
login
(
JwtAuthenticationRequest
authenticationRequest
)
throws
Exception
;
String
login
(
JwtAuthenticationRequest
authenticationRequest
)
throws
Exception
;
ObjectRestResponse
loginSmall
(
JwtAuthenticationRequest
authenticationRequest
)
throws
Exception
;
ObjectRestResponse
loginSmall
(
JwtAuthenticationRequest
authenticationRequest
)
throws
Exception
;
...
@@ -39,4 +41,6 @@ public interface AuthService {
...
@@ -39,4 +41,6 @@ public interface AuthService {
String
loginImiWithToken
();
String
loginImiWithToken
();
ObjectRestResponse
checkToken
(
String
token
);
ObjectRestResponse
checkToken
(
String
token
);
ObjectRestResponse
updUsername
(
String
username
,
String
mobilecode
,
String
token
);
}
}
ace-auth/ace-auth-server/src/main/java/com/github/wxiaoqi/security/auth/service/impl/AppAuthServiceImpl.java
View file @
6f43a352
...
@@ -13,10 +13,13 @@ import com.github.wxiaoqi.security.common.constant.RequestTypeConstants;
...
@@ -13,10 +13,13 @@ import com.github.wxiaoqi.security.common.constant.RequestTypeConstants;
import
com.github.wxiaoqi.security.common.exception.auth.UserInvalidException
;
import
com.github.wxiaoqi.security.common.exception.auth.UserInvalidException
;
import
com.github.wxiaoqi.security.common.msg.ObjectRestResponse
;
import
com.github.wxiaoqi.security.common.msg.ObjectRestResponse
;
import
com.github.wxiaoqi.security.common.util.process.ResultCode
;
import
com.github.wxiaoqi.security.common.util.process.ResultCode
;
import
io.swagger.models.auth.In
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.StringUtils
;
import
org.springframework.util.StringUtils
;
import
javax.servlet.http.HttpServletRequest
;
/**
/**
* @author keliii
* @author keliii
*/
*/
...
@@ -138,4 +141,27 @@ public class AppAuthServiceImpl implements AuthService {
...
@@ -138,4 +141,27 @@ public class AppAuthServiceImpl implements AuthService {
}
}
@Override
public
ObjectRestResponse
updUsername
(
String
username
,
String
mobilecode
,
String
token
)
{
if
(
StringUtils
.
isEmpty
(
token
)){
return
ObjectRestResponse
.
createFailedResult
(
ResultCode
.
NULL_CODE
,
"token不能为空"
);
}
try
{
IJWTInfo
ijwtInfo
=
jwtTokenUtil
.
getInfoFromToken
(
token
);
if
(
ijwtInfo
==
null
){
return
ObjectRestResponse
.
createFailedResult
(
10009
,
"token失效"
);
}
Integer
userId
=
Integer
.
parseInt
(
ijwtInfo
.
getId
());
ObjectRestResponse
objectRestResponse
=
userService
.
updUsername
(
username
,
mobilecode
,
userId
);
if
(
objectRestResponse
.
getStatus
()==
ResultCode
.
SUCCESS_CODE
){
token
=
getToken
(
username
,
userId
);
objectRestResponse
.
setData
(
token
);
}
return
objectRestResponse
;
}
catch
(
Exception
e
){
e
.
printStackTrace
();
return
ObjectRestResponse
.
createFailedResult
(
ResultCode
.
FAILED_CODE
,
"操作失败"
);
}
}
}
}
ace-auth/ace-auth-server/src/main/java/com/github/wxiaoqi/security/auth/service/impl/AuthServiceImpl.java
View file @
6f43a352
...
@@ -134,4 +134,27 @@ public class AuthServiceImpl implements AuthService {
...
@@ -134,4 +134,27 @@ public class AuthServiceImpl implements AuthService {
}
}
}
}
@Override
public
ObjectRestResponse
updUsername
(
String
username
,
String
mobilecode
,
String
token
)
{
if
(
StringUtils
.
isEmpty
(
token
)){
return
ObjectRestResponse
.
createFailedResult
(
ResultCode
.
NULL_CODE
,
"token不能为空"
);
}
try
{
IJWTInfo
ijwtInfo
=
jwtTokenUtil
.
getInfoFromToken
(
token
);
if
(
ijwtInfo
==
null
){
return
ObjectRestResponse
.
createFailedResult
(
10009
,
"token失效"
);
}
Integer
userId
=
Integer
.
parseInt
(
ijwtInfo
.
getId
());
ObjectRestResponse
objectRestResponse
=
userService
.
updUsername
(
username
,
mobilecode
,
userId
);
if
(
objectRestResponse
.
getStatus
()==
ResultCode
.
SUCCESS_CODE
){
token
=
getToken
(
username
,
userId
);
objectRestResponse
.
setData
(
token
);
}
return
objectRestResponse
;
}
catch
(
Exception
e
){
e
.
printStackTrace
();
return
ObjectRestResponse
.
createFailedResult
(
ResultCode
.
FAILED_CODE
,
"操作失败"
);
}
}
}
}
ace-modules/ace-admin/src/main/java/com/github/wxiaoqi/security/admin/rpc/AppUserRest.java
View file @
6f43a352
...
@@ -257,15 +257,25 @@ public class AppUserRest {
...
@@ -257,15 +257,25 @@ public class AppUserRest {
@ApiModelProperty
(
"检查手机号验证码"
)
@ApiModelProperty
(
"检查手机号验证码"
)
@GetMapping
(
"/unauth/checkMobilecode"
)
@GetMapping
(
"/unauth/checkMobilecode"
)
public
ObjectRestResponse
checkMobilecode
(
@RequestParam
(
value
=
"phone"
)
String
phone
,
public
ObjectRestResponse
checkMobilecode
(
@RequestParam
(
value
=
"phone"
)
String
phone
,
@RequestParam
(
value
=
"mobilecode"
)
String
mobilecode
){
@RequestParam
(
value
=
"mobilecode"
)
String
mobilecode
)
{
if
(
StringUtils
.
isBlank
(
phone
)
||
StringUtils
.
isBlank
(
mobilecode
))
{
if
(
StringUtils
.
isBlank
(
phone
)
||
StringUtils
.
isBlank
(
mobilecode
))
{
return
ObjectRestResponse
.
createFailedResult
(
ResultCode
.
NULL_CODE
,
"参数为空"
);
return
ObjectRestResponse
.
createFailedResult
(
ResultCode
.
NULL_CODE
,
"参数为空"
);
}
}
String
redisKey
=
appPermissionService
.
checkCodeByUsername
(
phone
,
mobilecode
);
String
redisKey
=
appPermissionService
.
checkCodeByUsername
(
phone
,
mobilecode
);
if
(
StringUtils
.
isBlank
(
redisKey
)){
if
(
StringUtils
.
isBlank
(
redisKey
))
{
return
ObjectRestResponse
.
createFailedResult
(
ResultCode
.
NOTEXIST_CODE
,
"验证码错误"
);
return
ObjectRestResponse
.
createFailedResult
(
ResultCode
.
NOTEXIST_CODE
,
"验证码错误"
);
}
}
return
ObjectRestResponse
.
succ
();
return
ObjectRestResponse
.
succ
();
}
@ApiModelProperty
(
"修改手机号码"
)
@GetMapping
(
"/updUsername"
)
public
ObjectRestResponse
updUsername
(
@RequestParam
(
value
=
"username"
)
String
username
,
@RequestParam
(
value
=
"mobilecode"
)
String
mobilecode
,
@RequestParam
(
value
=
"userId"
,
defaultValue
=
"0"
)
Integer
userId
){
return
appPermissionService
.
updUsername
(
userId
,
username
,
mobilecode
);
}
}
...
...
ace-modules/ace-admin/src/main/java/com/github/wxiaoqi/security/admin/rpc/service/AppPermissionService.java
View file @
6f43a352
...
@@ -1134,4 +1134,26 @@ public class AppPermissionService {
...
@@ -1134,4 +1134,26 @@ public class AppPermissionService {
public
static
final
String
CITY_NAME
=
"city"
;
public
static
final
String
CITY_NAME
=
"city"
;
}
}
//修改手机号码
public
ObjectRestResponse
updUsername
(
Integer
userId
,
String
username
,
String
mobileCode
){
if
(
StringUtils
.
isBlank
(
username
)||
StringUtils
.
isBlank
(
mobileCode
)||
userId
==
0
||
userId
==
null
){
return
ObjectRestResponse
.
createFailedResult
(
ResultCode
.
NULL_CODE
,
"参数不能为空"
);
}
if
(
StringUtils
.
isBlank
(
checkCodeByUsername
(
username
,
mobileCode
))){
return
ObjectRestResponse
.
createFailedResult
(
ResultCode
.
FAILED_CODE
,
"验证码错误"
);
}
log
.
info
(
"----updUsername----userId==="
+
userId
+
"---username==="
+
username
);
// 是否已存在
AppUserLogin
user
=
appUserLoginBiz
.
checkeUserLogin
(
username
);
if
(
null
!=
user
)
{
return
ObjectRestResponse
.
createFailedResult
(
ResultCode
.
EXIST_CODE
,
"用户已存在"
);
}
AppUserLogin
userLogin
=
new
AppUserLogin
();
userLogin
.
setId
(
userId
);
userLogin
.
setUsername
(
username
);
appUserLoginBiz
.
updateSelectiveById
(
userLogin
);
return
ObjectRestResponse
.
succ
();
}
}
}
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