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
f8f292f0
Commit
f8f292f0
authored
Dec 21, 2019
by
jiaorz
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master-captcha-branch' into dev
parents
c1889f48
597862ec
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
11 additions
and
29 deletions
+11
-29
CaptchaBaseVO.java
...in/java/com/xxfc/platform/universal/vo/CaptchaBaseVO.java
+0
-3
ClickWordCaptchaVO.java
...va/com/xxfc/platform/universal/vo/ClickWordCaptchaVO.java
+6
-19
CaptchaController.java
...xxfc/platform/universal/controller/CaptchaController.java
+2
-0
AbstractCaptcha.java
.../com/xxfc/platform/universal/service/AbstractCaptcha.java
+1
-3
ClickWordCaptcha.java
...com/xxfc/platform/universal/service/ClickWordCaptcha.java
+2
-4
No files found.
xx-universal/xx-universal-api/src/main/java/com/xxfc/platform/universal/vo/CaptchaBaseVO.java
View file @
f8f292f0
...
@@ -4,9 +4,6 @@ import java.io.Serializable;
...
@@ -4,9 +4,6 @@ import java.io.Serializable;
/**
/**
* 验证码返回基础对象
* 验证码返回基础对象
* @author stx
* @date 2018/11/5 11:14
* @desc
*/
*/
public
class
CaptchaBaseVO
implements
Serializable
{
public
class
CaptchaBaseVO
implements
Serializable
{
...
...
xx-universal/xx-universal-api/src/main/java/com/xxfc/platform/universal/vo/ClickWordCaptchaVO.java
View file @
f8f292f0
package
com
.
xxfc
.
platform
.
universal
.
vo
;
package
com
.
xxfc
.
platform
.
universal
.
vo
;
import
lombok.Data
;
import
java.awt.*
;
import
java.awt.*
;
import
java.util.List
;
import
java.util.List
;
/**
* @author stx
@Data
* @date 2018/11/5 16:27
* @desc
*/
public
class
ClickWordCaptchaVO
extends
CaptchaBaseVO
{
public
class
ClickWordCaptchaVO
extends
CaptchaBaseVO
{
/** 点选文字 */
/** 点选文字 */
...
@@ -16,19 +15,7 @@ public class ClickWordCaptchaVO extends CaptchaBaseVO {
...
@@ -16,19 +15,7 @@ public class ClickWordCaptchaVO extends CaptchaBaseVO {
/** 点选坐标 */
/** 点选坐标 */
private
List
<
Point
>
pointList
;
private
List
<
Point
>
pointList
;
public
List
<
String
>
getWordList
()
{
private
Integer
width
;
return
wordList
;
private
Integer
height
;
}
public
void
setWordList
(
List
<
String
>
wordList
)
{
this
.
wordList
=
wordList
;
}
public
List
<
Point
>
getPointList
()
{
return
pointList
;
}
public
void
setPointList
(
List
<
Point
>
pointList
)
{
this
.
pointList
=
pointList
;
}
}
}
xx-universal/xx-universal-server/src/main/java/com/xxfc/platform/universal/controller/CaptchaController.java
View file @
f8f292f0
...
@@ -63,6 +63,7 @@ public class CaptchaController {
...
@@ -63,6 +63,7 @@ public class CaptchaController {
Boolean
suc
=
redisTemplate
.
opsForValue
().
setIfAbsent
(
redisLockKey
,
JSONArray
.
toJSONString
(
dataVO
.
getPointList
()));
Boolean
suc
=
redisTemplate
.
opsForValue
().
setIfAbsent
(
redisLockKey
,
JSONArray
.
toJSONString
(
dataVO
.
getPointList
()));
if
(
suc
)
{
if
(
suc
)
{
redisTemplate
.
expire
(
redisLockKey
,
5
,
TimeUnit
.
MINUTES
);
//5分钟内过期
redisTemplate
.
expire
(
redisLockKey
,
5
,
TimeUnit
.
MINUTES
);
//5分钟内过期
dataVO
.
setPointList
(
null
);
}
}
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
error
(
e
.
getMessage
(),
e
);
log
.
error
(
e
.
getMessage
(),
e
);
...
@@ -82,6 +83,7 @@ public class CaptchaController {
...
@@ -82,6 +83,7 @@ public class CaptchaController {
String
redisLockKey
=
RedisKey
.
CAPTCHA_PHONE_PREFIX
+
phone
;
String
redisLockKey
=
RedisKey
.
CAPTCHA_PHONE_PREFIX
+
phone
;
String
captchaCode
=
redisTemplate
.
opsForValue
().
get
(
redisLockKey
)
==
null
?
""
:
redisTemplate
.
opsForValue
().
get
(
redisLockKey
).
toString
();
String
captchaCode
=
redisTemplate
.
opsForValue
().
get
(
redisLockKey
)
==
null
?
""
:
redisTemplate
.
opsForValue
().
get
(
redisLockKey
).
toString
();
log
.
info
(
"【注册验证码坐标】:》》》》》 {}"
,
captchaCode
);
log
.
info
(
"【注册验证码坐标】:》》》》》 {}"
,
captchaCode
);
log
.
info
(
"【注册验证码用户点选坐标】:》》》》》 {}"
,
pointList
);
if
(
StringUtils
.
isBlank
(
captchaCode
))
{
if
(
StringUtils
.
isBlank
(
captchaCode
))
{
log
.
error
(
"【注册验证码坐标为空,请重新验证】"
);
log
.
error
(
"【注册验证码坐标为空,请重新验证】"
);
return
ObjectRestResponse
.
succ
(
false
);
return
ObjectRestResponse
.
succ
(
false
);
...
...
xx-universal/xx-universal-server/src/main/java/com/xxfc/platform/universal/service/AbstractCaptcha.java
View file @
f8f292f0
...
@@ -17,9 +17,7 @@ import java.util.List;
...
@@ -17,9 +17,7 @@ import java.util.List;
/**
/**
* 图行验证码抽象方法
* 图行验证码抽象方法
* @author stx
* @date 2018/10/26 22:19
* @desc
*/
*/
public
abstract
class
AbstractCaptcha
{
public
abstract
class
AbstractCaptcha
{
protected
static
final
String
URL_PREFIX_HTTP
=
"http://"
;
protected
static
final
String
URL_PREFIX_HTTP
=
"http://"
;
...
...
xx-universal/xx-universal-server/src/main/java/com/xxfc/platform/universal/service/ClickWordCaptcha.java
View file @
f8f292f0
...
@@ -18,9 +18,6 @@ import java.util.Set;
...
@@ -18,9 +18,6 @@ import java.util.Set;
/**
/**
* 点选文字验证码
* 点选文字验证码
* @author stx
* @date 2018/11/5 11:13
* @desc
*/
*/
public
class
ClickWordCaptcha
extends
AbstractCaptcha
{
public
class
ClickWordCaptcha
extends
AbstractCaptcha
{
...
@@ -76,7 +73,8 @@ public class ClickWordCaptcha extends AbstractCaptcha {
...
@@ -76,7 +73,8 @@ public class ClickWordCaptcha extends AbstractCaptcha {
Graphics
backgroundGraphics
=
backgroundImage
.
getGraphics
();
Graphics
backgroundGraphics
=
backgroundImage
.
getGraphics
();
int
width
=
backgroundImage
.
getWidth
();
int
width
=
backgroundImage
.
getWidth
();
int
height
=
backgroundImage
.
getHeight
();
int
height
=
backgroundImage
.
getHeight
();
dataVO
.
setWidth
(
width
);
dataVO
.
setHeight
(
height
);
Font
font
=
new
Font
(
HAN_ZI_FONT
,
Font
.
BOLD
,
HAN_ZI_SIZE
);
Font
font
=
new
Font
(
HAN_ZI_FONT
,
Font
.
BOLD
,
HAN_ZI_SIZE
);
int
wordCount
=
getWordTotalCount
();
int
wordCount
=
getWordTotalCount
();
//定义随机1到arr.length某一个字不参与校验
//定义随机1到arr.length某一个字不参与校验
...
...
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