Mercurial > prosody-modules
changeset 1230:f7c561fbd5a6
mod_register_web: Friendly error messages if the username is taken or failed nodeprep
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sat, 30 Nov 2013 20:28:07 +0100 |
parents | 12e3bc0fd6ed |
children | 502ce9672eae |
files | mod_register_web/mod_register_web.lua |
diffstat | 1 files changed, 4 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/mod_register_web/mod_register_web.lua Sat Nov 30 19:09:30 2013 +0100 +++ b/mod_register_web/mod_register_web.lua Sat Nov 30 20:28:07 2013 +0100 @@ -101,8 +101,11 @@ function register_user(form) local prepped_username = nodeprep(form.username); + if not prepped_username then + return nil, "Username contains forbidden characters"; + end if usermanager.user_exists(prepped_username, module.host) then - return nil, "user-exists"; + return nil, "Username already taken"; end return usermanager.create_user(prepped_username, form.password, module.host); end