/** * Signs up a user, and * returns current-user data and an Authorization token as a response header. */ @PostMapping("/users") @ResponseStatus(HttpStatus.CREATED) protected Mono<UserDto> signup(Mono<U> user, ServerHttpResponse response) { log.debug("Signing up: " + user); return userWithToken(lemonReactiveService.signup(user), response); }
/** * Resets password after it's forgotten */ @PostMapping("/reset-password") public Mono<UserDto> resetPassword( @RequestBody @Valid Mono<ResetPasswordForm> form, ServerHttpResponse response) { log.debug("Resetting password ... "); return userWithToken(lemonReactiveService.resetPassword(form), response); }
/** * Changes password */ @PostMapping("/users/{id}/password") @ResponseStatus(HttpStatus.NO_CONTENT) public Mono<Void> changePassword(@PathVariable ID id, @RequestBody @Valid Mono<ChangePasswordForm> changePasswordForm, ServerHttpResponse response) { log.debug("Changing password ... "); return userWithToken(lemonReactiveService.changePassword(id, changePasswordForm), response).then(); }
/** * Verifies current-user */ @PostMapping("/users/{id}/verification") public Mono<UserDto> verifyUser( @PathVariable ID id, ServerWebExchange exchange) { log.debug("Verifying user ..."); return userWithToken(lemonReactiveService.verifyUser(id, exchange.getFormData()), exchange.getResponse()); }
/** * Updates a user */ @PatchMapping(value = "/users/{id}") public Mono<UserDto> updateUser( @PathVariable ID id, @RequestBody @NotBlank Mono<String> patch, ServerHttpResponse response) { log.debug("Updating user ... "); return userWithToken(lemonReactiveService.updateUser(id, patch), response); }
/** * Changes the email */ @PostMapping("/users/{userId}/email") public Mono<UserDto> changeEmail( @PathVariable ID userId, ServerWebExchange exchange) { log.debug("Changing email of user ..."); return userWithToken(lemonReactiveService.changeEmail( userId, exchange.getFormData()), exchange.getResponse()); }