diff --git a/dist/ng-token-auth.js b/dist/ng-token-auth.js index 99bfece3..3197ebc3 100644 --- a/dist/ng-token-auth.js +++ b/dist/ng-token-auth.js @@ -1,7 +1,6 @@ if (typeof module !== 'undefined' && typeof exports !== 'undefined' && module.exports === exports) { module.exports = 'ng-token-auth'; } - angular.module('ng-token-auth', ['ipCookie']).provider('$auth', function() { var configs, defaultConfigName; configs = { @@ -173,9 +172,9 @@ angular.module('ng-token-auth', ['ipCookie']).provider('$auth', function() { confirm_success_url: successUrl, config_name: this.getCurrentConfigName(opts.config) }); - return $http.post(this.apiUrl(opts.config) + this.getConfig(opts.config).emailRegistrationPath, params).success(function(resp) { + return $http.post(this.apiUrl(opts.config) + this.getConfig(opts.config).emailRegistrationPath, params).then(function(resp) { return $rootScope.$broadcast('auth:registration-email-success', params); - }).error(function(resp) { + }, function(resp){ return $rootScope.$broadcast('auth:registration-email-error', resp); }); }, @@ -184,7 +183,8 @@ angular.module('ng-token-auth', ['ipCookie']).provider('$auth', function() { opts = {}; } this.initDfd(); - $http.post(this.apiUrl(opts.config) + this.getConfig(opts.config).emailSignInPath, params).success((function(_this) { + + $http.post(this.apiUrl(opts.config) + this.getConfig(opts.config).emailSignInPath, params).then((function(_this)){ return function(resp) { var authData; _this.setConfigName(opts.config); @@ -192,7 +192,7 @@ angular.module('ng-token-auth', ['ipCookie']).provider('$auth', function() { _this.handleValidAuth(authData); return $rootScope.$broadcast('auth:login-success', _this.user); }; - })(this)).error((function(_this) { + }, function((function(_this)){ return function(resp) { _this.rejectDfd({ reason: 'unauthorized', @@ -200,7 +200,7 @@ angular.module('ng-token-auth', ['ipCookie']).provider('$auth', function() { }); return $rootScope.$broadcast('auth:login-error', resp); }; - })(this)); + })(this))(this); return this.dfd.promise; }, userIsAuthenticated: function() { @@ -216,24 +216,24 @@ angular.module('ng-token-auth', ['ipCookie']).provider('$auth', function() { if (opts.config != null) { params.config_name = opts.config; } - return $http.post(this.apiUrl(opts.config) + this.getConfig(opts.config).passwordResetPath, params).success(function(resp) { + return $http.post(this.apiUrl(opts.config) + this.getConfig(opts.config).passwordResetPath, params).then(function(resp) { return $rootScope.$broadcast('auth:password-reset-request-success', params); - }).error(function(resp) { + }, function(resp){ return $rootScope.$broadcast('auth:password-reset-request-error', resp); }); }, updatePassword: function(params) { - return $http.put(this.apiUrl() + this.getConfig().passwordUpdatePath, params).success((function(_this) { + return $http.put(this.apiUrl() + this.getConfig.passwordUpdatePath, params).then((function(_this){ return function(resp) { $rootScope.$broadcast('auth:password-change-success', resp); return _this.mustResetPassword = false; }; - })(this)).error(function(resp) { + }, function(resp){ return $rootScope.$broadcast('auth:password-change-error', resp); - }); + })(this)); }, updateAccount: function(params) { - return $http.put(this.apiUrl() + this.getConfig().accountUpdatePath, params).success((function(_this) { + return $http.put(this.apiUrl() + this.getConfig().accountUpdatePath, params).then((function(_this){ return function(resp) { var curHeaders, key, newHeaders, updateResponse, val, _ref; updateResponse = _this.getConfig().handleAccountUpdateResponse(resp); @@ -252,19 +252,19 @@ angular.module('ng-token-auth', ['ipCookie']).provider('$auth', function() { } return $rootScope.$broadcast('auth:account-update-success', resp); }; - })(this)).error(function(resp) { + }, function(this){ return $rootScope.$broadcast('auth:account-update-error', resp); - }); + })(this)); }, destroyAccount: function(params) { - return $http["delete"](this.apiUrl() + this.getConfig().accountUpdatePath, params).success((function(_this) { + return $http["delete"](this.apiUrl() + this.getConfig().accountUpdatePath, params).then((function(_this){ return function(resp) { _this.invalidateTokens(); return $rootScope.$broadcast('auth:account-destroy-success', resp); }; - })(this)).error(function(resp) { + }, function(resp){ return $rootScope.$broadcast('auth:account-destroy-error', resp); - }); + })(this)); }, authenticate: function(provider, opts) { if (opts == null) { @@ -483,7 +483,7 @@ angular.module('ng-token-auth', ['ipCookie']).provider('$auth', function() { opts = {}; } if (!this.tokenHasExpired()) { - return $http.get(this.apiUrl(opts.config) + this.getConfig(opts.config).tokenValidationPath).success((function(_this) { + return $http.get(this.apiUrl(opts.config) + this.getConfig(opts.config).tokenValidationPath).then((function(_this){ return function(resp) { var authData; authData = _this.getConfig(opts.config).handleTokenValidationResponse(resp); @@ -499,7 +499,7 @@ angular.module('ng-token-auth', ['ipCookie']).provider('$auth', function() { } return $rootScope.$broadcast('auth:validation-success', _this.user); }; - })(this)).error((function(_this) { + }, function(function(_this){ return function(data) { if (_this.firstTimeLogin) { $rootScope.$broadcast('auth:email-confirmation-error', data); @@ -513,7 +513,7 @@ angular.module('ng-token-auth', ['ipCookie']).provider('$auth', function() { errors: data != null ? data.errors : ['Unspecified error'] }); }; - })(this)); + })(this))(this)); } else { return this.rejectDfd({ reason: 'unauthorized', @@ -544,17 +544,17 @@ angular.module('ng-token-auth', ['ipCookie']).provider('$auth', function() { return this.deleteData('auth_headers'); }, signOut: function() { - return $http["delete"](this.apiUrl() + this.getConfig().signOutUrl).success((function(_this) { + return $http["delete"](this.apiUrl() + this.getConfig().signOutUrl).then((function(_this){ return function(resp) { _this.invalidateTokens(); return $rootScope.$broadcast('auth:logout-success'); }; - })(this)).error((function(_this) { + }, function(function(_this){ return function(resp) { _this.invalidateTokens(); return $rootScope.$broadcast('auth:logout-error', resp); }; - })(this)); + })(this))(this)); }, handleValidAuth: function(user, setHeader) { if (setHeader == null) {