Changeset 6032d44 for src/main/java/com/example/moviezone/service/Impl
- Timestamp:
- 02/04/23 19:01:47 (22 months ago)
- Branches:
- master
- Children:
- e097c1c
- Parents:
- 27adfc8
- File:
-
- 1 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
Note:
See TracChangeset
for help on using the changeset viewer.