Changeset d7f5da9 for src/main/java/com/example/moviezone/service
- Timestamp:
- 02/07/23 13:48:25 (23 months ago)
- Branches:
- master
- Children:
- fc448f5
- Parents:
- f7b0906
- 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
rf7b0906 rd7f5da9 48 48 49 49 @Override 50 public User register(String first_name, String last_name, String username, String email, String number, String password,String repeatedPassword, Role role) {51 if(!password.equals(repeatedPassword))52 throw new PasswordsDoNotMatchException();53 if (username==null || username.isEmpty() || password==null || password.isEmpty())54 throw new InvalidUsernameOrPasswordException();50 public void register(String first_name, String last_name, String username, String email, String number, String password, Role role) { 51 // if(!password.equals(repeatedPassword)) 52 // throw new PasswordsDoNotMatchException(); 53 // if (username==null || username.isEmpty() || password==null || password.isEmpty()) 54 // throw new InvalidUsernameOrPasswordException(); 55 55 56 56 if(role.equals(Role.ROLE_ADMIN)) 57 57 { 58 User user= new User(passwordEncoder.encode(password),first_name,last_name,username,email,number);59 workerRepository.save((Worker) user);60 return userRepository.save(user);58 // User user= new User(passwordEncoder.encode(password),first_name,last_name,username,email,number); 59 // workerRepository.save((Worker) user); 60 userRepository.save(new Worker(password,first_name,last_name,email,number,username)); 61 61 } 62 62 else 63 63 { 64 Customer customer=new Customer(passwordEncoder.encode(password),first_name,last_name,username,email,number);65 customerRepository.save(customer);66 return userRepository.save(customer);64 // Customer customer=new Customer(passwordEncoder.encode(password),first_name,last_name,username,email,number); 65 // customerRepository.save(customer); 66 userRepository.save(new Customer(password,first_name,last_name,email,number,username)); 67 67 68 68 } -
src/main/java/com/example/moviezone/service/UserService.java
rf7b0906 rd7f5da9 11 11 User findByUsername(String username); 12 12 13 User register(String first_name, String last_name,String username, String email, String number, String password,String repeatedPassword, Role role);13 void register(String first_name, String last_name,String username, String email, String number, String password, Role role); 14 14 User login(String username,String password); 15 15 }
Note:
See TracChangeset
for help on using the changeset viewer.