mirror of
https://github.com/Athou/commafeed.git
synced 2026-03-21 21:37:29 +00:00
admin user can be disabled now (fix #605)
This commit is contained in:
@@ -78,10 +78,11 @@ public class AdminREST {
|
|||||||
return Response.status(Status.CONFLICT).entity(e.getMessage()).build();
|
return Response.status(Status.CONFLICT).entity(e.getMessage()).build();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
User u = userDAO.findById(id);
|
if (userModel.getId().equals(user.getId()) && !userModel.isEnabled()) {
|
||||||
if (CommaFeedApplication.USERNAME_ADMIN.equals(u.getName()) && !userModel.isEnabled()) {
|
return Response.status(Status.FORBIDDEN).entity("You cannot disable your own account.").build();
|
||||||
return Response.status(Status.FORBIDDEN).entity("You cannot disable the admin user.").build();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
User u = userDAO.findById(id);
|
||||||
u.setName(userModel.getName());
|
u.setName(userModel.getName());
|
||||||
if (StringUtils.isNotBlank(userModel.getPassword())) {
|
if (StringUtils.isNotBlank(userModel.getPassword())) {
|
||||||
u.setPassword(encryptionService.getEncryptedPassword(userModel.getPassword(), u.getSalt()));
|
u.setPassword(encryptionService.getEncryptedPassword(userModel.getPassword(), u.getSalt()));
|
||||||
|
|||||||
Reference in New Issue
Block a user