Ignore:
Timestamp:
02/07/23 13:48:25 (22 months ago)
Author:
milamihajlovska <mila.mihajlovska01@…>
Branches:
master
Children:
fc448f5
Parents:
f7b0906
Message:

changes for login (not working)

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  
    4848
    4949    @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();
    5555
    5656       if(role.equals(Role.ROLE_ADMIN))
    5757        {
    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));
    6161        }
    6262        else
    6363       {
    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));
    6767
    6868       }
  • src/main/java/com/example/moviezone/service/UserService.java

    rf7b0906 rd7f5da9  
    1111    User findByUsername(String username);
    1212
    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);
    1414    User login(String username,String password);
    1515}
Note: See TracChangeset for help on using the changeset viewer.