Changeset 6032d44 for src/main/java/com/example/moviezone/service
- Timestamp:
- 02/04/23 19:01:47 (23 months ago)
- Branches:
- master
- Children:
- e097c1c
- Parents:
- 27adfc8
- Location:
- src/main/java/com/example/moviezone/service
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/main/java/com/example/moviezone/service/Impl/UserServiceImpl.java
r27adfc8 r6032d44 38 38 } 39 39 40 // @Override 41 // public User register(String first_name, String last_name, String username, String email, String number, String password, String role) { 42 // if(role.equals("worker")) 43 // { 44 // return userRepository.save(new Worker(passwordEncoder.encode(password),first_name,last_name,username,email,number)); 45 // } 46 // else if (role.equals("user")) 47 // return userRepository.save(new Customer(passwordEncoder.encode(password),first_name,last_name,username,email,number)); 48 // } 40 @Override 41 public User register(String first_name, String last_name, String username, String email, String number, String password, String role) { 42 if(role.equals("worker")) 43 { 44 return userRepository.save(new Worker(passwordEncoder.encode(password),first_name,last_name,username,email,number)); 45 } 46 else 47 return userRepository.save(new Customer(passwordEncoder.encode(password),first_name,last_name,username,email,number)); 48 } 49 50 @Override 51 public User login(String username, String password) { 52 return userRepository.findAllByUsernameAndPassword(username,password).stream().findFirst().orElseThrow(UserNotFoundException::new); 53 } 49 54 50 55 -
src/main/java/com/example/moviezone/service/UserService.java
r27adfc8 r6032d44 10 10 User findByUsername(String username); 11 11 12 //User register(String first_name, String last_name,String username, String email, String number, String password, String role);13 12 User register(String first_name, String last_name,String username, String email, String number, String password, String role); 13 User login(String username,String password); 14 14 }
Note:
See TracChangeset
for help on using the changeset viewer.