mirror of
https://github.com/sudoxnym/habitica.git
synced 2026-05-21 13:18:53 +00:00
Added api-v3 auth urls
This commit is contained in:
parent
1315e5914c
commit
04d8e7dd28
1 changed files with 9 additions and 8 deletions
|
|
@ -29,7 +29,7 @@ angular.module('habitrpg')
|
|||
if (status === 0) {
|
||||
$window.alert(window.env.t('noReachServer'));
|
||||
} else if (!!data && !!data.err) {
|
||||
$window.alert(data.err);
|
||||
$window.alert(data.data.message);
|
||||
} else {
|
||||
$window.alert(window.env.t('errorUpCase') + ' ' + status);
|
||||
}
|
||||
|
|
@ -46,10 +46,10 @@ angular.module('habitrpg')
|
|||
|
||||
$scope.registrationInProgress = true;
|
||||
|
||||
var url = ApiUrl.get() + "/api/v2/register";
|
||||
var url = ApiUrl.get() + "/api/v3/user/auth/local/register";
|
||||
if($rootScope.selectedLanguage) url = url + '?lang=' + $rootScope.selectedLanguage.code;
|
||||
$http.post(url, scope.registerVals).success(function(data, status, headers, config) {
|
||||
runAuth(data.id, data.apiToken);
|
||||
runAuth(data.data.id, data.data.apiToken);
|
||||
}).error(errorAlert);
|
||||
};
|
||||
|
||||
|
|
@ -58,9 +58,10 @@ angular.module('habitrpg')
|
|||
username: $scope.loginUsername || $('#loginForm input[name="username"]').val(),
|
||||
password: $scope.loginPassword || $('#loginForm input[name="password"]').val()
|
||||
};
|
||||
$http.post(ApiUrl.get() + "/api/v2/user/auth/local", data)
|
||||
//@TODO: Move all the $http methods to a service
|
||||
$http.post(ApiUrl.get() + "/api/v3/user/auth/local/login", data)
|
||||
.success(function(data, status, headers, config) {
|
||||
runAuth(data.id, data.token);
|
||||
runAuth(data.data.id, data.data.apiToken);
|
||||
}).error(errorAlert);
|
||||
};
|
||||
|
||||
|
|
@ -80,7 +81,7 @@ angular.module('habitrpg')
|
|||
if(email == null || email.length == 0) {
|
||||
alert(window.env.t('invalidEmail'));
|
||||
} else {
|
||||
$http.post(ApiUrl.get() + '/api/v2/user/reset-password', {email:email})
|
||||
$http.post(ApiUrl.get() + '/api/v3/user/reset-password', {email:email})
|
||||
.success(function(){
|
||||
alert(window.env.t('newPassSent'));
|
||||
})
|
||||
|
|
@ -98,9 +99,9 @@ angular.module('habitrpg')
|
|||
|
||||
$scope.socialLogin = function(network){
|
||||
hello(network).login({scope:'email'}).then(function(auth){
|
||||
$http.post(ApiUrl.get() + "/api/v2/user/auth/social", auth)
|
||||
$http.post(ApiUrl.get() + "/api/v3/user/auth/social", auth)
|
||||
.success(function(data, status, headers, config) {
|
||||
runAuth(data.id, data.token);
|
||||
runAuth(data.data.id, data.data.apiToken);
|
||||
}).error(errorAlert);
|
||||
}, function( e ){
|
||||
alert("Signin error: " + e.error.message );
|
||||
|
|
|
|||
Loading…
Reference in a new issue