- Timestamp:
- 01/09/24 01:26:08 (10 months ago)
- Branches:
- master
- Children:
- e272096
- Parents:
- b101b69
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/main/java/mk/ukim/finki/busngo/service/impl/AuthServiceImpl.java
rb101b69 rbde8b13 2 2 3 3 import mk.ukim.finki.busngo.model.entities.Korisnik; 4 import mk.ukim.finki.busngo.model.entities.Patnik; 4 5 import mk.ukim.finki.busngo.model.exceptions.InvalidCredentialsException; 5 6 import mk.ukim.finki.busngo.model.exceptions.UserAlreadyExistsException; 6 7 import mk.ukim.finki.busngo.repository.KorisnikRepository; 8 import mk.ukim.finki.busngo.repository.PatnikRepository; 7 9 import mk.ukim.finki.busngo.service.AuthService; 8 10 import org.springframework.security.crypto.password.PasswordEncoder; 9 11 import org.springframework.stereotype.Service; 10 12 11 import java.util.List;12 13 13 @Service 14 14 public class AuthServiceImpl implements AuthService { 15 15 private final KorisnikRepository korisnikRepository; 16 private final PatnikRepository patnikRepository; 16 17 private final PasswordEncoder passwordEncoder; 17 18 18 public AuthServiceImpl(KorisnikRepository korisnikRepository, Pa sswordEncoder passwordEncoder) {19 public AuthServiceImpl(KorisnikRepository korisnikRepository, PatnikRepository patnikRepository, PasswordEncoder passwordEncoder) { 19 20 this.korisnikRepository = korisnikRepository; 21 this.patnikRepository = patnikRepository; 20 22 this.passwordEncoder = passwordEncoder; 21 23 } … … 29 31 30 32 @Override 31 public Korisnik register (String ime, String email, String password, String confirmPassword, String address, String telefon) {33 public Korisnik registerPatnik(String ime, String email, String password, String confirmPassword, String address, String telefon) { 32 34 if (email == null || password == null || email.isEmpty() || password.isEmpty()) { 33 35 throw new InvalidCredentialsException(); … … 42 44 } 43 45 44 Korisnik korisnik = new Korisnik();46 Patnik korisnik = new Patnik(); 45 47 korisnik.setKIme(ime); 46 48 korisnik.setKAdresa(address); … … 50 52 korisnik.setKIsAdmin(false); 51 53 52 return korisnikRepository.save(korisnik); 54 55 return patnikRepository.save(korisnik); 53 56 } 54 57
Note:
See TracChangeset
for help on using the changeset viewer.