Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
A
Afrishop refactored project
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Whispa
Afrishop refactored project
Commits
5e4f30b3
提交
5e4f30b3
authored
12月 04, 2020
作者:
吴德鹏
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
更新
上级
0282e820
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
21 行增加
和
19 行删除
+21
-19
AuthController.java
...a/com/example/afrishop_v3/controllers/AuthController.java
+19
-18
Controller.java
.../java/com/example/afrishop_v3/controllers/Controller.java
+2
-1
没有找到文件。
src/main/java/com/example/afrishop_v3/controllers/AuthController.java
浏览文件 @
5e4f30b3
...
...
@@ -135,18 +135,18 @@ public class AuthController extends Controller {
@GetMapping
(
"/verifyCode/{account}/{code}"
)
public
Result
<
Boolean
>
validateCode
(
@PathVariable
(
"account"
)
String
account
,
@PathVariable
(
"code"
)
String
code
){
@PathVariable
(
"code"
)
String
code
)
{
Optional
<
TbCfUserInfo
>
userInfoOptional
=
userRepository
.
findFirstByAccount
(
account
);
if
(
!
userInfoOptional
.
isPresent
()
)
return
new
Result
<>(
ResultCodeEnum
.
VALIDATE_ERROR
.
getCode
(),
"Account not found"
);
if
(!
userInfoOptional
.
isPresent
()
)
return
new
Result
<>(
ResultCodeEnum
.
VALIDATE_ERROR
.
getCode
(),
"Account not found"
);
TbCfUserInfo
userInfo
=
userInfoOptional
.
get
();
if
(
code
.
equals
(
userInfo
.
getVerificationCode
())
)
{
return
new
Result
<>(
true
,
"Verification code is right !!!"
);
if
(
code
.
equals
(
userInfo
.
getVerificationCode
()))
{
return
new
Result
<>(
true
,
"Verification code is right !!!"
);
}
return
new
Result
<>(
false
,
ResultCodeEnum
.
VALIDATE_ERROR
.
getCode
(),
"Verification code is wrong !!!"
);
return
new
Result
<>(
false
,
ResultCodeEnum
.
VALIDATE_ERROR
.
getCode
(),
"Verification code is wrong !!!"
);
}
@PostMapping
(
"/signup"
)
...
...
@@ -347,7 +347,7 @@ public class AuthController extends Controller {
if
(!
optional
.
isPresent
()
&&
user
.
getPhone
()
!=
null
&&
!
user
.
getPhone
().
isEmpty
()
&&
userRepository
.
existsByAccount
(
user
.
getPhone
().
replace
(
"+"
,
""
)))
{
optional
=
userRepository
.
findFirstByAccount
(
user
.
getPhone
().
replace
(
"+"
,
""
));
}
logger
.
info
(
"user is exist:"
+
optional
.
isPresent
());
logger
.
info
(
"user is exist:"
+
optional
.
isPresent
());
if
(!
optional
.
isPresent
())
{
...
...
@@ -416,7 +416,7 @@ public class AuthController extends Controller {
user
.
setAccount
(
user
.
getEmail
()
!=
null
?
user
.
getEmail
()
:
user
.
getPhone
());
}
if
(
user
.
getNick
()
==
null
)
{
if
(
user
.
getNick
()
==
null
)
{
user
.
setNick
(
user
.
getEmail
()
!=
null
?
user
.
getEmail
()
:
user
.
getPhone
());
}
...
...
@@ -459,7 +459,7 @@ public class AuthController extends Controller {
c
.
add
(
Calendar
.
DATE
,
7
);
Date
endDate
=
c
.
getTime
();
for
(
TbCfCoupon
tbCfCoupon
:
couponVailList
)
{
logger
.
info
(
"coupon:"
+
tbCfCoupon
.
getCouponTitle
());
logger
.
info
(
"coupon:"
+
tbCfCoupon
.
getCouponTitle
());
TbCfToicoupon
toi
=
new
TbCfToicoupon
();
//把上面获取到的值,赋值到实体类中
toi
.
setToitableId
(
IdUtil
.
createIdbyUUID
());
...
...
@@ -528,7 +528,6 @@ public class AuthController extends Controller {
private
void
fillUserNecessayInfo
(
TbCfUserInfo
tbCfUserInfoVo
)
{
if
(
tbCfUserInfoVo
.
getAvatar
()
==
null
)
tbCfUserInfoVo
.
setAvatar
(
domainProperties
.
getProperty
(
"user.avatar"
));
tbCfUserInfoVo
.
setNick
(
tbCfUserInfoVo
.
getAccount
());
tbCfUserInfoVo
.
setUserNo
(
IdUtil
.
createIdByDate
());
tbCfUserInfoVo
.
setPhoneFlag
(
StateConstant
.
INVALID
);
tbCfUserInfoVo
.
setLoginCount
(
0
);
...
...
@@ -541,9 +540,11 @@ public class AuthController extends Controller {
tbCfUserInfoVo
.
setUserType
(
UserTypeEnum
.
UN_KNOW
.
getCode
());
tbCfUserInfoVo
.
setEmailFlag
(
StateConstant
.
INVALID
);
if
(
tbCfUserInfoVo
.
getNick
()
==
null
)
{
tbCfUserInfoVo
.
setNick
(
tbCfUserInfoVo
.
getEmail
()
==
null
?
tbCfUserInfoVo
.
getEmail
()
:
tbCfUserInfoVo
.
getPhone
());
if
(
tbCfUserInfoVo
.
getNick
()
==
null
)
{
tbCfUserInfoVo
.
setNick
(
tbCfUserInfoVo
.
getEmail
()
!=
null
?
tbCfUserInfoVo
.
getEmail
()
:
tbCfUserInfoVo
.
getPhone
()
!=
null
?
tbCfUserInfoVo
.
getPhone
()
:
tbCfUserInfoVo
.
getAccount
());
}
logger
.
info
(
"user==="
+
tbCfUserInfoVo
);
}
@PostMapping
(
"/resetPassword/{account}"
)
...
...
@@ -568,8 +569,8 @@ public class AuthController extends Controller {
String
validatePassword
=
validatePassword
(
password
);
if
(
validatePassword
!=
null
)
{
return
new
Result
(
ResultCodeEnum
.
VALIDATE_ERROR
.
getCode
(),
validatePassword
);
if
(
validatePassword
!=
null
)
{
return
new
Result
(
ResultCodeEnum
.
VALIDATE_ERROR
.
getCode
(),
validatePassword
);
}
TbCfUserInfo
user
=
firstByAccount
.
get
();
...
...
@@ -578,17 +579,17 @@ public class AuthController extends Controller {
user
.
setPassword
(
encoder
.
encode
(
password
));
userRepository
.
save
(
user
);
return
new
Result
(
"Password reset successfully !"
);
}
else
{
return
new
Result
(
ResultCodeEnum
.
VALIDATE_ERROR
.
getCode
(),
"Verification code don't match !"
);
}
else
{
return
new
Result
(
ResultCodeEnum
.
VALIDATE_ERROR
.
getCode
(),
"Verification code don't match !"
);
}
}
@GetMapping
(
"/checkAccountAvailability/{account}"
)
public
Result
checkUsername
(
@PathVariable
(
"account"
)
String
account
){
public
Result
checkUsername
(
@PathVariable
(
"account"
)
String
account
)
{
boolean
exists
=
userRepository
.
existsByAccount
(
account
);
if
(
exists
)
{
if
(
exists
)
{
return
new
Result
<>(
true
,
ResultCodeEnum
.
SUCCESS
.
getCode
(),
...
...
src/main/java/com/example/afrishop_v3/controllers/Controller.java
浏览文件 @
5e4f30b3
...
...
@@ -110,6 +110,7 @@ abstract class Controller {
FirebaseApp
firebaseApp
;
try
{
firebaseApp
=
FirebaseApp
.
getInstance
(
"other"
);
System
.
out
.
println
(
"firebaseApp="
+
firebaseApp
);
}
catch
(
IllegalStateException
e
)
{
firebaseApp
=
FirebaseApp
.
initializeApp
(
options
,
"other"
);
}
...
...
@@ -128,7 +129,7 @@ abstract class Controller {
if
(
firebaseApp
==
null
)
return
false
;
FirebaseAuth
instance
=
FirebaseAuth
.
getInstance
(
firebaseApp
);
//System.out.println(firebaseApp.getName()
);
System
.
out
.
println
(
"instance="
+
instance
);
//System.out.println(token);
try
{
FirebaseToken
firebaseToken
=
instance
.
verifyIdToken
(
token
);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论