mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 22:57:21 +01:00
fix(auth): hacky fix to get around tabset hiding the surrounding
authctrl scope (due to isolate scope)
This commit is contained in:
@@ -33,12 +33,12 @@ angular.module('habitrpg')
|
||||
/*TODO highlight invalid inputs
|
||||
we have this as a workaround for https://github.com/HabitRPG/habitrpg-mobile/issues/64
|
||||
*/
|
||||
if ($scope.registrationForm.$invalid) {
|
||||
return;
|
||||
}
|
||||
var scope = angular.element(document.getElementById('registrationForm')).scope();
|
||||
if (scope.registrationForm.$invalid) return;
|
||||
|
||||
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) {
|
||||
$http.post(url, scope.registerVals).success(function(data, status, headers, config) {
|
||||
runAuth(data.id, data.apiToken);
|
||||
}).error(errorAlert);
|
||||
};
|
||||
|
||||
@@ -14,7 +14,7 @@ script(id='modals/login.html', type='text/ng-template')
|
||||
hr
|
||||
tabset(justified='true')
|
||||
tab(heading=env.t('login'))
|
||||
form(ng-submit='auth()', method='POST')
|
||||
form#login-tab(ng-submit='auth()', method='POST')
|
||||
.form-group
|
||||
input.form-control(type='text', ng-model='loginUsername', placeholder=env.t('username')+' or Email', name='username')
|
||||
.form-group
|
||||
@@ -47,8 +47,9 @@ script(id='modals/login.html', type='text/ng-template')
|
||||
//span.help-inline {.errors.passwordReset}
|
||||
.form-group
|
||||
input.btn.btn-default(type='submit', value=env.t('submit'))
|
||||
|
||||
tab(heading=env.t('register'))
|
||||
form(ng-submit='register()', name='registrationForm')
|
||||
form#registrationForm(ng-submit='register()', name='registrationForm')
|
||||
.form-group
|
||||
input.form-control(type='text', ng-model='registerVals.username', placeholder=env.t('username'), required)
|
||||
.form-group
|
||||
@@ -68,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', value=env.t('register'))
|
||||
input.btn.btn-primary(type='submit', ng-disabled='registrationForm.$invalid', value=env.t('register'))
|
||||
|
||||
Reference in New Issue
Block a user