I am using a string "username" as the primary-key of a table,
But when saving and getting the column with the username id I want the case to be ignored so that new users can't try to impersonate another user.
e.g. When registering a new user
- username = Daxon
- username = DaXoN //this should not be allowed
When getting the unique username it can be typed in any case and still be obtained. Youtube do this with their usernames.
e.g.
- youtube.com/user/Daxon
- youtube.com/user/DaXoN //Should go to the same profile of 'Daxon' anyway
Domain Class This uses username as the primary key
class User {
String username
String password
static constraints = {
}
static mapping = {
id generator: 'assigned', name: "username", type: 'string'
}
}
I then scaffold the controllers and views, so can anyone help me on saving and getting unique usernames with case ignored?