Skip to content
Snippets Groups Projects
Commit 0b9c0c40 authored by Daniel Gerhardt's avatar Daniel Gerhardt
Browse files

Make account activation page configurable

Added support for an activation webpage and renamed dialog config param
for consistency.
parent 11394b0e
No related merge requests found
......@@ -74,36 +74,52 @@ public class LoginController extends AbstractController {
@Value("${customization.path}")
private String customizationPath;
@Value("${security.guest.enabled}")
private String guestEnabled;
@Value("${security.guest.lecturer.enabled}")
private String guestLecturerEnabled;
@Value("${security.user-db.enabled}")
private String dbAuthEnabled;
@Value("${security.user-db.title:ARSnova}")
private String dbAuthTitle;
@Value("${security.user-db.login-dialog}")
@Value("${security.user-db.login-dialog-path}")
private String dbAuthDialog;
@Value("${security.user-db.image:}")
private String dbAuthImage;
@Value("${security.ldap.enabled}")
private String ldapEnabled;
@Value("${security.ldap.title:LDAP}")
private String ldapTitle;
@Value("${security.ldap.login-dialog}")
@Value("${security.ldap.login-dialog-path}")
private String ldapDialog;
@Value("${security.ldap.image:}")
private String ldapImage;
@Value("${security.cas.enabled}")
private String casEnabled;
@Value("${security.cas.title:CAS}")
private String casTitle;
@Value("${security.cas.image:}")
private String casImage;
@Value("${security.facebook.enabled}")
private String facebookEnabled;
@Value("${security.google.enabled}")
private String googleEnabled;
@Value("${security.twitter.enabled}")
private String twitterEnabled;
......
package de.thm.arsnova.services;
import java.io.UnsupportedEncodingException;
import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.Arrays;
......@@ -42,6 +43,7 @@ import org.springframework.security.crypto.keygen.KeyGenerators;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.util.UriUtils;
import com.github.leleuj.ss.oauth.client.authentication.OAuthAuthenticationToken;
......@@ -82,21 +84,27 @@ public class UserService implements IUserService {
@Autowired
private JavaMailSender mailSender;
@Value("${root-url}")
private String rootUrl;
@Value("${customization.path}")
private String customizationPath;
@Value("${security.user-db.allowed-email-domains}")
private String allowedEmailDomains;
@Value("${security.arsnova-url}")
private String arsnovaUrl;
@Value("${security.user-db.activation-path}")
private String activationPath;
@Value("${mail.sender.address}")
private String regMailSenderAddress;
@Value("${mail.sender.name}")
private String regMailSenderName;
@Value("${security.user-db.registration-mail.subject}")
private String regMailSubject;
@Value("${security.user-db.registration-mail.body}")
private String regMailBody;
......@@ -381,7 +389,21 @@ public class UserService implements IUserService {
}
public void sendActivationEmail(DbUser dbUser) {
String activationUrl = MessageFormat.format("{0}/user/{1}/activate?key={2}", arsnovaUrl, dbUser.getUsername(), dbUser.getActivationKey());
String activationUrl;
try {
activationUrl = MessageFormat.format(
"{0}{1}/{2}?username={3}&key={4}",
rootUrl,
customizationPath,
activationPath,
UriUtils.encodeQueryParam(dbUser.getUsername(), "UTF-8"),
dbUser.getActivationKey()
);
} catch (UnsupportedEncodingException e1) {
LOGGER.error(e1.getMessage());
return;
}
MimeMessage msg = mailSender.createMimeMessage();
MimeMessageHelper helper = new MimeMessageHelper(msg, "UTF-8");
try {
......
root-url=http://localhost:8080
customization.path=/customization
mobile.path=/mobile
presenter.path=/presenter
......@@ -15,7 +16,8 @@ security.guest.lecturer.enabled=true
security.user-db.enabled=true
security.user-db.title=ARSnova
security.user-db.login-dialog=login-arsnova.html
security.user-db.login-dialog-path=account.html
security.user-db.activation-path=account.html
security.user-db.image=
security.user-db.allowed-email-domains=*
security.user-db.registration-mail.subject=ARSnova Registration
......@@ -23,7 +25,7 @@ security.user-db.registration-mail.body=Welcome to ARSnova!\n\nPlease confirm yo
security.ldap.enabled=true
security.ldap.title=LDAP
security.ldap.login-dialog=login-ldap.html
security.ldap.login-dialog-path=login-ldap.html
security.user-db.image=
security.ldap.url=ldap://example.com:33389/dc=example,dc=com
security.ldap.user-dn-pattern=uid={0},ou=arsnova
......
root-url=http://localhost:8080
customization.path=/customization
mobile.path=/mobile
presenter.path=/presenter
......@@ -15,7 +16,8 @@ security.guest.lecturer.enabled=true
security.user-db.enabled=true
security.user-db.title=ARSnova
security.user-db.login-dialog=login-arsnova.html
security.user-db.login-dialog-path=account.html
security.user-db.activation-path=account.html
security.user-db.image=
security.user-db.allowed-email-domains=*
security.user-db.registration-mail.subject=ARSnova Registration
......@@ -23,7 +25,7 @@ security.user-db.registration-mail.body=Welcome to ARSnova!\n\nPlease confirm yo
security.ldap.enabled=true
security.ldap.title=LDAP
security.ldap.login-dialog=login-ldap.html
security.ldap.login-dialog-path=login-ldap.html
security.user-db.image=
security.ldap.url=ldap://example.com:33389/dc=example,dc=com
security.ldap.user-dn-pattern=uid={0},ou=arsnova
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment