angular-meteor-auth
Advanced tools
Comparing version 1.0.3 to 1.1.0
@@ -39,16 +39,11 @@ ////////////////////////////////////////////////////////////////////////// | ||
// | ||
var _typeof2 = require('babel-runtime/helpers/typeof'); // | ||
// | ||
var _typeof3 = _interopRequireDefault(_typeof2); // | ||
// | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } // | ||
// | ||
var _typeof;module.import('babel-runtime/helpers/typeof',{"default":function(v){_typeof=v}}); // | ||
/*! angular-meteor-auth v1.0.2 */ // | ||
(function () { // 2 | ||
function webpackUniversalModuleDefinition(root, factory) { // 2 | ||
if ((typeof exports === 'undefined' ? 'undefined' : (0, _typeof3['default'])(exports)) === 'object' && (typeof module === 'undefined' ? 'undefined' : (0, _typeof3['default'])(module)) === 'object') module.exports = factory();else if (typeof define === 'function' && define.amd) define([], factory);else if ((typeof exports === 'undefined' ? 'undefined' : (0, _typeof3['default'])(exports)) === 'object') exports["angularMeteorAuth"] = factory();else root["angularMeteorAuth"] = factory(); | ||
} // | ||
if ((typeof exports === 'undefined' ? 'undefined' : _typeof(exports)) === 'object' && (typeof module === 'undefined' ? 'undefined' : _typeof(module)) === 'object') module.exports = factory();else if (typeof define === 'function' && define.amd) define([], factory);else if ((typeof exports === 'undefined' ? 'undefined' : _typeof(exports)) === 'object') exports["angularMeteorAuth"] = factory();else root["angularMeteorAuth"] = factory(); | ||
} // 11 | ||
// | ||
return webpackUniversalModuleDefinition; // | ||
})()(this, function () { // | ||
return webpackUniversalModuleDefinition; // 2 | ||
})()(this, function () { // 2 | ||
return (/******/function (modules) { // 12 | ||
@@ -82,3 +77,3 @@ // webpackBootstrap // | ||
/******/ // | ||
} // | ||
} // 38 | ||
// | ||
@@ -97,3 +92,3 @@ /******/ // expose the modules object (__webpack_modules__) // | ||
/******/ // | ||
}( // | ||
}( // 52 | ||
/************************************************************************/ // | ||
@@ -108,3 +103,3 @@ /******/[ // | ||
value: true // 61 | ||
}); // | ||
}); // 60 | ||
var name = 'angular-meteor.auth'; // 63 | ||
@@ -120,3 +115,3 @@ exports['default'] = name; // 64 | ||
*/ // | ||
.factory('$$Auth', ['$Mixer', function ($Mixer) { // | ||
.factory('$$Auth', ['$Mixer', function ($Mixer) { // 67 | ||
var Accounts = (Package['accounts-base'] || {}).Accounts; // 75 | ||
@@ -126,3 +121,3 @@ // | ||
throw Error('`angular-meteor.auth` module requires `accounts-base` package, ' + 'please run `meteor add accounts-base` before use'); | ||
} // | ||
} // 79 | ||
// | ||
@@ -132,3 +127,3 @@ var errors = { // 81 | ||
forbidden: 'FORBIDDEN' // 83 | ||
}; // | ||
}; // 81 | ||
// | ||
@@ -139,8 +134,8 @@ function $$Auth() { // 86 | ||
// reset auth properties // | ||
this.autorun(function () { // 86 | ||
this.autorun(function () { // 90 | ||
vm.currentUser = Accounts.user(); // 91 | ||
vm.currentUserId = Accounts.userId(); // 92 | ||
vm.isLoggingIn = Accounts.loggingIn(); // 93 | ||
}); // | ||
} // | ||
}); // 94 | ||
} // 95 | ||
// | ||
@@ -151,3 +146,3 @@ // Waits for user to finish the login process. Gets an optional validation function which // | ||
// user // | ||
$$Auth.$awaitUser = function (validate) { // 74 | ||
$$Auth.$awaitUser = function (validate) { // 101 | ||
var _this = this; // 102 | ||
@@ -157,7 +152,7 @@ // | ||
return true; // 105 | ||
}; // | ||
}; // 106 | ||
// | ||
if (!_.isFunction(validate)) { // 108 | ||
throw Error('argument 1 must be a function'); // 109 | ||
} // | ||
} // 110 | ||
// | ||
@@ -170,6 +165,6 @@ var deferred = this.$$defer(); // 112 | ||
// failures. Happens mainly after resolving a route. // | ||
var computation = this.autorun(function (computation) { // 101 | ||
var computation = this.autorun(function (computation) { // 118 | ||
if (_this.getReactively('isLoggingIn')) return; // 119 | ||
// Stop computation once a user has logged in // | ||
computation.stop(); // 118 | ||
computation.stop(); // 121 | ||
// | ||
@@ -180,3 +175,3 @@ if (!_this.currentUser) return _this.$$afterFlush(deferred.reject, errors.required); // 123 | ||
// Resolve the promise if validation has passed // | ||
if (isValid === true) return _this.$$afterFlush(deferred.resolve, _this.currentUser); // 118 | ||
if (isValid === true) return _this.$$afterFlush(deferred.resolve, _this.currentUser); // 127 | ||
// | ||
@@ -187,8 +182,8 @@ var error = void 0; // 129 | ||
error = isValid; // 132 | ||
} else { // | ||
} else { // 133 | ||
error = errors.forbidden; // 134 | ||
} // | ||
} // 135 | ||
// | ||
return _this.$$afterFlush(deferred.reject, error); // 137 | ||
}); // | ||
}); // 138 | ||
// | ||
@@ -198,6 +193,6 @@ var promise = deferred.promise; // 140 | ||
return promise; // 142 | ||
}; // | ||
}; // 143 | ||
// | ||
// Calls a function with the provided args after flush // | ||
$$Auth.$$afterFlush = function (fn) { // 74 | ||
$$Auth.$$afterFlush = function (fn) { // 146 | ||
var _fn; // 147 | ||
@@ -207,10 +202,10 @@ // | ||
fn = this[fn]; // 150 | ||
} // | ||
} // 151 | ||
// | ||
for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { | ||
args[_key - 1] = arguments[_key]; // 154 | ||
} // | ||
} // 155 | ||
// | ||
return Tracker.afterFlush((_fn = fn).bind.apply(_fn, [this].concat(args))); // 157 | ||
}; // | ||
}; // 158 | ||
// | ||
@@ -222,19 +217,19 @@ // API v0.2.0 // | ||
// Silent error // | ||
$$Auth.$waitForUser = function () { // 74 | ||
$$Auth.$waitForUser = function () { // 165 | ||
// Silent error // | ||
return this.$awaitUser()['catch'](); // 167 | ||
}; // | ||
}; // 168 | ||
// | ||
// No validation // | ||
$$Auth.$requireUser = function () { // 74 | ||
$$Auth.$requireUser = function () { // 171 | ||
return this.$awaitUser(); // 172 | ||
}; // | ||
}; // 173 | ||
// | ||
// Full functionality // | ||
$$Auth.$requireValidUser = function () { // 74 | ||
$$Auth.$requireValidUser = function () { // 176 | ||
return this.$awaitUser.apply(this, arguments); // 177 | ||
}; // | ||
}; // 178 | ||
// | ||
return $$Auth; // 180 | ||
}]) // | ||
}]) // 181 | ||
// | ||
@@ -245,3 +240,3 @@ /* // | ||
*/ // | ||
.service('$auth', ['$rootScope', '$$Auth', function ($rootScope, $$Auth) { // | ||
.service('$auth', ['$rootScope', '$$Auth', function ($rootScope, $$Auth) { // 67 | ||
var _this2 = this; // 188 | ||
@@ -251,19 +246,19 @@ // | ||
// will be available by then // | ||
_.keys($$Auth).forEach(function (k) { // 187 | ||
_.keys($$Auth).forEach(function (k) { // 192 | ||
var stripped = k.substr(1); // 193 | ||
// Not using bind() so it would be testable // | ||
_this2[stripped] = function () { // 192 | ||
_this2[stripped] = function () { // 195 | ||
return $rootScope[k].apply($rootScope, arguments); // 196 | ||
}; // | ||
}); // | ||
}]).run(['$Mixer', '$$Auth', function ($Mixer, $$Auth) { // | ||
}; // 197 | ||
}); // 198 | ||
}]).run(['$Mixer', '$$Auth', function ($Mixer, $$Auth) { // 199 | ||
$Mixer.mixin($$Auth); // 200 | ||
}]); // | ||
}]); // 201 | ||
module.exports = exports['default']; // 202 | ||
// | ||
/***/ // | ||
} // | ||
} // 204 | ||
/******/]) // | ||
); // | ||
}); // | ||
); // 12 | ||
}); // 206 | ||
; // 207 | ||
@@ -270,0 +265,0 @@ ///////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
@@ -1,1 +0,1 @@ | ||
(function(){var Meteor=Package.meteor.Meteor;var global=Package.meteor.global;var meteorEnv=Package.meteor.meteorEnv;var _=Package.underscore._;var Tracker=Package.tracker.Tracker;var Deps=Package.tracker.Deps;var ReactiveVar=Package["reactive-var"].ReactiveVar;var Accounts=Package["accounts-base"].Accounts;var meteorInstall=Package.modules.meteorInstall;var Buffer=Package.modules.Buffer;var process=Package.modules.process;var Symbol=Package["ecmascript-runtime"].Symbol;var Map=Package["ecmascript-runtime"].Map;var Set=Package["ecmascript-runtime"].Set;var meteorBabelHelpers=Package["babel-runtime"].meteorBabelHelpers;var Promise=Package.promise.Promise;var require=meteorInstall({node_modules:{meteor:{"angular-meteor-auth":{dist:{"angular-meteor-auth.js":["babel-runtime/helpers/typeof",function(require,exports,module){var _typeof2=require("babel-runtime/helpers/typeof");var _typeof3=_interopRequireDefault(_typeof2);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{"default":obj}}(function(){function webpackUniversalModuleDefinition(root,factory){if((typeof exports==="undefined"?"undefined":(0,_typeof3["default"])(exports))==="object"&&(typeof module==="undefined"?"undefined":(0,_typeof3["default"])(module))==="object")module.exports=factory();else if(typeof define==="function"&&define.amd)define([],factory);else if((typeof exports==="undefined"?"undefined":(0,_typeof3["default"])(exports))==="object")exports["angularMeteorAuth"]=factory();else root["angularMeteorAuth"]=factory()}return webpackUniversalModuleDefinition})()(this,function(){return function(modules){var installedModules={};function __webpack_require__(moduleId){if(installedModules[moduleId])return installedModules[moduleId].exports;var module=installedModules[moduleId]={exports:{},id:moduleId,loaded:false};modules[moduleId].call(module.exports,module,module.exports,__webpack_require__);module.loaded=true;return module.exports}__webpack_require__.m=modules;__webpack_require__.c=installedModules;__webpack_require__.p="";return __webpack_require__(0)}([function(module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var name="angular-meteor.auth";exports["default"]=name;angular.module(name,["angular-meteor.mixer","angular-meteor.core","angular-meteor.view-model","angular-meteor.reactive"]).factory("$$Auth",["$Mixer",function($Mixer){var Accounts=(Package["accounts-base"]||{}).Accounts;if(!Accounts){throw Error("`angular-meteor.auth` module requires `accounts-base` package, "+"please run `meteor add accounts-base` before use")}var errors={required:"AUTH_REQUIRED",forbidden:"FORBIDDEN"};function $$Auth(){var vm=arguments.length<=0||arguments[0]===undefined?this:arguments[0];this.autorun(function(){vm.currentUser=Accounts.user();vm.currentUserId=Accounts.userId();vm.isLoggingIn=Accounts.loggingIn()})}$$Auth.$awaitUser=function(validate){var _this=this;validate=validate?this.$bindToContext($Mixer.caller,validate):function(){return true};if(!_.isFunction(validate)){throw Error("argument 1 must be a function")}var deferred=this.$$defer();var computation=this.autorun(function(computation){if(_this.getReactively("isLoggingIn"))return;computation.stop();if(!_this.currentUser)return _this.$$afterFlush(deferred.reject,errors.required);var isValid=validate(_this.currentUser);if(isValid===true)return _this.$$afterFlush(deferred.resolve,_this.currentUser);var error=void 0;if(_.isString(isValid)||isValid instanceof Error){error=isValid}else{error=errors.forbidden}return _this.$$afterFlush(deferred.reject,error)});var promise=deferred.promise;promise.stop=computation.stop.bind(computation);return promise};$$Auth.$$afterFlush=function(fn){var _fn;if(_.isString(fn)){fn=this[fn]}for(var _len=arguments.length,args=Array(_len>1?_len-1:0),_key=1;_key<_len;_key++){args[_key-1]=arguments[_key]}return Tracker.afterFlush((_fn=fn).bind.apply(_fn,[this].concat(args)))};$$Auth.$waitForUser=function(){return this.$awaitUser()["catch"]()};$$Auth.$requireUser=function(){return this.$awaitUser()};$$Auth.$requireValidUser=function(){return this.$awaitUser.apply(this,arguments)};return $$Auth}]).service("$auth",["$rootScope","$$Auth",function($rootScope,$$Auth){var _this2=this;_.keys($$Auth).forEach(function(k){var stripped=k.substr(1);_this2[stripped]=function(){return $rootScope[k].apply($rootScope,arguments)}})}]).run(["$Mixer","$$Auth",function($Mixer,$$Auth){$Mixer.mixin($$Auth)}]);module.exports=exports["default"]}])})}]}}}}},{extensions:[".js",".json"]});require("./node_modules/meteor/angular-meteor-auth/dist/angular-meteor-auth.js");if(typeof Package==="undefined")Package={};Package["angular-meteor-auth"]={}})(); | ||
(function(){var Meteor=Package.meteor.Meteor;var global=Package.meteor.global;var meteorEnv=Package.meteor.meteorEnv;var _=Package.underscore._;var Tracker=Package.tracker.Tracker;var Deps=Package.tracker.Deps;var ReactiveVar=Package["reactive-var"].ReactiveVar;var Accounts=Package["accounts-base"].Accounts;var meteorInstall=Package.modules.meteorInstall;var Buffer=Package.modules.Buffer;var process=Package.modules.process;var Symbol=Package["ecmascript-runtime"].Symbol;var Map=Package["ecmascript-runtime"].Map;var Set=Package["ecmascript-runtime"].Set;var meteorBabelHelpers=Package["babel-runtime"].meteorBabelHelpers;var Promise=Package.promise.Promise;var require=meteorInstall({node_modules:{meteor:{"angular-meteor-auth":{dist:{"angular-meteor-auth.js":["babel-runtime/helpers/typeof",function(require,exports,module){var _typeof;module.import("babel-runtime/helpers/typeof",{default:function(v){_typeof=v}});(function(){function webpackUniversalModuleDefinition(root,factory){if((typeof exports==="undefined"?"undefined":_typeof(exports))==="object"&&(typeof module==="undefined"?"undefined":_typeof(module))==="object")module.exports=factory();else if(typeof define==="function"&&define.amd)define([],factory);else if((typeof exports==="undefined"?"undefined":_typeof(exports))==="object")exports["angularMeteorAuth"]=factory();else root["angularMeteorAuth"]=factory()}return webpackUniversalModuleDefinition})()(this,function(){return function(modules){var installedModules={};function __webpack_require__(moduleId){if(installedModules[moduleId])return installedModules[moduleId].exports;var module=installedModules[moduleId]={exports:{},id:moduleId,loaded:false};modules[moduleId].call(module.exports,module,module.exports,__webpack_require__);module.loaded=true;return module.exports}__webpack_require__.m=modules;__webpack_require__.c=installedModules;__webpack_require__.p="";return __webpack_require__(0)}([function(module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var name="angular-meteor.auth";exports["default"]=name;angular.module(name,["angular-meteor.mixer","angular-meteor.core","angular-meteor.view-model","angular-meteor.reactive"]).factory("$$Auth",["$Mixer",function($Mixer){var Accounts=(Package["accounts-base"]||{}).Accounts;if(!Accounts){throw Error("`angular-meteor.auth` module requires `accounts-base` package, "+"please run `meteor add accounts-base` before use")}var errors={required:"AUTH_REQUIRED",forbidden:"FORBIDDEN"};function $$Auth(){var vm=arguments.length<=0||arguments[0]===undefined?this:arguments[0];this.autorun(function(){vm.currentUser=Accounts.user();vm.currentUserId=Accounts.userId();vm.isLoggingIn=Accounts.loggingIn()})}$$Auth.$awaitUser=function(validate){var _this=this;validate=validate?this.$bindToContext($Mixer.caller,validate):function(){return true};if(!_.isFunction(validate)){throw Error("argument 1 must be a function")}var deferred=this.$$defer();var computation=this.autorun(function(computation){if(_this.getReactively("isLoggingIn"))return;computation.stop();if(!_this.currentUser)return _this.$$afterFlush(deferred.reject,errors.required);var isValid=validate(_this.currentUser);if(isValid===true)return _this.$$afterFlush(deferred.resolve,_this.currentUser);var error=void 0;if(_.isString(isValid)||isValid instanceof Error){error=isValid}else{error=errors.forbidden}return _this.$$afterFlush(deferred.reject,error)});var promise=deferred.promise;promise.stop=computation.stop.bind(computation);return promise};$$Auth.$$afterFlush=function(fn){var _fn;if(_.isString(fn)){fn=this[fn]}for(var _len=arguments.length,args=Array(_len>1?_len-1:0),_key=1;_key<_len;_key++){args[_key-1]=arguments[_key]}return Tracker.afterFlush((_fn=fn).bind.apply(_fn,[this].concat(args)))};$$Auth.$waitForUser=function(){return this.$awaitUser()["catch"]()};$$Auth.$requireUser=function(){return this.$awaitUser()};$$Auth.$requireValidUser=function(){return this.$awaitUser.apply(this,arguments)};return $$Auth}]).service("$auth",["$rootScope","$$Auth",function($rootScope,$$Auth){var _this2=this;_.keys($$Auth).forEach(function(k){var stripped=k.substr(1);_this2[stripped]=function(){return $rootScope[k].apply($rootScope,arguments)}})}]).run(["$Mixer","$$Auth",function($Mixer,$$Auth){$Mixer.mixin($$Auth)}]);module.exports=exports["default"]}])})}]}}}}},{extensions:[".js",".json"]});require("./node_modules/meteor/angular-meteor-auth/dist/angular-meteor-auth.js");if(typeof Package==="undefined")Package={};Package["angular-meteor-auth"]={}})(); |
@@ -1,2 +0,2 @@ | ||
/*! angular-meteor-auth v1.0.3 */ | ||
/*! angular-meteor-auth v1.1.0 */ | ||
(function webpackUniversalModuleDefinition(root, factory) { | ||
@@ -87,3 +87,3 @@ if(typeof exports === 'object' && typeof module === 'object') | ||
function $$Auth() { | ||
var vm = arguments.length <= 0 || arguments[0] === undefined ? this : arguments[0]; | ||
var vm = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this; | ||
@@ -117,2 +117,11 @@ // Reset auth properties | ||
// If user is already logged in resolve the promise immediately to prevent an | ||
// unnecessary computation | ||
if (this.currentUser) { | ||
deferred.resolve(this.currentUser); | ||
// Keep the schema of the promise consistent | ||
deferred.promise.stop = angular.noop; | ||
return deferred.promise; | ||
} | ||
// Note the promise is being fulfilled in the next event loop to avoid | ||
@@ -144,5 +153,4 @@ // nested computations, otherwise the outer computation will cancel the | ||
var promise = deferred.promise; | ||
promise.stop = computation.stop.bind(computation); | ||
return promise; | ||
deferred.promise.stop = computation.stop.bind(computation); | ||
return deferred.promise; | ||
}; | ||
@@ -149,0 +157,0 @@ |
@@ -1,3 +0,3 @@ | ||
/*! angular-meteor-auth v1.0.3 */ | ||
!function(r,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.angularMeteorAuth=e():r.angularMeteorAuth=e()}(this,function(){return function(r){function e(n){if(t[n])return t[n].exports;var o=t[n]={exports:{},id:n,loaded:!1};return r[n].call(o.exports,o,o.exports,e),o.loaded=!0,o.exports}var t={};return e.m=r,e.c=t,e.p="",e(0)}([function(r,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var t="angular-meteor.auth";e["default"]=t,angular.module(t,["angular-meteor.mixer","angular-meteor.scope","angular-meteor.core","angular-meteor.view-model","angular-meteor.reactive"]).factory("$$Auth",["$Mixer","$log",function(r,e){function t(){var r=arguments.length<=0||void 0===arguments[0]?this:arguments[0];this.autorun(function(){r.currentUser=Meteor.user(),r.currentUserId=Meteor.userId(),r.isLoggingIn=Meteor.loggingIn()})}var n=(Package["accounts-base"]||{}).Accounts;if(!n)throw Error("`angular-meteor.auth` module requires `accounts-base` package, please run `meteor add accounts-base` before use");var o={required:"AUTH_REQUIRED",forbidden:"FORBIDDEN"};return t.$awaitUser=function(e){var t=this;if(e=e?this.$bindToContext(r.caller,e):function(){return!0},!_.isFunction(e))throw Error("argument 1 must be a function");var n=this.$$defer(),u=this.autorun(function(r){if(!t.getReactively("isLoggingIn")){if(r.stop(),!t.currentUser)return t.$$afterFlush(n.reject,o.required);var u=e(t.currentUser);if(u===!0)return t.$$afterFlush(n.resolve,t.currentUser);var a=void 0;return a=_.isString(u)||u instanceof Error?u:o.forbidden,t.$$afterFlush(n.reject,a)}}),a=n.promise;return a.stop=u.stop.bind(u),a},t.$$afterFlush=function(r){var e;_.isString(r)&&(r=this[r]);for(var t=arguments.length,n=Array(t>1?t-1:0),o=1;t>o;o++)n[o-1]=arguments[o];return Tracker.afterFlush((e=r).bind.apply(e,[this].concat(n)))},t.$waitForUser=function(){return this.$awaitUser()["catch"](function(r){e.debug("user login has failed ("+r+")")})},t.$requireUser=function(){return this.$awaitUser()},t.$requireValidUser=function(){return this.$awaitUser.apply(this,arguments)},t}]).service("$auth",["$rootScope","$$Auth",function(r,e){var t=this;_.keys(e).forEach(function(e){var n=e.substr(1);t[n]=function(){return r[e].apply(r,arguments)}})}]).run(["$Mixer","$$Auth",function(r,e){r.mixin(e)}]),r.exports=e["default"]}])}); | ||
/*! angular-meteor-auth v1.1.0 */ | ||
!function(r,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.angularMeteorAuth=e():r.angularMeteorAuth=e()}(this,function(){return function(r){function e(n){if(t[n])return t[n].exports;var o=t[n]={exports:{},id:n,loaded:!1};return r[n].call(o.exports,o,o.exports,e),o.loaded=!0,o.exports}var t={};return e.m=r,e.c=t,e.p="",e(0)}([function(r,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var t="angular-meteor.auth";e.default=t,angular.module(t,["angular-meteor.mixer","angular-meteor.scope","angular-meteor.core","angular-meteor.view-model","angular-meteor.reactive"]).factory("$$Auth",["$Mixer","$log",function(r,e){function t(){var r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this;this.autorun(function(){r.currentUser=Meteor.user(),r.currentUserId=Meteor.userId(),r.isLoggingIn=Meteor.loggingIn()})}var n=(Package["accounts-base"]||{}).Accounts;if(!n)throw Error("`angular-meteor.auth` module requires `accounts-base` package, please run `meteor add accounts-base` before use");var o={required:"AUTH_REQUIRED",forbidden:"FORBIDDEN"};return t.$awaitUser=function(e){var t=this;if(e=e?this.$bindToContext(r.caller,e):function(){return!0},!_.isFunction(e))throw Error("argument 1 must be a function");var n=this.$$defer();if(this.currentUser)return n.resolve(this.currentUser),n.promise.stop=angular.noop,n.promise;var u=this.autorun(function(r){if(!t.getReactively("isLoggingIn")){if(r.stop(),!t.currentUser)return t.$$afterFlush(n.reject,o.required);var u=e(t.currentUser);if(u===!0)return t.$$afterFlush(n.resolve,t.currentUser);var i=void 0;return i=_.isString(u)||u instanceof Error?u:o.forbidden,t.$$afterFlush(n.reject,i)}});return n.promise.stop=u.stop.bind(u),n.promise},t.$$afterFlush=function(r){var e;_.isString(r)&&(r=this[r]);for(var t=arguments.length,n=Array(t>1?t-1:0),o=1;o<t;o++)n[o-1]=arguments[o];return Tracker.afterFlush((e=r).bind.apply(e,[this].concat(n)))},t.$waitForUser=function(){return this.$awaitUser().catch(function(r){e.debug("user login has failed ("+r+")")})},t.$requireUser=function(){return this.$awaitUser()},t.$requireValidUser=function(){return this.$awaitUser.apply(this,arguments)},t}]).service("$auth",["$rootScope","$$Auth",function(r,e){var t=this;_.keys(e).forEach(function(e){var n=e.substr(1);t[n]=function(){return r[e].apply(r,arguments)}})}]).run(["$Mixer","$$Auth",function(r,e){r.mixin(e)}]),r.exports=e.default}])}); | ||
//# sourceMappingURL=angular-meteor-auth.min.js.map |
{ | ||
"name": "angular-meteor-auth", | ||
"main": "./dist/angular-meteor-auth.js", | ||
"version": "1.0.3", | ||
"version": "1.1.0", | ||
"description": "Angular-Meteor authentication module", | ||
@@ -6,0 +6,0 @@ "keywords": [ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
434
78208
14