@RestController
@RequestMapping(value="/api")
public class AccountResource
extends java.lang.Object
Constructor and Description |
---|
AccountResource(UserRepository userRepository,
UserService userService,
MailService mailService) |
Modifier and Type | Method and Description |
---|---|
void |
activateAccount(java.lang.String key)
GET /activate : activate the registered user.
|
void |
changePassword(java.lang.String password)
POST /account/change-password : changes the current user's password
|
void |
finishPasswordReset(KeyAndPasswordVM keyAndPassword)
POST /account/reset-password/finish : Finish to reset the password of the user
|
UserDTO |
getAccount()
GET /account : get the current user.
|
java.lang.String |
isAuthenticated(javax.servlet.http.HttpServletRequest request)
GET /authenticate : check if the user is authenticated, and return its login.
|
void |
registerAccount(ManagedUserVM managedUserVM)
POST /register : register the user.
|
void |
requestPasswordReset(java.lang.String mail)
POST /account/reset-password/init : Send an email to reset the password of the user
|
void |
saveAccount(UserDTO userDTO)
POST /account : update the current user information.
|
public AccountResource(UserRepository userRepository, UserService userService, MailService mailService)
@PostMapping(value="/register") @Timed @ResponseStatus(value=CREATED) public void registerAccount(@RequestBody ManagedUserVM managedUserVM)
managedUserVM
- the managed user View ModelInvalidPasswordException
- 400 (Bad Request) if the password is incorrectEmailAlreadyUsedException
- 400 (Bad Request) if the email is already usedLoginAlreadyUsedException
- 400 (Bad Request) if the login is already used@GetMapping(value="/activate") @Timed public void activateAccount(@RequestParam(value="key") java.lang.String key)
key
- the activation keyjava.lang.RuntimeException
- 500 (Internal Server Error) if the user couldn't be activated@GetMapping(value="/authenticate") @Timed public java.lang.String isAuthenticated(javax.servlet.http.HttpServletRequest request)
request
- the HTTP request@GetMapping(value="/account") @Timed public UserDTO getAccount()
java.lang.RuntimeException
- 500 (Internal Server Error) if the user couldn't be returned@PostMapping(value="/account") @Timed public void saveAccount(@RequestBody UserDTO userDTO)
userDTO
- the current user informationEmailAlreadyUsedException
- 400 (Bad Request) if the email is already usedjava.lang.RuntimeException
- 500 (Internal Server Error) if the user login wasn't found@PostMapping(path="/account/change-password") @Timed public void changePassword(@RequestBody java.lang.String password)
password
- the new passwordInvalidPasswordException
- 400 (Bad Request) if the new password is incorrect@PostMapping(path="/account/reset-password/init") @Timed public void requestPasswordReset(@RequestBody java.lang.String mail)
mail
- the mail of the userEmailNotFoundException
- 400 (Bad Request) if the email address is not registered@PostMapping(path="/account/reset-password/finish") @Timed public void finishPasswordReset(@RequestBody KeyAndPasswordVM keyAndPassword)
keyAndPassword
- the generated key and the new passwordInvalidPasswordException
- 400 (Bad Request) if the password is incorrectjava.lang.RuntimeException
- 500 (Internal Server Error) if the password could not be resetCopyright © 2017 Osgiliath. All rights reserved.