diff --git a/app/Views/register.php b/app/Views/register.php
index 60ae2de..b8d7bfa 100644
--- a/app/Views/register.php
+++ b/app/Views/register.php
@@ -258,14 +258,14 @@
-
+
-
+
diff --git a/app/Views/templates/footer.php b/app/Views/templates/footer.php
index ee4a9fa..e7796aa 100644
--- a/app/Views/templates/footer.php
+++ b/app/Views/templates/footer.php
@@ -1,4 +1,7 @@
+
diff --git a/public/js/register.js b/public/js/register.js
index 034a9de..3b95614 100644
--- a/public/js/register.js
+++ b/public/js/register.js
@@ -1,9 +1,3 @@
-//repeat password check
-//update passwordcheck validation pattern to match password value when this change
-$("#password").on('change', function() {
- $("#passwordcheck").pattern = this.value;
-});
-
//profile image preview
function readURL(input) {
@@ -24,13 +18,13 @@ $("#imginput").on('change', function() {
//flag image preview
$("#flaginput").on('change', function() {
- var newsrc='./img/flags/flags_medium/'+this.value.replace(' ','_')+'.png';
+ var newsrc = `${base_url}/img/flags/flags_medium/`+this.value.replace(' ','_')+'.png';
$("#flagimg").attr('src', newsrc);
});
$('#refresh-captcha').on('click', function() {
$().ajax(
- '/register/new_captcha',
+ `${base_url}/register/new_captcha`,
{
'dataType': 'text',
'success': function(res) {
@@ -43,21 +37,22 @@ $('#refresh-captcha').on('click', function() {
$('#reg-form > form').on('submit', function(e) {
e.preventDefault();
// Check if the password math
- let passwd = $('#password').val();
- let passwdcheck = $('#passwordcheck').val();
+ const passwd = $('#password').val();
+ const passwdcheck = $('#passwordcheck').val();
$('#register-error').hide();
$('#passwd-error').hide();
- if (passwd != passwdcheck) {
+
+ if (passwd.normalize() != passwdcheck.normalize()) {
$('#passwd-error').show();
} else {
- form_data = new FormData(this);
+ const form_data = new FormData(this);
- $().ajax('/register/newuser', {
+ $().ajax(`${base_url}/register/newuser`, {
type: 'POST',
data: form_data,
success: (resp) => {
if (resp.ok) {
- location.href = '/register/ok';
+ location.href = `${base_url}/register/ok`;
} else {
$('#register-error').text(resp.msg);
$('#register-error').show();
@@ -68,11 +63,17 @@ $('#reg-form > form').on('submit', function(e) {
});
$('input').on('keyup', function() {
- input = $(this);
- inputID = '#' + input.attr('id');
+ const input = $(this);
+ const inputID = '#' + input.attr('id');
$(inputID + ' + .input-error').hide();
+
if (input.val() && input.is(':invalid')) $(inputID + ' + .input-error').show();
- if (input.val() && inputID == '#password') $('#passwordcheck').attr('pattern', input.val())
+ if (input.val() && (inputID == '#password' || inputID == '#passwordcheck')) {
+ const passwd = $('#password').val();
+ const passwdcheck = $('#passwordcheck').val();
+ if (passwd.normalize() != passwdcheck.normalize()) $('#passwd-error').show();
+ else $('#passwd-error').hide();
+ }
});
$("#flaginput").trigger('change');