Email Confirmation Article
When VerificationToken expires Redirect to error page
This commit is contained in:
parent
70ccda8cde
commit
430762f4d5
|
@ -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) {
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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
|
Loading…
Reference in New Issue