Merge pull request #89 from egmp777/master

Email Confirmation Article
This commit is contained in:
Eugen 2014-12-01 19:55:47 +02:00
commit 14849eb88f
3 changed files with 9 additions and 12 deletions

View File

@ -51,10 +51,6 @@ public class MyUserDetailsService implements UserDetailsService {
enabled = false;
return new org.springframework.security.core.userdetails.User(" ", " ", enabled, true, true, true, getAuthorities(new Integer(1)));
}
if (user.isTokenExpired()) {
accountNonExpired = false;
return new org.springframework.security.core.userdetails.User(" ", " ", enabled, accountNonExpired, true, true, getAuthorities(new Integer(1)));
}
return new org.springframework.security.core.userdetails.User(user.getEmail(), user.getPassword().toLowerCase(), enabled, accountNonExpired, credentialsNonExpired, accountNonLocked, getAuthorities(user.getRole().getRole()));
} catch (Exception e) {

View File

@ -64,7 +64,8 @@ public class RegistrationController {
User user = verificationToken.getUser();
Calendar cal = Calendar.getInstance();
if ((verificationToken.getExpiryDate().getTime() - cal.getTime().getTime()) <= 0) {
user.setTokenExpired(true);
model.addAttribute("message", messages.getMessage("auth.message.expired", null, request.getLocale()));
return "redirect:/badUser.html?lang=" + request.getLocale().getLanguage();
}
user.setEnabled(true);
service.saveRegisteredUser(user);

View File

@ -1,17 +1,17 @@
################### DataSource Configuration ##########################
jdbc.driverClassName=com.mysql.jdbc.Driver
jdbc.url=jdbc:mysql://localhost:3306/AUTHDATA
jdbc.user=root
###jdbc.pass=admin###
jdbc.url=jdbc:mysql://localhost:3306/spring_hibernate4_02?createDatabaseIfNotExist=true
jdbc.user=tutorialuser
jdbc.pass=tutorialmy5ql
init-db=false
################### Hibernate Configuration ##########################
hibernate.dialect=org.hibernate.dialect.MySQLDialect
hibernate.show_sql=true
hibernate.hbm2ddl.auto=validate
hibernate.show_sql=false
hibernate.hbm2ddl.auto=create-drop
################### JavaMail Configuration ##########################
smtp.host=smtp.gmail.com
smtp.port=465
smtp.protocol=smtps
smtp.username=xxx@gmail.com
smtp.username=xxx777@gmail.com
smtp.password=
support.email=xxx@gmail.com
support.email=xxx777@gmail.com