Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
J
jh-boot
Project
Overview
Details
Activity
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
Jan Hrabal
jh-boot
Commits
db503a46
Commit
db503a46
authored
Aug 26, 2019
by
Jan Hrabal
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
signup process
parent
b872acb4
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
8 deletions
+13
-8
AuthApiController.java
...main/java/com/jh/boot/security/api/AuthApiController.java
+9
-4
Signup.java
src/main/java/com/jh/boot/security/api/Signup.java
+4
-4
No files found.
src/main/java/com/jh/boot/security/api/AuthApiController.java
View file @
db503a46
...
...
@@ -8,6 +8,7 @@ import java.util.ArrayList;
import
java.util.Base64
;
import
java.util.Collections
;
import
java.util.List
;
import
java.util.Objects
;
import
java.util.logging.ErrorManager
;
import
javax.servlet.http.HttpSession
;
...
...
@@ -119,22 +120,26 @@ public class AuthApiController {
//TODO validate email
if
(!
StringUtils
.
hasText
(
signup
.
getLogin
()))
{
errors
.
add
(
ErrorMessage
.
withFieldCode
(
"
username
"
,
"AUTH.BAD_USERNAME"
));
errors
.
add
(
ErrorMessage
.
withFieldCode
(
"
login
"
,
"AUTH.BAD_USERNAME"
));
}
if
(!
PasswordUtils
.
validatePassword
(
signup
.
getPassword
()))
{
errors
.
add
(
ErrorMessage
.
withFieldCode
(
"password"
,
"AUTH.BAD_PASSWORD"
));
}
if
(!
Boolean
.
TRUE
.
equals
(
signup
.
getTerms
()))
{
errors
.
add
(
ErrorMessage
.
withFieldCode
(
"terms"
,
"AUTH.TERMS_REQUIRED"
));
}
if
(!
Boolean
.
TRUE
.
equals
(
signup
.
getPrivacy
()))
{
errors
.
add
(
ErrorMessage
.
withFieldCode
(
"privacy"
,
"AUTH.PRIVACY_REQUIRED"
));
}
if
(!
errors
.
isEmpty
())
{
throw
new
RestApiException
(
HttpStatus
.
BAD_REQUEST
,
errors
);
// throw new BadRequestException();
}
try
{
authService
.
register
(
signup
.
getLogin
(),
signup
.
getPassword
());
// Authentication auth = authService.authenticate(signup.getLogin(), signup.getPassword());
// SecurityContextHolder.getContext().setAuthentication(auth);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
...
...
src/main/java/com/jh/boot/security/api/Signup.java
View file @
db503a46
...
...
@@ -36,19 +36,19 @@ public class Signup {
this
.
password
=
password
;
}
public
boolean
is
Terms
()
{
public
Boolean
get
Terms
()
{
return
terms
;
}
public
void
setTerms
(
b
oolean
terms
)
{
public
void
setTerms
(
B
oolean
terms
)
{
this
.
terms
=
terms
;
}
public
boolean
is
Privacy
()
{
public
Boolean
get
Privacy
()
{
return
privacy
;
}
public
void
setPrivacy
(
b
oolean
privacy
)
{
public
void
setPrivacy
(
B
oolean
privacy
)
{
this
.
privacy
=
privacy
;
}
...
...
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