changeset 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 b1c5b0c369c2
children f5005d256877
files mod_register_web/mod_register_web.lua mod_register_web/templates/register.html
diffstat 2 files changed, 7 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mod_register_web/mod_register_web.lua	Thu Jul 27 16:46:18 2017 +0200
+++ b/mod_register_web/mod_register_web.lua	Tue Aug 01 17:33:05 2017 +0200
@@ -128,6 +128,9 @@
 	if not registering.allowed then
 		return nil, "Registration not allowed";
 	end
+	if form.confirm_password ~= form.password then
+		return nil, "Passwords don't match";
+	end
 	local ok, err = usermanager.create_user(prepped_username, form.password, module.host);
 	if ok then
 		local extra_data = {};
--- a/mod_register_web/templates/register.html	Thu Jul 27 16:46:18 2017 +0200
+++ b/mod_register_web/templates/register.html	Tue Aug 01 17:33:05 2017 +0200
@@ -18,6 +18,10 @@
             <th>Password:</th>
             <td><input name="password" required type="password"></td>
           </tr>
+          <tr>
+            <th>Confirm Password:</th>
+            <td><input name="confirm_password" required type="password"></td>
+          </tr>
           {captcha}
           <tr>
             <td colspan="2"><input type="submit" value="Register!"></td>