ubccr / mokey

FreeIPA self-service account management portal
BSD 3-Clause "New" or "Revised" License
194 stars 46 forks source link

Restrict username to lowercase and not only number when signing up #78

Closed cmd-ntrf closed 3 years ago

cmd-ntrf commented 3 years ago

Mokey currently allows case-sensitive username when signing-up. However, the user_add rpc call sanitizes the username and make it all lowercase. The user signing-up is never warned, so it might try to login with the case sensitive version of its username.

Furthermore, the homedir value is created in Mokey and is not sanitized by the rpc_call. So when the user logins with its lowercase username, the value of $HOME is wrong, and the user's session starts in /.

This PR proposes to make sure the username is lowercase. I have also added check that the username is not only made of numbers, which is not allowed in FreeIPA.

aebruno commented 3 years ago

Looks good. Thanks!