comparison mod_register_web/mod_register_web.lua @ 2733:c8161146c698

mod_register_web: Add password confirmation field
author Michel Le Bihan <michel@lebihan.pl>
date Tue, 01 Aug 2017 17:33:05 +0200
parents 32604bf33a4c
children 7d864a03b509
comparison
equal deleted inserted replaced
2732:b1c5b0c369c2 2733:c8161146c698
126 local registering = { username = prepped_username , host = module.host, allowed = true } 126 local registering = { username = prepped_username , host = module.host, allowed = true }
127 module:fire_event("user-registering", registering); 127 module:fire_event("user-registering", registering);
128 if not registering.allowed then 128 if not registering.allowed then
129 return nil, "Registration not allowed"; 129 return nil, "Registration not allowed";
130 end 130 end
131 if form.confirm_password ~= form.password then
132 return nil, "Passwords don't match";
133 end
131 local ok, err = usermanager.create_user(prepped_username, form.password, module.host); 134 local ok, err = usermanager.create_user(prepped_username, form.password, module.host);
132 if ok then 135 if ok then
133 local extra_data = {}; 136 local extra_data = {};
134 for field in pairs(extra_fields) do 137 for field in pairs(extra_fields) do
135 local field_value = form[field]; 138 local field_value = form[field];