mirror of
https://github.com/rr-/szurubooru.git
synced 2025-07-17 08:26:24 +00:00
Fixed double errors in registration
This commit is contained in:
@ -25,7 +25,8 @@ App.Presenters.RegistrationPresenter = function(
|
|||||||
email: $el.find('[name=email]').val(),
|
email: $el.find('[name=email]').val(),
|
||||||
};
|
};
|
||||||
|
|
||||||
validateRegistrationData(registrationData);
|
if (!validateRegistrationData(registrationData))
|
||||||
|
return;
|
||||||
|
|
||||||
api.post('/users', registrationData)
|
api.post('/users', registrationData)
|
||||||
.then(function(response) {
|
.then(function(response) {
|
||||||
@ -61,18 +62,20 @@ App.Presenters.RegistrationPresenter = function(
|
|||||||
function validateRegistrationData(registrationData) {
|
function validateRegistrationData(registrationData) {
|
||||||
if (registrationData.userName.length == 0) {
|
if (registrationData.userName.length == 0) {
|
||||||
messagePresenter.showError($messages, 'User name cannot be empty.');
|
messagePresenter.showError($messages, 'User name cannot be empty.');
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (registrationData.password.length == 0) {
|
if (registrationData.password.length == 0) {
|
||||||
messagePresenter.showError($messages, 'Password cannot be empty.');
|
messagePresenter.showError($messages, 'Password cannot be empty.');
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (registrationData.password != registrationData.passwordConfirmation) {
|
if (registrationData.password != registrationData.passwordConfirmation) {
|
||||||
messagePresenter.showError($messages, 'Passwords must be the same.');
|
messagePresenter.showError($messages, 'Passwords must be the same.');
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
Reference in New Issue
Block a user