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
078a0e7a
Commit
078a0e7a
authored
Mar 12, 2018
by
技术部-任文超
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加测试开关
parent
e0365af5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
5 deletions
+24
-5
UserController.java
...ntgroup/xyqb/controller/internal/user/UserController.java
+5
-0
TestStringCode.java
src/test/java/login/TestStringCode.java
+19
-5
No files found.
src/main/java/cn/quantgroup/xyqb/controller/internal/user/UserController.java
View file @
078a0e7a
package
cn
.
quantgroup
.
xyqb
.
controller
.
internal
.
user
;
import
cn.quantgroup.tech.util.TechEnvironment
;
import
cn.quantgroup.xyqb.Constants
;
import
cn.quantgroup.xyqb.aspect.captcha.CaptchaFiniteValidator
;
import
cn.quantgroup.xyqb.aspect.lock.PasswordErrorFiniteValidator
;
...
...
@@ -503,6 +504,10 @@ public class UserController implements IBaseController {
* @param verificationCode
*/
private
void
verifyPhoneAndCode
(
String
phoneNo
,
String
verificationCode
)
{
// 非生产环境直接跳过验证码检验
if
(!
TechEnvironment
.
isPro
()){
return
;
}
if
(!
smsService
.
verifyPhoneAndCode
(
phoneNo
,
verificationCode
))
{
smsReSendOrNot
(
phoneNo
);
LOGGER
.
info
(
"验证码校验失败,phoneNo:{} , verificationCode:{}"
,
phoneNo
,
verificationCode
);
...
...
src/test/java/login/TestStringCode.java
View file @
078a0e7a
...
...
@@ -6,12 +6,13 @@ import java.util.Base64;
public
class
TestStringCode
{
public
static
void
main
(
String
[]
args
)
{
System
.
out
.
println
(
base64
(
"13511112222"
,
"000000"
));
System
.
out
.
println
(
base64
(
"18022223333"
,
"00
0000"
));
System
.
out
.
println
(
ap_
base64
(
"13511112222"
,
"000000"
));
System
.
out
.
println
(
pc_base64
(
"18022223333"
,
"
0000"
));
}
final
static
String
AUTHORIZATION
=
"authorization"
;
final
static
String
PREFIX
=
"Basic "
;
final
static
String
PREFIX_AP
=
"Basic "
;
final
static
String
PREFIX_PC
=
"Verification "
;
/*
* 4.153
* 13576450525 123456 318e235d3e52648b236faa3f748000d5
...
...
@@ -21,8 +22,21 @@ public class TestStringCode {
* 13511112222 000000 c8937b92506c0e2918de053dea69edd3
* 18022223333 000000 c8937b92506c0e2918de053dea69edd3
*/
final
static
String
base64
(
String
account
,
String
password
)
{
String
authorization
=
PREFIX
+
new
String
(
Base64
.
getEncoder
().
encodeToString
((
account
+
":"
+
password
).
getBytes
(
Charset
.
forName
(
"UTF-8"
))));
final
static
String
ap_base64
(
String
account
,
String
password
)
{
String
authorization
=
PREFIX_AP
+
new
String
(
Base64
.
getEncoder
().
encodeToString
((
account
+
":"
+
password
).
getBytes
(
Charset
.
forName
(
"UTF-8"
))));
return
authorization
;
}
/*
* 4.153
* 13576450525 123456 318e235d3e52648b236faa3f748000d5
* 13724823305 123456 318e235d3e52648b236faa3f748000d5
*
* 4.155
* 13511112222 000000 c8937b92506c0e2918de053dea69edd3
* 18022223333 000000 c8937b92506c0e2918de053dea69edd3
*/
final
static
String
pc_base64
(
String
phone
,
String
code
)
{
String
authorization
=
PREFIX_PC
+
new
String
(
Base64
.
getEncoder
().
encodeToString
((
phone
+
":"
+
code
).
getBytes
(
Charset
.
forName
(
"UTF-8"
))));
return
authorization
;
}
...
...
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