From ab2272b6b5127e511642b86269aed97742895d33 Mon Sep 17 00:00:00 2001 From: psychobunny Date: Tue, 21 Apr 2015 18:32:24 -0400 Subject: [PATCH] installer: confirm password --- public/src/installer/install.js | 18 +++++++++++++----- src/views/install/index.tpl | 7 +++++++ 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/public/src/installer/install.js b/public/src/installer/install.js index ff3b92e542..0ec469ff5b 100644 --- a/public/src/installer/install.js +++ b/public/src/installer/install.js @@ -18,11 +18,8 @@ $('document').ready(function() { help.html(help.attr('data-help')); }); - $('[name="username"]').on('blur', function() { - validate('username', $(this)); - }); - $('[name="password"]').on('blur', function() { - validate('password', $(this)); + $('[name]').on('blur', function() { + validate($(this).attr('name'), $(this)); }); } @@ -49,11 +46,22 @@ $('document').ready(function() { } } + function validateConfirmPassword(field) { + if ($('[name="password"]').val() !== $('[name="confirm"]').val()) { + parent.addClass('error'); + help.html('Passwords do not match.'); + } else { + parent.removeClass('error'); + } + } + switch (type) { case 'username': return validateUsername(field); case 'password': return validatePassword(field); + case 'confirm': + return validateConfirmPassword(field); } } }); \ No newline at end of file diff --git a/src/views/install/index.tpl b/src/views/install/index.tpl index f611a7cf4c..5dbd31de84 100644 --- a/src/views/install/index.tpl +++ b/src/views/install/index.tpl @@ -62,6 +62,13 @@
+
+
+ + +
+
+