|
|
|
@ -1,6 +1,6 @@
|
|
|
|
|
'use strict';
|
|
|
|
|
|
|
|
|
|
/* globals define, app, utils, socket, config */
|
|
|
|
|
/* globals define, app, utils, socket, config, ajaxify, bootbox */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
define('forum/register', ['csrf', 'translator'], function(csrf, translator) {
|
|
|
|
@ -67,16 +67,21 @@ define('forum/register', ['csrf', 'translator'], function(csrf, translator) {
|
|
|
|
|
|
|
|
|
|
register.on('click', function(e) {
|
|
|
|
|
var registerBtn = $(this);
|
|
|
|
|
var errorEl = $('#register-error-notify');
|
|
|
|
|
errorEl.addClass('hidden');
|
|
|
|
|
e.preventDefault();
|
|
|
|
|
validateForm(function() {
|
|
|
|
|
if (!validationError) {
|
|
|
|
|
if (validationError) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
registerBtn.addClass('disabled');
|
|
|
|
|
|
|
|
|
|
registerBtn.parents('form').ajaxSubmit({
|
|
|
|
|
headers: {
|
|
|
|
|
'x-csrf-token': csrf.get()
|
|
|
|
|
},
|
|
|
|
|
success: function(data, status) {
|
|
|
|
|
success: function(data) {
|
|
|
|
|
registerBtn.removeClass('disabled');
|
|
|
|
|
if (!data) {
|
|
|
|
|
return;
|
|
|
|
@ -92,16 +97,14 @@ define('forum/register', ['csrf', 'translator'], function(csrf, translator) {
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
error: function(data, status) {
|
|
|
|
|
var errorEl = $('#register-error-notify');
|
|
|
|
|
error: function(data) {
|
|
|
|
|
translator.translate(data.responseText, config.defaultLang, function(translated) {
|
|
|
|
|
errorEl.find('p').text(translated);
|
|
|
|
|
errorEl.show();
|
|
|
|
|
errorEl.removeClass('hidden');
|
|
|
|
|
registerBtn.removeClass('disabled');
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
@ -181,6 +184,8 @@ define('forum/register', ['csrf', 'translator'], function(csrf, translator) {
|
|
|
|
|
|
|
|
|
|
if (password.length < ajaxify.data.minimumPasswordLength) {
|
|
|
|
|
showError(password_notify, '[[user:change_password_error_length]]');
|
|
|
|
|
} else if (password.length > 4096) {
|
|
|
|
|
showError(password_notify, '[[error:password-too-long]]');
|
|
|
|
|
} else if (!utils.isPasswordValid(password)) {
|
|
|
|
|
showError(password_notify, '[[user:change_password_error]]');
|
|
|
|
|
} else if (password === $('#username').val()) {
|
|
|
|
|