Ignore:
Timestamp:
05/05/24 01:27:16 (7 months ago)
Author:
ppaunovski <paunovskipavel@…>
Branches:
master
Children:
baf4cc4
Parents:
4d026a5
Message:

Added roles to Users and some minor changes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/main/java/mk/ukim/finki/busngo/web/RegisterController.java

    r4d026a5 r8b875e6  
    22
    33import mk.ukim.finki.busngo.model.entities.Korisnik;
     4import mk.ukim.finki.busngo.model.enums.Role;
    45import mk.ukim.finki.busngo.model.enums.VrabotenType;
    56import mk.ukim.finki.busngo.model.exceptions.InvalidCredentialsException;
     
    3536        }
    3637
    37         model.addAttribute("types", VrabotenType.values());
     38        model.addAttribute("roles", Role.values());
    3839
    3940        model.addAttribute("bodyContent", "register");
     
    4849                           @RequestParam String address,
    4950                           @RequestParam String phone,
    50                            @RequestParam(required = false)VrabotenType vrabotenType,
     51                           @RequestParam Role role,
    5152                           @RequestParam(required = false) Double salary
    5253                           ) {
    5354        try{
    54             Korisnik korisnik;
    55             if(vrabotenType != null){
    56                  korisnik = this.authService.registerVraboten(name, email, password, confirmPassword, address, phone, vrabotenType, salary);
     55            Korisnik korisnik = authService.register(name, email, password, confirmPassword, address, phone, role, salary);
    5756
    58             }
    59             else
    60                 korisnik = this.authService.registerPatnik(name, email, password, confirmPassword, address, phone);
    6157            return "redirect:/login";
    6258        } catch (InvalidCredentialsException | UserAlreadyExistsException exception) {
Note: See TracChangeset for help on using the changeset viewer.