Commit 6f7328f8 authored by Matija Obreza's avatar Matija Obreza
Browse files

Fixed user role loading problem, email verification key all uppercase

parent f25213d6
......@@ -77,20 +77,10 @@ public class AuthUserDetailsService implements UserDetailsService {
}
private Collection<? extends GrantedAuthority> getGrantedAuthorities(User user) {
List<UserRole> userRoles = new ArrayList<UserRole>(UserRole.values().length);
// consider, that every user has USER role
userRoles.add(UserRole.USER);
for (UserRole userRole : user.getRoles()) {
if (UserRole.ADMINISTRATOR.equals(userRole)) {
userRoles.add(UserRole.ADMINISTRATOR);
}
}
List<GrantedAuthority> grantedAuthorities = new ArrayList<GrantedAuthority>();
for (UserRole authority : userRoles) {
grantedAuthorities.add(new SimpleGrantedAuthority(authority.name()));
for (UserRole userRole : user.getRoles()) {
grantedAuthorities.add(new SimpleGrantedAuthority(userRole.name()));
}
return grantedAuthorities;
......
......@@ -75,7 +75,7 @@ public class EMailVerificationServiceImpl implements EMailVerificationService {
token.setPurpose(tokenPurpose);
// Store data
token.setData(data);
token.setKey(RandomStringUtils.randomAlphanumeric(4));
token.setKey(RandomStringUtils.randomAlphanumeric(4).toUpperCase());
verificationTokenRepository.save(token);
return token;
}
......
Markdown is supported
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