Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
X
xyqb-user2
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
head_group
xyqb-user2
Commits
735b38d8
Commit
735b38d8
authored
Dec 01, 2017
by
Java—KA—李 青
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
删除/register/fast接口
parent
d450557c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
48 deletions
+8
-48
UserController.java
...ntgroup/xyqb/controller/internal/user/UserController.java
+1
-45
PasswordUtil.java
src/main/java/cn/quantgroup/xyqb/util/PasswordUtil.java
+7
-3
No files found.
src/main/java/cn/quantgroup/xyqb/controller/internal/user/UserController.java
View file @
735b38d8
...
...
@@ -245,7 +245,7 @@ public class UserController implements IBaseController {
}
private
User
registerFastWhenLogin
(
String
phoneNo
,
Long
channelId
,
Long
registerFrom
,
String
appChannel
,
Long
btRegisterChannelId
,
String
dimension
)
{
String
password
=
PasswordUtil
.
generateRandomPwd
();
String
password
=
PasswordUtil
.
generateRandomPwd
(
15
);
LOGGER
.
info
(
"用户快速注册, phoneNo:{}, channelId:{}, registerFrom:{},appChannel:{},btRegisterChannelId"
,
phoneNo
,
channelId
,
registerFrom
,
appChannel
,
btRegisterChannelId
);
if
(!
ValidationUtil
.
validatePhoneNo
(
phoneNo
))
{
LOGGER
.
info
(
"用户快速注册失败,手机号错误, registerFrom:{}, phoneNo:{}"
,
registerFrom
,
phoneNo
);
...
...
@@ -300,50 +300,6 @@ public class UserController implements IBaseController {
return
result
;
}
/**
* 用户快速注册
*
* @param phoneNo
* @param verificationCode
* @param channelId
* @return
*/
@LogHttpCaller
@RequestMapping
(
"/register/fast"
)
public
JsonResult
registerFast
(
@RequestParam
String
phoneNo
,
@RequestParam
String
verificationCode
,
@RequestParam
(
required
=
false
)
Long
channelId
,
@RequestParam
(
required
=
false
)
Long
registerFrom
,
@RequestParam
(
required
=
false
,
defaultValue
=
""
)
String
appChannel
,
@RequestParam
(
required
=
false
)
Long
btRegisterChannelId
,
@RequestParam
(
required
=
false
)
String
dimension
)
{
String
password
=
PasswordUtil
.
generateRandomPwd
();
LOGGER
.
info
(
"用户快速注册, phoneNo:{}, verificationCode:{}, channelId:{}, registerFrom:{},appChannel:{},btRegisterChannelId:{},dimension:{}"
,
phoneNo
,
verificationCode
,
channelId
,
registerFrom
,
appChannel
,
btRegisterChannelId
,
dimension
);
if
(!
ValidationUtil
.
validatePhoneNo
(
phoneNo
))
{
LOGGER
.
info
(
"用户快速注册失败,手机号错误, registerFrom:{}, phoneNo:{}"
,
registerFrom
,
phoneNo
);
return
JsonResult
.
buildErrorStateResult
(
"手机号错误"
,
null
);
}
if
(
StringUtils
.
isEmpty
(
password
))
{
LOGGER
.
info
(
"用户快速注册失败,密码不能为空, registerFrom:{}, phoneNo:{}, password:{}"
,
registerFrom
,
phoneNo
,
password
);
return
JsonResult
.
buildErrorStateResult
(
"密码不能为空"
,
null
);
}
if
(
password
.
length
()
<
6
||
password
.
length
()
>
12
)
{
LOGGER
.
info
(
"用户快速注册失败,密码长度须在6位至12位之间, registerFrom:{}, phoneNo:{}, password:{}"
,
registerFrom
,
phoneNo
,
password
);
return
JsonResult
.
buildErrorStateResult
(
"密码应为6-12位"
,
null
);
}
if
(
null
==
registerFrom
)
{
registerFrom
=
1L
;
}
smsValidForFastLogin
(
phoneNo
,
verificationCode
);
if
(
userService
.
exist
(
phoneNo
))
{
LOGGER
.
info
(
"用户快速注册失败,该手机号已经被注册, registerFrom:{}, phoneNo:{}"
,
registerFrom
,
phoneNo
);
return
JsonResult
.
buildErrorStateResult
(
"该手机号已经被注册"
,
null
);
}
if
(!
userService
.
register
(
phoneNo
,
password
,
registerFrom
,
getIp
(),
channelId
,
btRegisterChannelId
,
dimension
))
{
LOGGER
.
info
(
"用户快速注册失败,请稍后重试, registerFrom:{}, phoneNo:{}"
,
registerFrom
,
phoneNo
);
return
JsonResult
.
buildErrorStateResult
(
"注册失败,请稍后重试"
,
null
);
}
LOGGER
.
info
(
"用户快速注册成功, registerFrom:{}, phoneNo:{}"
,
registerFrom
,
phoneNo
);
return
JsonResult
.
buildSuccessResult
(
null
,
null
);
}
/**
* 用户注册
*
...
...
src/main/java/cn/quantgroup/xyqb/util/PasswordUtil.java
View file @
735b38d8
package
cn
.
quantgroup
.
xyqb
.
util
;
import
com.google.common.base.Preconditions
;
import
java.security.MessageDigest
;
import
java.util.concurrent.ThreadLocalRandom
;
...
...
@@ -40,15 +42,17 @@ public class PasswordUtil {
/**
* 生成随机密码
* @param pwdLen 密码长度,必须大于0
* @return
*/
public
static
String
generateRandomPwd
()
{
public
static
String
generateRandomPwd
(
int
pwdLen
)
{
Preconditions
.
checkArgument
(
pwdLen
>
0
);
int
pwdMax
=
PWD_BASE
.
length
;
int
i
;
// 生成的随机数
int
count
=
0
;
// 生成的密码的长度
StringBuffer
pwd
=
new
StringBuffer
();
while
(
count
<
15
)
{
i
=
Math
.
abs
(
ThreadLocalRandom
.
current
().
nextInt
(
pwdMax
)
);
// 生成的数最大为36-1
while
(
count
<
pwdLen
)
{
i
=
ThreadLocalRandom
.
current
().
nextInt
(
pwdMax
);
// 生成的数最大为36-1
if
(
i
>=
0
&&
i
<
PWD_BASE
.
length
)
{
pwd
.
append
(
PWD_BASE
[
i
]);
count
++;
...
...
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