Ignore:
Timestamp:
01/24/22 21:08:32 (3 years ago)
Author:
Ema <ema_spirova@…>
Branches:
master
Children:
76712b2
Parents:
bdd6491
Message:

signup/login server errors on front and remove location from planner

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trip-planner/src/main/java/finki/diplomska/tripplanner/web/rest/UserController.java

    rbdd6491 rb738035  
    1919import org.springframework.web.bind.annotation.*;
    2020import org.springframework.security.core.Authentication;
     21
    2122import javax.validation.Valid;
     23import java.util.List;
     24import java.util.Optional;
    2225
    2326@RestController
     
    5255                )
    5356        );
    54 
    5557        SecurityContextHolder.getContext().setAuthentication(authentication);
    5658        String jwt = SecurityConstants.TOKEN_PREFIX +  tokenProvider.generateToken(authentication);
    57 
    5859        return ResponseEntity.ok(new JWTLoginSucessReponse(true, jwt));
    5960    }
     
    6566        ResponseEntity<?> errorMap = mapValidationErrorService.MapValidationService(result);
    6667        if(errorMap != null)return errorMap;
     68        User newUser = userService.saveUser(user);
     69        return  new ResponseEntity<User>(newUser, HttpStatus.CREATED);
     70    }
    6771
    68         User newUser = userService.saveUser(user);
     72    @GetMapping(value = "/usernames")
     73    public List<String> getAllUsernames (){
     74        return this.userService.getAllUsernames();
     75    }
    6976
    70         return  new ResponseEntity<User>(newUser, HttpStatus.CREATED);
     77    @GetMapping(value = "/password")
     78    public Optional<String> getPassword(@RequestBody UserDto userDto){
    7179
     80        return this.userService.getPassword(userDto);
    7281    }
     82
    7383}
Note: See TracChangeset for help on using the changeset viewer.