Closed bwagner5 closed 9 years ago
Hi @bwagner5 Thanks for the PR. I think it is a great idea to validate using email or username (like Facebook does, for example). However, we should assure that users with case sensitive can't be created. Otherwise if users "admin" and "Admin" are created Admin won't never be able to login.
ah yes, I can solve this by implementing setUsername(String username) or a custom validator:
setUsername(String username){
this.username = username.toLowerCase()
}
--or--
a custom validator could be created:
username(blank: false, unique: true, validator: { val, obj ->
def userChk = User.findByUsernameILike(val)
return !userChk || obj.id == userChk.id
})
Let me know which one you would prefer or another suggestion if you think there is a more elegant solution. I added a commit that implements the setUsername method in User.groovy. I think this is the most elegant solution compared to implementing a custom validator with a GORM query.
@raulgomis is the fix that I committed acceptable?
Hi @bwagner5...yes! I want to review the code and implement some unit / integration tests if possible. I have been working on this last weekend, have some advances. I will merge it asap! thanks!
This pull request gets rid of the GrantedAuthorityImpl (deprecated) and replaces it with SimpleGrantedAuthority.
Added email address to user find query
Made email address and username query case insensitive
Modified .git-ignore to exclude the .sass-cache directory