mirror of
https://github.com/sudoxnym/habitica.git
synced 2026-08-05 03:52:14 +00:00
disable registration while request in progress
This commit is contained in:
parent
84a4c36c7e
commit
8066589268
2 changed files with 7 additions and 1 deletions
|
|
@ -15,11 +15,13 @@ angular.module('habitrpg')
|
|||
|
||||
var runAuth = function(id, token) {
|
||||
User.authenticate(id, token, function(err) {
|
||||
$scope.registrationInProgress = false;
|
||||
$window.location.href = ('/' + window.location.hash);
|
||||
});
|
||||
};
|
||||
|
||||
function errorAlert(data, status, headers, config) {
|
||||
$scope.registrationInProgress = false;
|
||||
if (status === 0) {
|
||||
$window.alert(window.env.t('noReachServer'));
|
||||
} else if (!!data && !!data.err) {
|
||||
|
|
@ -29,6 +31,8 @@ angular.module('habitrpg')
|
|||
}
|
||||
};
|
||||
|
||||
$scope.registrationInProgress = false;
|
||||
|
||||
$scope.register = function() {
|
||||
/*TODO highlight invalid inputs
|
||||
we have this as a workaround for https://github.com/HabitRPG/habitrpg-mobile/issues/64
|
||||
|
|
@ -36,6 +40,8 @@ angular.module('habitrpg')
|
|||
var scope = angular.element(document.getElementById('registrationForm')).scope();
|
||||
if (scope.registrationForm.$invalid) return;
|
||||
|
||||
$scope.registrationInProgress = true;
|
||||
|
||||
var url = ApiUrl.get() + "/api/v2/register";
|
||||
if($rootScope.selectedLanguage) url = url + '?lang=' + $rootScope.selectedLanguage.code;
|
||||
$http.post(url, scope.registerVals).success(function(data, status, headers, config) {
|
||||
|
|
|
|||
|
|
@ -69,4 +69,4 @@ script(id='modals/login.html', type='text/ng-template')
|
|||
a(href='/static/privacy' target='_blank')=env.t('privacy')
|
||||
| .
|
||||
.form-group
|
||||
input.btn.btn-primary(type='submit', ng-disabled='registrationForm.$invalid', value=env.t('register'))
|
||||
input.btn.btn-primary(type='submit', ng-disabled='registrationForm.$invalid || registrationInProgress', value=env.t('register'))
|
||||
|
|
|
|||
Loading…
Reference in a new issue