- Timestamp:
- 02/07/23 13:48:25 (22 months ago)
- Branches:
- master
- Children:
- fc448f5
- Parents:
- f7b0906
- File:
-
- 1 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 }
Note:
See TracChangeset
for help on using the changeset viewer.