Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,5 @@ out/
### VS Code ###
.vscode/

### Project specific
application.yml
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,6 @@ Once you are fully up to speed and working on the project it is perfectly accept

Once you have your teams set up, enjoy working on the code.

We look forward to seeing what you manage to produce from it!
We look forward to seeing what you manage to produce from it!

----Test access Magnus-----
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,16 @@ public ResponseEntity<?> registerUser(@Valid @RequestBody SignupRequest signupRe
if (userRepository.existsByEmail(signupRequest.getEmail())) {
return ResponseEntity.badRequest().body(new MessageResponse("Error: Email is already in use!"));
}
String emailRegex = "^\\w+([.-]?\\w+)*@\\w+([.-]?\\w+)*(\\.\\w{2,3})+$";
String passwordRegex = "^(?=.*[A-Z])(?=.*[0-9])(?=.*[#?!@$%^&-]).{8,}$";

if(!signupRequest.getEmail().matches(emailRegex))
return ResponseEntity.badRequest().body(new MessageResponse("Email is incorrect"));

if(!signupRequest.getPassword().matches(passwordRegex))
return ResponseEntity.badRequest().body(new MessageResponse("Password is incorrect"));


// Create a new user add salt here if using one
User user = new User(signupRequest.getEmail(), encoder.encode(signupRequest.getPassword()));
if (signupRequest.getCohort() != null) {
Expand Down