mirror of
https://github.com/ArenMg/aren.git
synced 2024-11-14 12:40:50 +00:00
Merge pull request #3 from Arimihanta/main
Regler activation nouveau compte
This commit is contained in:
commit
53e92e0700
2 changed files with 7 additions and 6 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -13,6 +13,7 @@ buildNumber.properties
|
||||||
.vscode/
|
.vscode/
|
||||||
.idea/
|
.idea/
|
||||||
.setting/
|
.setting/
|
||||||
|
aren.iml
|
||||||
|
|
||||||
# Configuration files
|
# Configuration files
|
||||||
src/main/resources/application.properties
|
src/main/resources/application.properties
|
||||||
|
|
|
@ -199,6 +199,7 @@ public class UserRESTFacade extends AbstractRESTFacade<User> {
|
||||||
if (user.getInstitution() == null || !getUser().is(User.Authority.SUPERADMIN)) {
|
if (user.getInstitution() == null || !getUser().is(User.Authority.SUPERADMIN)) {
|
||||||
user.setInstitution(institutionService.getReference(0L));
|
user.setInstitution(institutionService.getReference(0L));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getUser().getAuthority() == User.Authority.GUEST) {
|
if (getUser().getAuthority() == User.Authority.GUEST) {
|
||||||
user.setActive(false);
|
user.setActive(false);
|
||||||
super.create(user);
|
super.create(user);
|
||||||
|
@ -226,6 +227,8 @@ public class UserRESTFacade extends AbstractRESTFacade<User> {
|
||||||
private void sendLink(User user, String subject, String body) throws MessagingException {
|
private void sendLink(User user, String subject, String body) throws MessagingException {
|
||||||
Locale currentLocale = request.getLocale();
|
Locale currentLocale = request.getLocale();
|
||||||
ResourceBundle messages = ResourceBundle.getBundle("messages", currentLocale);
|
ResourceBundle messages = ResourceBundle.getBundle("messages", currentLocale);
|
||||||
|
ResourceBundle application_config = ResourceBundle.getBundle("application", currentLocale);
|
||||||
|
|
||||||
|
|
||||||
String token = authenticationTokenService.issueToken(user, 24L * 60 * 60);
|
String token = authenticationTokenService.issueToken(user, 24L * 60 * 60);
|
||||||
System.out.println(authenticationTokenService.parseToken(token).getIssuedDate());
|
System.out.println(authenticationTokenService.parseToken(token).getIssuedDate());
|
||||||
|
@ -246,8 +249,7 @@ public class UserRESTFacade extends AbstractRESTFacade<User> {
|
||||||
localSubject = "AREN API token";
|
localSubject = "AREN API token";
|
||||||
localBody = token;
|
localBody = token;
|
||||||
}
|
}
|
||||||
|
mailingService.sendMail(application_config.getString("smtp.username"), user.getEmail(), localSubject, localBody);
|
||||||
mailingService.sendMail("noreply@aren.fr", user.getEmail(), localSubject, localBody);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -358,10 +360,8 @@ public class UserRESTFacade extends AbstractRESTFacade<User> {
|
||||||
@Path("me")
|
@Path("me")
|
||||||
@RolesAllowed({"GUEST"})
|
@RolesAllowed({"GUEST"})
|
||||||
public User getAuthenticatedUser() {
|
public User getAuthenticatedUser() {
|
||||||
|
|
||||||
return getUser();
|
return getUser();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check the existance of an User by its username or mail
|
* Check the existance of an User by its username or mail
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in a new issue