From 1a239bdefe6394cb962bfb0e8e3f04f5efcbf724 Mon Sep 17 00:00:00 2001 From: Timothy Date: Mon, 23 Nov 2015 17:04:03 +0100 Subject: [PATCH 1/3] should export 'stormpath', not 'ui.router' --- Gruntfile.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gruntfile.js b/Gruntfile.js index c16b042..7e93452 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -31,7 +31,7 @@ module.exports = function (grunt) { banner: '<%= meta.banner %>\n\n'+ '/* commonjs package manager support (eg componentjs) */\n'+ 'if (typeof module !== "undefined" && typeof exports !== "undefined" && module.exports === exports){\n'+ - ' module.exports = \'ui.router\';\n'+ + ' module.exports = \'stormpath\';\n'+ '}\n\n'+ '(function (window, angular, undefined) {\n', footer: '})(window, window.angular);' From bbb87263815cf1c3764c5ab9468888064e8f9778 Mon Sep 17 00:00:00 2001 From: Timothy Date: Mon, 23 Nov 2015 17:13:14 +0100 Subject: [PATCH 2/3] release 0.8.2 --- CHANGELOG.md | 4 ++++ bower.json | 2 +- dist/stormpath-sdk-angularjs.js | 4 ++-- dist/stormpath-sdk-angularjs.min.js | 4 ++-- dist/stormpath-sdk-angularjs.tpls.min.js | 2 +- package.json | 2 +- 6 files changed, 11 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fe148a7..56c83c2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +# 0.8.2 + +* Bug fixed: `stormpath-sdk-angularjs` now exports 'stormpath' instead of 'ui.router' + # 0.8.1 * Fixed bug that displayed social login titles without any social login providers diff --git a/bower.json b/bower.json index bb3ac03..de0c251 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "stormpath-sdk-angularjs", - "version": "0.8.1", + "version": "0.8.2", "main": [ "dist/stormpath-sdk-angularjs.min.js", "dist/stormpath-sdk-angularjs.tpls.min.js" diff --git a/dist/stormpath-sdk-angularjs.js b/dist/stormpath-sdk-angularjs.js index a22b192..90f220a 100644 --- a/dist/stormpath-sdk-angularjs.js +++ b/dist/stormpath-sdk-angularjs.js @@ -2,14 +2,14 @@ * stormpath-sdk-angularjs * Copyright Stormpath, Inc. 2015 * - * @version v0.8.1-dev-2015-11-20 + * @version v0.8.2-dev-2015-11-23 * @link https://github.com/stormpath/stormpath-sdk-angularjs * @license Apache-2.0 */ /* commonjs package manager support (eg componentjs) */ if (typeof module !== "undefined" && typeof exports !== "undefined" && module.exports === exports){ - module.exports = 'ui.router'; + module.exports = 'stormpath'; } (function (window, angular, undefined) { diff --git a/dist/stormpath-sdk-angularjs.min.js b/dist/stormpath-sdk-angularjs.min.js index 93567d1..ac87fa0 100644 --- a/dist/stormpath-sdk-angularjs.min.js +++ b/dist/stormpath-sdk-angularjs.min.js @@ -2,8 +2,8 @@ * stormpath-sdk-angularjs * Copyright Stormpath, Inc. 2015 * - * @version v0.8.1-dev-2015-11-20 + * @version v0.8.2-dev-2015-11-23 * @link https://github.com/stormpath/stormpath-sdk-angularjs * @license Apache-2.0 */ -"undefined"!=typeof module&&"undefined"!=typeof exports&&module.exports===exports&&(module.exports="ui.router"),function(a,b,c){"use strict";b.module("stormpath",["stormpath.CONFIG","stormpath.auth","stormpath.userService","stormpath.socialLogin","stormpath.facebookLogin","stormpath.googleLogin"]).factory("SpAuthInterceptor",[function(){function a(){}return a.prototype.request=function(a){return a.withCredentials=!0,a},new a}]).config(["$httpProvider",function(a){a.interceptors.push("SpAuthInterceptor")}]).provider("$stormpath",[function(){this.$get=["$user","$state","STORMPATH_CONFIG","$rootScope",function(a,b,c,d){function e(){var a=new i;return this.encodeUrlForm=a.encode.bind(a),this}function f(a,b){d.$broadcast(c.STATE_CHANGE_UNAUTHENTICATED,a,b)}function g(a,b){d.$broadcast(c.STATE_CHANGE_UNAUTHORIZED,a,b)}function h(b){var c=b;return c&&c.authorize&&c.authorize.group?a.currentUser.inGroup(c.authorize.group):(console.error("Unknown authorize configuration for spStateConfig",b),!1)}function i(){return this.delimiter="&",this.arrayPrefixGenerators={brackets:function(a){return a+"[]"},indices:function(a,b){return a+"["+b+"]"},repeat:function(a){return a}},this}return e.prototype.stateChangeInterceptor=function(c){d.$on("$stateChangeStart",function(d,e,i){var j=e.sp||{};!j.authenticate&&!j.authorize||a.currentUser?j.waitForUser&&null===a.currentUser?(d.preventDefault(),a.get()["finally"](function(){b.go(e.name,i)})):a.currentUser&&j.authorize?h(j)||(d.preventDefault(),g(e,i)):e.name===c.loginState&&a.currentUser&&a.currentUser.href&&(d.preventDefault(),b.go(c.defaultPostLoginState)):(d.preventDefault(),a.get().then(function(){j.authorize?h(j)?b.go(e.name,i):g(e,i):b.go(e.name,i)},function(){f(e,i)}))})},e.prototype.uiRouter=function(a){var e=this;a="object"==typeof a?a:{},this.stateChangeInterceptor(a),a.loginState&&(e.unauthenticatedWather=d.$on(c.STATE_CHANGE_UNAUTHENTICATED,function(c,d,f){e.postLogin={toState:d,toParams:f},b.go(a.loginState)})),d.$on(c.AUTHENTICATION_SUCCESS_EVENT_NAME,function(){e.postLogin&&a.autoRedirect!==!1?b.go(e.postLogin.toState,e.postLogin.toParams).then(function(){e.postLogin=null}):a.defaultPostLoginState&&b.go(a.defaultPostLoginState)}),a.forbiddenState&&(e.forbiddenWatcher=d.$on(c.STATE_CHANGE_UNAUTHORIZED,function(){b.go(a.forbiddenState)}))},e.prototype.regexAttrParser=function(a){var b;return b=a instanceof RegExp?a:a&&/^\/.+\/[gim]?$/.test(a)?new RegExp(a.split("/")[1],a.split("/")[2]):a},i.prototype.stringify=function(a,b,c){if(a instanceof Date?a=a.toISOString():null===a&&(a=""),"string"==typeof a||"number"==typeof a||"boolean"==typeof a)return[encodeURIComponent(b)+"="+encodeURIComponent(a)];var d=[];if("undefined"==typeof a)return d;for(var e=Object.keys(a),f=0,g=e.length;g>f;++f){var h=e[f];d=Array.isArray(a)?d.concat(this.stringify(a[h],c(b,h),c)):d.concat(this.stringify(a[h],b+"["+h+"]",c))}return d},i.prototype.encode=function(a,b){b=b||{};var c="undefined"==typeof b.delimiter?this.delimiter:b.delimiter,d=[];if("object"!=typeof a||null===a)return"";var e;e=b.arrayFormat in this.arrayPrefixGenerators?b.arrayFormat:"indices"in b?b.indices?"indices":"repeat":"indices";for(var f=this.arrayPrefixGenerators[e],g=Object.keys(a),h=0,i=g.length;i>h;++h){var j=g[h];d=d.concat(this.stringify(a[j],j,f))}return d.join(c)},new e}]}]).run(["$rootScope","$user","STORMPATH_CONFIG",function(a,b,c){a.user=b.currentUser||null,b.get()["finally"](function(){a.user=b.currentUser}),a.$on(c.GET_USER_EVENT,function(){a.user=b.currentUser}),a.$on(c.SESSION_END_EVENT,function(){a.user=b.currentUser})}]).directive("ifUser",["$user","$rootScope",function(a,b){return{link:function(a,c){b.$watch("user",function(a){a&&a.href?c.removeClass("ng-hide"):c.addClass("ng-hide")})}}}]).directive("ifNotUser",["$user","$rootScope",function(a,b){return{link:function(a,c){b.$watch("user",function(a){a&&a.href?c.addClass("ng-hide"):c.removeClass("ng-hide")})}}}]).directive("ifUserInGroup",["$user","$rootScope","$parse","$stormpath",function(a,b,c,d){return{link:function(e,f,g){function h(){var b=a.currentUser;b&&b.groupTest(i||j)?f.removeClass("ng-hide"):f.addClass("ng-hide")}var i,j=g.ifUserInGroup;j&&(e.$watch(c(j),function(a){i=d.regexAttrParser(a),h()}),b.$watch("user",function(){h()}))}}}]).directive("ifUserNotInGroup",["$user","$rootScope","$parse","$stormpath",function(a,b,c,d){return{link:function(e,f,g){function h(){var b=a.currentUser;b&&b.groupTest(i||j)?f.addClass("ng-hide"):f.removeClass("ng-hide")}var i,j=g.ifUserNotInGroup;j&&(e.$watch(c(j),function(a){i=d.regexAttrParser(a),h()}),b.$watch("user",function(){h()}))}}}]).directive("whileResolvingUser",["$user","$rootScope",function(a,b){return{link:function(c,d){b.$watch("user",function(){a.currentUser||a.currentUser===!1?d.addClass("ng-hide"):d.removeClass("ng-hide")})}}}]).directive("ifUserStateKnown",["$user","$rootScope",function(a,b){return{link:function(c,d){b.$watch("user",function(){a.currentUser||a.currentUser===!1?d.removeClass("ng-hide"):d.addClass("ng-hide")})}}}]).directive("ifUserStateUnknown",["$user","$rootScope",function(a,b){return{link:function(c,d){b.$watch("user",function(){null===a.currentUser?d.removeClass("ng-hide"):d.addClass("ng-hide")})}}}]).directive("spLogout",["$auth",function(a){return{link:function(b,c){c.on("click",function(){a.endSession()})}}}]),b.module("stormpath.auth",["stormpath.CONFIG"]).config(["$injector","STORMPATH_CONFIG",function(a,b){var c={$get:["$http","$user","$rootScope","$spFormEncoder",function(a,c,d,e){function f(){return this}function g(){d.$broadcast(b.SESSION_END_EVENT)}function h(){return c.get()}function i(a){d.$broadcast(b.AUTHENTICATION_SUCCESS_EVENT_NAME,a)}function j(a){d.$broadcast(b.AUTHENTICATION_FAILURE_EVENT_NAME,a)}return f.prototype.authenticate=function(c){var d=a(e.formPost({url:b.getUrl("AUTHENTICATION_ENDPOINT"),method:"POST",withCredentials:!0,data:c})),f=d.then(h).then(i);return d["catch"](j),f},f.prototype.endSession=function(){var c=a.get(b.getUrl("DESTROY_SESSION_ENDPOINT"),{headers:{Accept:"application/json"}});return c.then(function(){g()},function(a){console.error("logout error",a)}),c},new f}]};a.get("$provide").provider(b.AUTH_SERVICE_NAME,c)}]),b.module("stormpath.CONFIG",[]).constant("STORMPATH_CONFIG",function(){var a={AUTHENTICATION_SUCCESS_EVENT_NAME:"$authenticated",AUTHENTICATION_FAILURE_EVENT_NAME:"$authenticationFailure",AUTH_SERVICE_NAME:"$auth",SOCIAL_LOGIN_SERVICE_NAME:"$socialLogin",AUTHENTICATION_ENDPOINT:"/login",CURRENT_USER_URI:"/me",DESTROY_SESSION_ENDPOINT:"/logout",EMAIL_VERIFICATION_ENDPOINT:"/verify",SPA_CONFIG_ENDPOINT:"/spa-config",ENDPOINT_PREFIX:"",FORM_CONTENT_TYPE:"application/x-www-form-urlencoded",GET_USER_EVENT:"$currentUser",NOT_LOGGED_IN_EVENT:"$notLoggedin",FORGOT_PASSWORD_ENDPOINT:"/forgot",CHANGE_PASSWORD_ENDPOINT:"/change",SESSION_END_EVENT:"$sessionEnd",STATE_CHANGE_UNAUTHENTICATED:"$stateChangeUnauthenticated",STATE_CHANGE_UNAUTHORIZED:"$stateChangeUnauthorized",REGISTER_URI:"/register",REGISTERED_EVENT_NAME:"$registered"};return a.getUrl=function(a){return this.ENDPOINT_PREFIX+this[a]},a}()),b.module("stormpath").controller("SpEmailVerificationCtrl",["$scope","$location","$user",function(a,b,c){a.showVerificationError=!1,a.verifying=!1,a.reVerificationSent=!1,a.needsReVerification=!1,a.resendFailed=!1,a.formModel={username:""},b.search().sptoken?(a.verifying=!0,c.verify(b.search().sptoken).then(function(){a.verified=!0})["catch"](function(){a.needsReVerification=!0,a.showVerificationError=!0})["finally"](function(){a.verifying=!1})):(a.needsReVerification=!0,a.showVerificationError=!0),a.submit=function(){a.posting=!0,a.resendFailed=!1,a.showVerificationError=!1,c.resendVerificationEmail({login:a.formModel.username}).then(function(){a.reVerificationSent=!0})["catch"](function(){a.resendFailed=!0})["finally"](function(){a.posting=!1})}}]).directive("spEmailVerification",function(){return{templateUrl:function(a,b){return b.templateUrl||"spEmailVerification.tpl.html"},controller:"SpEmailVerificationCtrl"}}),b.module("stormpath").provider("$spFormEncoder",[function(){this.$get=["STORMPATH_CONFIG",function(a){function b(){var a=new c;return this.encodeUrlForm=a.encode.bind(a),this}function c(){return this.delimiter="&",this.arrayPrefixGenerators={brackets:function(a){return a+"[]"},indices:function(a,b){return a+"["+b+"]"},repeat:function(a){return a}},this}return b.prototype.formPost=function(b){if("application/x-www-form-urlencoded"===a.FORM_CONTENT_TYPE){var c=b.headers?b.headers:b.headers={};c["Content-Type"]=a.FORM_CONTENT_TYPE,b.data=this.encodeUrlForm(b.data)}return b},c.prototype.stringify=function(a,b,c){if(a instanceof Date?a=a.toISOString():null===a&&(a=""),"string"==typeof a||"number"==typeof a||"boolean"==typeof a)return[encodeURIComponent(b)+"="+encodeURIComponent(a)];var d=[];if("undefined"==typeof a)return d;for(var e=Object.keys(a),f=0,g=e.length;g>f;++f){var h=e[f];d=Array.isArray(a)?d.concat(this.stringify(a[h],c(b,h),c)):d.concat(this.stringify(a[h],b+"["+h+"]",c))}return d},c.prototype.encode=function(a,b){b=b||{};var c="undefined"==typeof b.delimiter?this.delimiter:b.delimiter,d=[];if("object"!=typeof a||null===a)return"";var e;e=b.arrayFormat in this.arrayPrefixGenerators?b.arrayFormat:"indices"in b?b.indices?"indices":"repeat":"indices";for(var f=this.arrayPrefixGenerators[e],g=Object.keys(a),h=0,i=g.length;i>h;++h){var j=g[h];d=d.concat(this.stringify(a[j],j,f))}return d.join(c)},new b}]}]),b.module("stormpath").controller("SpLoginFormCtrl",["$scope","$auth","$socialLogin",function(a,b,c){a.socialLoginProviders=[],c.getProviders().then(function(b){a.socialLoginProviders=Object.keys(b).map(function(a){var c=b[a];return c.name=a,c}),a.socialLoginProviders=a.socialLoginProviders.filter(function(a){return a.enabled})})["catch"](function(a){throw new Error("Could not load social providers from back-end: "+a.message)}),a.formModel={username:"",password:""},a.posting=!1,a.submit=function(){a.posting=!0,a.error=null,b.authenticate(a.formModel)["catch"](function(b){a.posting=!1,a.error=b.data&&b.data.error||"An error occured when communicating with server."})}}]).directive("spLoginForm",function(){return{templateUrl:function(a,b){return b.templateUrl||"spLoginForm.tpl.html"},controller:"SpLoginFormCtrl"}}),b.module("stormpath").controller("SpPasswordResetRequestCtrl",["$scope","$user",function(a,b){a.sent=!1,a.posting=!1,a.formModel={username:""},a.requestFailed=!1,a.submit=function(){a.posting=!0,a.requestFailed=!1,b.passwordResetRequest({email:a.formModel.email}).then(function(){a.sent=!0})["catch"](function(){a.requestFailed=!0})["finally"](function(){a.posting=!1})}}]).controller("SpPasswordResetCtrl",["$scope","$location","$user",function(a,b,c){var d=b.search().sptoken;a.showVerificationError=!1,a.verifying=!1,a.verified=!1,a.posting=!1,a.reset=!1,a.error=null,a.resendFailed=!1,a.formModel={password:"",confirmPassword:""},"string"==typeof d?(a.verifying=!0,c.verifyPasswordResetToken(d).then(function(){a.verified=!0})["catch"](function(){a.showVerificationError=!0})["finally"](function(){a.verifying=!1})):a.showVerificationError=!0,a.submit=function(){return a.formModel.password!==a.formModel.confirmPassword?void(a.error="Passwords do not match"):(a.posting=!0,a.error=null,a.showVerificationError=!1,void c.resetPassword(d,{password:a.formModel.password}).then(function(){a.reset=!0})["catch"](function(b){a.error=b.data.error})["finally"](function(){a.posting=!1}))}}]).directive("spPasswordResetRequestForm",function(){return{templateUrl:function(a,b){return b.templateUrl||"spPasswordResetRequestForm.tpl.html"},controller:"SpPasswordResetRequestCtrl"}}).directive("spPasswordResetForm",function(){return{templateUrl:function(a,b){return b.templateUrl||"spPasswordResetForm.tpl.html"},controller:"SpPasswordResetCtrl"}}),b.module("stormpath").controller("SpRegistrationFormCtrl",["$scope","$user","$auth","$location","$socialLogin",function(a,b,c,d,e){a.formModel="object"==typeof a.formModel?a.formModel:{givenName:"",surname:"",email:"",password:""},a.created=!1,a.enabled=!1,a.creating=!1,a.authenticating=!1,a.socialLoginProviders=[],e.getProviders().then(function(b){a.socialLoginProviders=Object.keys(b).map(function(a){var c=b[a];return c.name=a,c}),a.socialLoginProviders=a.socialLoginProviders.filter(function(a){return a.enabled})})["catch"](function(a){throw new Error("Could not load social providers from back-end: "+a.message)}),a.submit=function(){a.creating=!0,a.error=null,b.create(a.formModel).then(function(b){a.created=!0,a.enabled="ENABLED"===b.status,a.enabled&&a.autoLogin?(a.authenticating=!0,c.authenticate({username:a.formModel.email,password:a.formModel.password}).then(function(){a.postLoginPath&&d.path(a.postLoginPath)})["catch"](function(b){a.error=b.data.error})["finally"](function(){a.authenticating=!1,a.creating=!1})):a.creating=!1})["catch"](function(b){a.creating=!1,a.error=b.data.error})}}]).directive("spRegistrationForm",function(){return{templateUrl:function(a,b){return b.templateUrl||"spRegistrationForm.tpl.html"},controller:"SpRegistrationFormCtrl",link:function(a,b,c){a.autoLogin="true"===c.autoLogin,a.postLoginState=c.postLoginState||""}}}),function(){function c(a,b){switch(b.status){case"connected":a.resolve({providerData:{providerId:"facebook",accessToken:b.authResponse.accessToken}});break;case"not_authorized":a.reject(new Error("Please log into this app"));break;default:a.reject(new Error("Please log into Facebook."))}}function d(a,b){this.name="Facebook",this.clientId=null,this.$q=a,this.$spJsLoader=b}d.prototype.init=function(){var b=this.clientId;a.fbAsyncInit=function(){FB.init({appId:b,status:!0,cookie:!0,xfbml:!0,version:"v2.4"})},a.FB?a.fbAsyncInit():this.$spJsLoader.load("facebook-jssdk","//connect.facebook.net/en_US/sdk.js")},d.prototype.login=function(a){var b=this.$q.defer();return FB.login(c.bind(null,b),a),b.promise},b.module("stormpath.facebookLogin",[]).provider("$facebookLogin",function(){this.$get=["$q","$spJsLoader",function(a,b){return new d(a,b)}]})}(),function(){function a(a,b){this.name="Google",this.clientId=null,this.googleAuth=null,this.$q=a,this.$spJsLoader=b}a.prototype.setGoogleAuth=function(a){this.googleAuth=a},a.prototype.init=function(a){var b=this.clientId,c=this.setGoogleAuth.bind(this);this.$spJsLoader.load("google-jssdk","//apis.google.com/js/api:client.js").then(function(){gapi.load("auth2",function(){var a=gapi.auth2.init({client_id:b,cookiepolicy:"single_host_origin"});c(a)})})},a.prototype.login=function(a){var b=this.$q.defer();return a=a||{},a.redirect_uri="postmessage",this.googleAuth.grantOfflineAccess(a).then(function(a){b.resolve({providerData:{providerId:"google",code:a.code}})},function(a){b.reject(a)}),b.promise},b.module("stormpath.googleLogin",[]).provider("$googleLogin",function(){this.$get=["$q","$spJsLoader",function(b,c){return new a(b,c)}]})}(),function(){function a(a,b,c,d){this.providersPromise=null,this.STORMPATH_CONFIG=a,this.$injector=b,this.$http=c,this.$q=d}a.prototype.initProviders=function(a){var b=this.$injector;Object.keys(a).forEach(function(c){var d,e=a[c];try{d=b.get("$"+c+"Login")}catch(f){return void delete a[c]}d.clientId=e.clientId,a[c].service=d})},a.prototype.getProviders=function(){var a=this.providersPromise,b=this.initProviders.bind(this);return a?a.promise:(a=this.$q.defer(),this.providersPromise=a,this.$http.get(this.STORMPATH_CONFIG.getUrl("SPA_CONFIG_ENDPOINT")).then(function(c){var d;d=c.data&&"object"==typeof c.data?c.data.socialProviders:{},b(d),a.resolve(d)})["catch"](a.reject),a.promise)},b.module("stormpath.socialLogin",["stormpath.CONFIG"]).config(["$injector","STORMPATH_CONFIG",function(b,c){var d=["$http","$q","$injector",function(b,d,e){return new a(c,e,b,d)}];b.get("$provide").factory(c.SOCIAL_LOGIN_SERVICE_NAME,d)}]).factory("$spJsLoader",["$q",function(a){return{load:function(b,c,d){var e=a.defer(),f=document.getElementsByTagName("script")[0],g=document.createElement("script");return document.getElementById(b)?e.resolve():(g.id=b,g.src=c,g.innerHTML=d,g.onload=e.resolve,f.parentNode.insertBefore(g,f)),e.promise}}}]).directive("spSocialLogin",["$socialLogin","$auth",function(a,b){return{link:function(c,d,e){var f,g=c.$parent;a.getProviders().then(function(a){var b=a[e.spSocialLogin];b&&b.service&&(f=b.service,f.init(d))}),d.bind("click",function(){var a={scope:e.spScope};g.posting=!0,f.login(a).then(function(a){return b.authenticate(a)})["catch"](function(a){g.posting=!1,a.message?g.error=a.message:a.data&&a.data.error?g.error=a.data.error:g.error="An error occured when communicating with server."})})}}}])}(),function(){function a(a){return"api_key: "+a+"\nauthorize: true"}function c(b,c){var d=a(c);b.load("linkedin-jssdk","//platform.linkedin.com/in.js",d)}function d(a,b){this.name="LinkedIn",this.clientId=null,this.$q=a,this.$spJsLoader=b}d.prototype.init=function(a){c(this.$spJsLoader,this.clientId)},d.prototype.login=function(a){var b=this.$q.defer();return IN.User.authorize(function(){b.resolve({providerData:{providerId:"linkedin",accessToken:IN.ENV.auth.oauth_token}})}),b.promise},b.module("stormpath.linkedinLogin",[]).provider("$linkedinLogin",function(){this.$get=["$q","$spJsLoader",function(a,b){return new d(a,b)}]})}(),b.module("stormpath.userService",["stormpath.CONFIG"]).provider("$user",[function(){function a(a){var b=this;Object.keys(a).map(function(c){b[c]=a[c]})}a.prototype.inGroup=function(a){return this.groups.items.filter(function(b){return b.name===a}).length>0},a.prototype.matchesGroupExpression=function(a){return this.groups.items.filter(function(b){return a.test(b.name)}).length>0},a.prototype.groupTest=function(a){return a instanceof RegExp&&this.matchesGroupExpression(a)?!0:this.inGroup(a)?!0:!1},this.$get=["$q","$http","STORMPATH_CONFIG","$rootScope","$spFormEncoder",function(b,c,d,e,f){function g(){return this.cachedUserOp=null,this.currentUser=null,this}function h(a){e.$broadcast(d.REGISTERED_EVENT_NAME,a)}function i(a){e.$broadcast(d.GET_USER_EVENT,a)}function j(){e.$broadcast(d.NOT_LOGGED_IN_EVENT)}g.prototype.create=function(a){var e=b.defer();return c(f.formPost({url:d.getUrl("REGISTER_URI"),method:"POST",data:a})).then(function(a){e.resolve(a.data),h(a.data)},e.reject),e.promise},g.prototype.get=function(){var e=b.defer(),f=this;return f.cachedUserOp?f.cachedUserOp.promise:null!==f.currentUser&&f.currentUser!==!1?(e.resolve(f.currentUser),e.promise):(f.cachedUserOp=e,c.get(d.getUrl("CURRENT_USER_URI"),{withCredentials:!0}).then(function(b){f.cachedUserOp=null,f.currentUser=new a(b.data),i(f.currentUser),e.resolve(f.currentUser)},function(a){f.currentUser=!1,401===a.status&&j(),f.cachedUserOp=null,e.reject(a)}),e.promise)},g.prototype.resendVerificationEmail=function(a){return c({method:"POST",url:d.getUrl("EMAIL_VERIFICATION_ENDPOINT"),data:a})},g.prototype.verify=function(a){return c({url:d.getUrl("EMAIL_VERIFICATION_ENDPOINT")+"?sptoken="+a})},g.prototype.verifyPasswordResetToken=function(a){return c.get(d.getUrl("CHANGE_PASSWORD_ENDPOINT")+"?sptoken="+a)},g.prototype.passwordResetRequest=function(a){return c(f.formPost({method:"POST",url:d.getUrl("FORGOT_PASSWORD_ENDPOINT"),data:a}))},g.prototype.resetPassword=function(a,b){return b.sptoken=a,c(f.formPost({method:"POST",url:d.getUrl("CHANGE_PASSWORD_ENDPOINT"),data:b}))};var k=new g;return e.$on(d.SESSION_END_EVENT,function(){k.currentUser=!1}),k}]}])}(window,window.angular); \ No newline at end of file +"undefined"!=typeof module&&"undefined"!=typeof exports&&module.exports===exports&&(module.exports="stormpath"),function(a,b,c){"use strict";b.module("stormpath",["stormpath.CONFIG","stormpath.auth","stormpath.userService","stormpath.socialLogin","stormpath.facebookLogin","stormpath.googleLogin"]).factory("SpAuthInterceptor",[function(){function a(){}return a.prototype.request=function(a){return a.withCredentials=!0,a},new a}]).config(["$httpProvider",function(a){a.interceptors.push("SpAuthInterceptor")}]).provider("$stormpath",[function(){this.$get=["$user","$state","STORMPATH_CONFIG","$rootScope",function(a,b,c,d){function e(){var a=new i;return this.encodeUrlForm=a.encode.bind(a),this}function f(a,b){d.$broadcast(c.STATE_CHANGE_UNAUTHENTICATED,a,b)}function g(a,b){d.$broadcast(c.STATE_CHANGE_UNAUTHORIZED,a,b)}function h(b){var c=b;return c&&c.authorize&&c.authorize.group?a.currentUser.inGroup(c.authorize.group):(console.error("Unknown authorize configuration for spStateConfig",b),!1)}function i(){return this.delimiter="&",this.arrayPrefixGenerators={brackets:function(a){return a+"[]"},indices:function(a,b){return a+"["+b+"]"},repeat:function(a){return a}},this}return e.prototype.stateChangeInterceptor=function(c){d.$on("$stateChangeStart",function(d,e,i){var j=e.sp||{};!j.authenticate&&!j.authorize||a.currentUser?j.waitForUser&&null===a.currentUser?(d.preventDefault(),a.get()["finally"](function(){b.go(e.name,i)})):a.currentUser&&j.authorize?h(j)||(d.preventDefault(),g(e,i)):e.name===c.loginState&&a.currentUser&&a.currentUser.href&&(d.preventDefault(),b.go(c.defaultPostLoginState)):(d.preventDefault(),a.get().then(function(){j.authorize?h(j)?b.go(e.name,i):g(e,i):b.go(e.name,i)},function(){f(e,i)}))})},e.prototype.uiRouter=function(a){var e=this;a="object"==typeof a?a:{},this.stateChangeInterceptor(a),a.loginState&&(e.unauthenticatedWather=d.$on(c.STATE_CHANGE_UNAUTHENTICATED,function(c,d,f){e.postLogin={toState:d,toParams:f},b.go(a.loginState)})),d.$on(c.AUTHENTICATION_SUCCESS_EVENT_NAME,function(){e.postLogin&&a.autoRedirect!==!1?b.go(e.postLogin.toState,e.postLogin.toParams).then(function(){e.postLogin=null}):a.defaultPostLoginState&&b.go(a.defaultPostLoginState)}),a.forbiddenState&&(e.forbiddenWatcher=d.$on(c.STATE_CHANGE_UNAUTHORIZED,function(){b.go(a.forbiddenState)}))},e.prototype.regexAttrParser=function(a){var b;return b=a instanceof RegExp?a:a&&/^\/.+\/[gim]?$/.test(a)?new RegExp(a.split("/")[1],a.split("/")[2]):a},i.prototype.stringify=function(a,b,c){if(a instanceof Date?a=a.toISOString():null===a&&(a=""),"string"==typeof a||"number"==typeof a||"boolean"==typeof a)return[encodeURIComponent(b)+"="+encodeURIComponent(a)];var d=[];if("undefined"==typeof a)return d;for(var e=Object.keys(a),f=0,g=e.length;g>f;++f){var h=e[f];d=Array.isArray(a)?d.concat(this.stringify(a[h],c(b,h),c)):d.concat(this.stringify(a[h],b+"["+h+"]",c))}return d},i.prototype.encode=function(a,b){b=b||{};var c="undefined"==typeof b.delimiter?this.delimiter:b.delimiter,d=[];if("object"!=typeof a||null===a)return"";var e;e=b.arrayFormat in this.arrayPrefixGenerators?b.arrayFormat:"indices"in b?b.indices?"indices":"repeat":"indices";for(var f=this.arrayPrefixGenerators[e],g=Object.keys(a),h=0,i=g.length;i>h;++h){var j=g[h];d=d.concat(this.stringify(a[j],j,f))}return d.join(c)},new e}]}]).run(["$rootScope","$user","STORMPATH_CONFIG",function(a,b,c){a.user=b.currentUser||null,b.get()["finally"](function(){a.user=b.currentUser}),a.$on(c.GET_USER_EVENT,function(){a.user=b.currentUser}),a.$on(c.SESSION_END_EVENT,function(){a.user=b.currentUser})}]).directive("ifUser",["$user","$rootScope",function(a,b){return{link:function(a,c){b.$watch("user",function(a){a&&a.href?c.removeClass("ng-hide"):c.addClass("ng-hide")})}}}]).directive("ifNotUser",["$user","$rootScope",function(a,b){return{link:function(a,c){b.$watch("user",function(a){a&&a.href?c.addClass("ng-hide"):c.removeClass("ng-hide")})}}}]).directive("ifUserInGroup",["$user","$rootScope","$parse","$stormpath",function(a,b,c,d){return{link:function(e,f,g){function h(){var b=a.currentUser;b&&b.groupTest(i||j)?f.removeClass("ng-hide"):f.addClass("ng-hide")}var i,j=g.ifUserInGroup;j&&(e.$watch(c(j),function(a){i=d.regexAttrParser(a),h()}),b.$watch("user",function(){h()}))}}}]).directive("ifUserNotInGroup",["$user","$rootScope","$parse","$stormpath",function(a,b,c,d){return{link:function(e,f,g){function h(){var b=a.currentUser;b&&b.groupTest(i||j)?f.addClass("ng-hide"):f.removeClass("ng-hide")}var i,j=g.ifUserNotInGroup;j&&(e.$watch(c(j),function(a){i=d.regexAttrParser(a),h()}),b.$watch("user",function(){h()}))}}}]).directive("whileResolvingUser",["$user","$rootScope",function(a,b){return{link:function(c,d){b.$watch("user",function(){a.currentUser||a.currentUser===!1?d.addClass("ng-hide"):d.removeClass("ng-hide")})}}}]).directive("ifUserStateKnown",["$user","$rootScope",function(a,b){return{link:function(c,d){b.$watch("user",function(){a.currentUser||a.currentUser===!1?d.removeClass("ng-hide"):d.addClass("ng-hide")})}}}]).directive("ifUserStateUnknown",["$user","$rootScope",function(a,b){return{link:function(c,d){b.$watch("user",function(){null===a.currentUser?d.removeClass("ng-hide"):d.addClass("ng-hide")})}}}]).directive("spLogout",["$auth",function(a){return{link:function(b,c){c.on("click",function(){a.endSession()})}}}]),b.module("stormpath.auth",["stormpath.CONFIG"]).config(["$injector","STORMPATH_CONFIG",function(a,b){var c={$get:["$http","$user","$rootScope","$spFormEncoder",function(a,c,d,e){function f(){return this}function g(){d.$broadcast(b.SESSION_END_EVENT)}function h(){return c.get()}function i(a){d.$broadcast(b.AUTHENTICATION_SUCCESS_EVENT_NAME,a)}function j(a){d.$broadcast(b.AUTHENTICATION_FAILURE_EVENT_NAME,a)}return f.prototype.authenticate=function(c){var d=a(e.formPost({url:b.getUrl("AUTHENTICATION_ENDPOINT"),method:"POST",withCredentials:!0,data:c})),f=d.then(h).then(i);return d["catch"](j),f},f.prototype.endSession=function(){var c=a.get(b.getUrl("DESTROY_SESSION_ENDPOINT"),{headers:{Accept:"application/json"}});return c.then(function(){g()},function(a){console.error("logout error",a)}),c},new f}]};a.get("$provide").provider(b.AUTH_SERVICE_NAME,c)}]),b.module("stormpath.CONFIG",[]).constant("STORMPATH_CONFIG",function(){var a={AUTHENTICATION_SUCCESS_EVENT_NAME:"$authenticated",AUTHENTICATION_FAILURE_EVENT_NAME:"$authenticationFailure",AUTH_SERVICE_NAME:"$auth",SOCIAL_LOGIN_SERVICE_NAME:"$socialLogin",AUTHENTICATION_ENDPOINT:"/login",CURRENT_USER_URI:"/me",DESTROY_SESSION_ENDPOINT:"/logout",EMAIL_VERIFICATION_ENDPOINT:"/verify",SPA_CONFIG_ENDPOINT:"/spa-config",ENDPOINT_PREFIX:"",FORM_CONTENT_TYPE:"application/x-www-form-urlencoded",GET_USER_EVENT:"$currentUser",NOT_LOGGED_IN_EVENT:"$notLoggedin",FORGOT_PASSWORD_ENDPOINT:"/forgot",CHANGE_PASSWORD_ENDPOINT:"/change",SESSION_END_EVENT:"$sessionEnd",STATE_CHANGE_UNAUTHENTICATED:"$stateChangeUnauthenticated",STATE_CHANGE_UNAUTHORIZED:"$stateChangeUnauthorized",REGISTER_URI:"/register",REGISTERED_EVENT_NAME:"$registered"};return a.getUrl=function(a){return this.ENDPOINT_PREFIX+this[a]},a}()),b.module("stormpath").controller("SpEmailVerificationCtrl",["$scope","$location","$user",function(a,b,c){a.showVerificationError=!1,a.verifying=!1,a.reVerificationSent=!1,a.needsReVerification=!1,a.resendFailed=!1,a.formModel={username:""},b.search().sptoken?(a.verifying=!0,c.verify(b.search().sptoken).then(function(){a.verified=!0})["catch"](function(){a.needsReVerification=!0,a.showVerificationError=!0})["finally"](function(){a.verifying=!1})):(a.needsReVerification=!0,a.showVerificationError=!0),a.submit=function(){a.posting=!0,a.resendFailed=!1,a.showVerificationError=!1,c.resendVerificationEmail({login:a.formModel.username}).then(function(){a.reVerificationSent=!0})["catch"](function(){a.resendFailed=!0})["finally"](function(){a.posting=!1})}}]).directive("spEmailVerification",function(){return{templateUrl:function(a,b){return b.templateUrl||"spEmailVerification.tpl.html"},controller:"SpEmailVerificationCtrl"}}),b.module("stormpath").provider("$spFormEncoder",[function(){this.$get=["STORMPATH_CONFIG",function(a){function b(){var a=new c;return this.encodeUrlForm=a.encode.bind(a),this}function c(){return this.delimiter="&",this.arrayPrefixGenerators={brackets:function(a){return a+"[]"},indices:function(a,b){return a+"["+b+"]"},repeat:function(a){return a}},this}return b.prototype.formPost=function(b){if("application/x-www-form-urlencoded"===a.FORM_CONTENT_TYPE){var c=b.headers?b.headers:b.headers={};c["Content-Type"]=a.FORM_CONTENT_TYPE,b.data=this.encodeUrlForm(b.data)}return b},c.prototype.stringify=function(a,b,c){if(a instanceof Date?a=a.toISOString():null===a&&(a=""),"string"==typeof a||"number"==typeof a||"boolean"==typeof a)return[encodeURIComponent(b)+"="+encodeURIComponent(a)];var d=[];if("undefined"==typeof a)return d;for(var e=Object.keys(a),f=0,g=e.length;g>f;++f){var h=e[f];d=Array.isArray(a)?d.concat(this.stringify(a[h],c(b,h),c)):d.concat(this.stringify(a[h],b+"["+h+"]",c))}return d},c.prototype.encode=function(a,b){b=b||{};var c="undefined"==typeof b.delimiter?this.delimiter:b.delimiter,d=[];if("object"!=typeof a||null===a)return"";var e;e=b.arrayFormat in this.arrayPrefixGenerators?b.arrayFormat:"indices"in b?b.indices?"indices":"repeat":"indices";for(var f=this.arrayPrefixGenerators[e],g=Object.keys(a),h=0,i=g.length;i>h;++h){var j=g[h];d=d.concat(this.stringify(a[j],j,f))}return d.join(c)},new b}]}]),b.module("stormpath").controller("SpLoginFormCtrl",["$scope","$auth","$socialLogin",function(a,b,c){a.socialLoginProviders=[],c.getProviders().then(function(b){a.socialLoginProviders=Object.keys(b).map(function(a){var c=b[a];return c.name=a,c}),a.socialLoginProviders=a.socialLoginProviders.filter(function(a){return a.enabled})})["catch"](function(a){throw new Error("Could not load social providers from back-end: "+a.message)}),a.formModel={username:"",password:""},a.posting=!1,a.submit=function(){a.posting=!0,a.error=null,b.authenticate(a.formModel)["catch"](function(b){a.posting=!1,a.error=b.data&&b.data.error||"An error occured when communicating with server."})}}]).directive("spLoginForm",function(){return{templateUrl:function(a,b){return b.templateUrl||"spLoginForm.tpl.html"},controller:"SpLoginFormCtrl"}}),b.module("stormpath").controller("SpPasswordResetRequestCtrl",["$scope","$user",function(a,b){a.sent=!1,a.posting=!1,a.formModel={username:""},a.requestFailed=!1,a.submit=function(){a.posting=!0,a.requestFailed=!1,b.passwordResetRequest({email:a.formModel.email}).then(function(){a.sent=!0})["catch"](function(){a.requestFailed=!0})["finally"](function(){a.posting=!1})}}]).controller("SpPasswordResetCtrl",["$scope","$location","$user",function(a,b,c){var d=b.search().sptoken;a.showVerificationError=!1,a.verifying=!1,a.verified=!1,a.posting=!1,a.reset=!1,a.error=null,a.resendFailed=!1,a.formModel={password:"",confirmPassword:""},"string"==typeof d?(a.verifying=!0,c.verifyPasswordResetToken(d).then(function(){a.verified=!0})["catch"](function(){a.showVerificationError=!0})["finally"](function(){a.verifying=!1})):a.showVerificationError=!0,a.submit=function(){return a.formModel.password!==a.formModel.confirmPassword?void(a.error="Passwords do not match"):(a.posting=!0,a.error=null,a.showVerificationError=!1,void c.resetPassword(d,{password:a.formModel.password}).then(function(){a.reset=!0})["catch"](function(b){a.error=b.data.error})["finally"](function(){a.posting=!1}))}}]).directive("spPasswordResetRequestForm",function(){return{templateUrl:function(a,b){return b.templateUrl||"spPasswordResetRequestForm.tpl.html"},controller:"SpPasswordResetRequestCtrl"}}).directive("spPasswordResetForm",function(){return{templateUrl:function(a,b){return b.templateUrl||"spPasswordResetForm.tpl.html"},controller:"SpPasswordResetCtrl"}}),b.module("stormpath").controller("SpRegistrationFormCtrl",["$scope","$user","$auth","$location","$socialLogin",function(a,b,c,d,e){a.formModel="object"==typeof a.formModel?a.formModel:{givenName:"",surname:"",email:"",password:""},a.created=!1,a.enabled=!1,a.creating=!1,a.authenticating=!1,a.socialLoginProviders=[],e.getProviders().then(function(b){a.socialLoginProviders=Object.keys(b).map(function(a){var c=b[a];return c.name=a,c}),a.socialLoginProviders=a.socialLoginProviders.filter(function(a){return a.enabled})})["catch"](function(a){throw new Error("Could not load social providers from back-end: "+a.message)}),a.submit=function(){a.creating=!0,a.error=null,b.create(a.formModel).then(function(b){a.created=!0,a.enabled="ENABLED"===b.status,a.enabled&&a.autoLogin?(a.authenticating=!0,c.authenticate({username:a.formModel.email,password:a.formModel.password}).then(function(){a.postLoginPath&&d.path(a.postLoginPath)})["catch"](function(b){a.error=b.data.error})["finally"](function(){a.authenticating=!1,a.creating=!1})):a.creating=!1})["catch"](function(b){a.creating=!1,a.error=b.data.error})}}]).directive("spRegistrationForm",function(){return{templateUrl:function(a,b){return b.templateUrl||"spRegistrationForm.tpl.html"},controller:"SpRegistrationFormCtrl",link:function(a,b,c){a.autoLogin="true"===c.autoLogin,a.postLoginState=c.postLoginState||""}}}),function(){function c(a,b){switch(b.status){case"connected":a.resolve({providerData:{providerId:"facebook",accessToken:b.authResponse.accessToken}});break;case"not_authorized":a.reject(new Error("Please log into this app"));break;default:a.reject(new Error("Please log into Facebook."))}}function d(a,b){this.name="Facebook",this.clientId=null,this.$q=a,this.$spJsLoader=b}d.prototype.init=function(){var b=this.clientId;a.fbAsyncInit=function(){FB.init({appId:b,status:!0,cookie:!0,xfbml:!0,version:"v2.4"})},a.FB?a.fbAsyncInit():this.$spJsLoader.load("facebook-jssdk","//connect.facebook.net/en_US/sdk.js")},d.prototype.login=function(a){var b=this.$q.defer();return FB.login(c.bind(null,b),a),b.promise},b.module("stormpath.facebookLogin",[]).provider("$facebookLogin",function(){this.$get=["$q","$spJsLoader",function(a,b){return new d(a,b)}]})}(),function(){function a(a,b){this.name="Google",this.clientId=null,this.googleAuth=null,this.$q=a,this.$spJsLoader=b}a.prototype.setGoogleAuth=function(a){this.googleAuth=a},a.prototype.init=function(a){var b=this.clientId,c=this.setGoogleAuth.bind(this);this.$spJsLoader.load("google-jssdk","//apis.google.com/js/api:client.js").then(function(){gapi.load("auth2",function(){var a=gapi.auth2.init({client_id:b,cookiepolicy:"single_host_origin"});c(a)})})},a.prototype.login=function(a){var b=this.$q.defer();return a=a||{},a.redirect_uri="postmessage",this.googleAuth.grantOfflineAccess(a).then(function(a){b.resolve({providerData:{providerId:"google",code:a.code}})},function(a){b.reject(a)}),b.promise},b.module("stormpath.googleLogin",[]).provider("$googleLogin",function(){this.$get=["$q","$spJsLoader",function(b,c){return new a(b,c)}]})}(),function(){function a(a,b,c,d){this.providersPromise=null,this.STORMPATH_CONFIG=a,this.$injector=b,this.$http=c,this.$q=d}a.prototype.initProviders=function(a){var b=this.$injector;Object.keys(a).forEach(function(c){var d,e=a[c];try{d=b.get("$"+c+"Login")}catch(f){return void delete a[c]}d.clientId=e.clientId,a[c].service=d})},a.prototype.getProviders=function(){var a=this.providersPromise,b=this.initProviders.bind(this);return a?a.promise:(a=this.$q.defer(),this.providersPromise=a,this.$http.get(this.STORMPATH_CONFIG.getUrl("SPA_CONFIG_ENDPOINT")).then(function(c){var d;d=c.data&&"object"==typeof c.data?c.data.socialProviders:{},b(d),a.resolve(d)})["catch"](a.reject),a.promise)},b.module("stormpath.socialLogin",["stormpath.CONFIG"]).config(["$injector","STORMPATH_CONFIG",function(b,c){var d=["$http","$q","$injector",function(b,d,e){return new a(c,e,b,d)}];b.get("$provide").factory(c.SOCIAL_LOGIN_SERVICE_NAME,d)}]).factory("$spJsLoader",["$q",function(a){return{load:function(b,c,d){var e=a.defer(),f=document.getElementsByTagName("script")[0],g=document.createElement("script");return document.getElementById(b)?e.resolve():(g.id=b,g.src=c,g.innerHTML=d,g.onload=e.resolve,f.parentNode.insertBefore(g,f)),e.promise}}}]).directive("spSocialLogin",["$socialLogin","$auth",function(a,b){return{link:function(c,d,e){var f,g=c.$parent;a.getProviders().then(function(a){var b=a[e.spSocialLogin];b&&b.service&&(f=b.service,f.init(d))}),d.bind("click",function(){var a={scope:e.spScope};g.posting=!0,f.login(a).then(function(a){return b.authenticate(a)})["catch"](function(a){g.posting=!1,a.message?g.error=a.message:a.data&&a.data.error?g.error=a.data.error:g.error="An error occured when communicating with server."})})}}}])}(),function(){function a(a){return"api_key: "+a+"\nauthorize: true"}function c(b,c){var d=a(c);b.load("linkedin-jssdk","//platform.linkedin.com/in.js",d)}function d(a,b){this.name="LinkedIn",this.clientId=null,this.$q=a,this.$spJsLoader=b}d.prototype.init=function(a){c(this.$spJsLoader,this.clientId)},d.prototype.login=function(a){var b=this.$q.defer();return IN.User.authorize(function(){b.resolve({providerData:{providerId:"linkedin",accessToken:IN.ENV.auth.oauth_token}})}),b.promise},b.module("stormpath.linkedinLogin",[]).provider("$linkedinLogin",function(){this.$get=["$q","$spJsLoader",function(a,b){return new d(a,b)}]})}(),b.module("stormpath.userService",["stormpath.CONFIG"]).provider("$user",[function(){function a(a){var b=this;Object.keys(a).map(function(c){b[c]=a[c]})}a.prototype.inGroup=function(a){return this.groups.items.filter(function(b){return b.name===a}).length>0},a.prototype.matchesGroupExpression=function(a){return this.groups.items.filter(function(b){return a.test(b.name)}).length>0},a.prototype.groupTest=function(a){return a instanceof RegExp&&this.matchesGroupExpression(a)?!0:this.inGroup(a)?!0:!1},this.$get=["$q","$http","STORMPATH_CONFIG","$rootScope","$spFormEncoder",function(b,c,d,e,f){function g(){return this.cachedUserOp=null,this.currentUser=null,this}function h(a){e.$broadcast(d.REGISTERED_EVENT_NAME,a)}function i(a){e.$broadcast(d.GET_USER_EVENT,a)}function j(){e.$broadcast(d.NOT_LOGGED_IN_EVENT)}g.prototype.create=function(a){var e=b.defer();return c(f.formPost({url:d.getUrl("REGISTER_URI"),method:"POST",data:a})).then(function(a){e.resolve(a.data),h(a.data)},e.reject),e.promise},g.prototype.get=function(){var e=b.defer(),f=this;return f.cachedUserOp?f.cachedUserOp.promise:null!==f.currentUser&&f.currentUser!==!1?(e.resolve(f.currentUser),e.promise):(f.cachedUserOp=e,c.get(d.getUrl("CURRENT_USER_URI"),{withCredentials:!0}).then(function(b){f.cachedUserOp=null,f.currentUser=new a(b.data),i(f.currentUser),e.resolve(f.currentUser)},function(a){f.currentUser=!1,401===a.status&&j(),f.cachedUserOp=null,e.reject(a)}),e.promise)},g.prototype.resendVerificationEmail=function(a){return c({method:"POST",url:d.getUrl("EMAIL_VERIFICATION_ENDPOINT"),data:a})},g.prototype.verify=function(a){return c({url:d.getUrl("EMAIL_VERIFICATION_ENDPOINT")+"?sptoken="+a})},g.prototype.verifyPasswordResetToken=function(a){return c.get(d.getUrl("CHANGE_PASSWORD_ENDPOINT")+"?sptoken="+a)},g.prototype.passwordResetRequest=function(a){return c(f.formPost({method:"POST",url:d.getUrl("FORGOT_PASSWORD_ENDPOINT"),data:a}))},g.prototype.resetPassword=function(a,b){return b.sptoken=a,c(f.formPost({method:"POST",url:d.getUrl("CHANGE_PASSWORD_ENDPOINT"),data:b}))};var k=new g;return e.$on(d.SESSION_END_EVENT,function(){k.currentUser=!1}),k}]}])}(window,window.angular); \ No newline at end of file diff --git a/dist/stormpath-sdk-angularjs.tpls.min.js b/dist/stormpath-sdk-angularjs.tpls.min.js index 0388ae1..44dd3f5 100644 --- a/dist/stormpath-sdk-angularjs.tpls.min.js +++ b/dist/stormpath-sdk-angularjs.tpls.min.js @@ -2,7 +2,7 @@ * stormpath-sdk-angularjs * Copyright Stormpath, Inc. 2015 * - * @version v0.8.1-dev-2015-11-20 + * @version v0.8.2-dev-2015-11-23 * @link https://github.com/stormpath/stormpath-sdk-angularjs * @license Apache-2.0 */ diff --git a/package.json b/package.json index 5eafa74..12ab72d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "stormpath-sdk-angularjs", - "version": "0.8.1", + "version": "0.8.2", "description": "", "main": "index.js", "scripts": { From bb9e342dcc4f37020d607ca39933b0a45f2e3518 Mon Sep 17 00:00:00 2001 From: Timothy Date: Mon, 23 Nov 2015 18:28:53 +0100 Subject: [PATCH 3/3] make sure that the templates file exports 'stormpath.templates' if `module.exports` is defined --- Gruntfile.js | 7 +++++++ dist/stormpath-sdk-angularjs.tpls.js | 17 +++++++++++++++++ dist/stormpath-sdk-angularjs.tpls.min.js | 2 +- 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/Gruntfile.js b/Gruntfile.js index 7e93452..11f97c9 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -152,6 +152,13 @@ module.exports = function (grunt) { html2js: { options: { module: 'stormpath.templates', + fileHeaderString: '<%= meta.banner %>\n\n'+ + '/* commonjs package manager support (eg componentjs) */\n'+ + 'if (typeof module !== "undefined" && typeof exports !== "undefined" && module.exports === exports){\n'+ + ' module.exports = \'stormpath.templates\';\n'+ + '}\n\n'+ + '(function (window, angular, undefined) {\n', + fileFooterString: '})(window, window.angular);', htmlmin: { collapseBooleanAttributes: false, collapseWhitespace: true, diff --git a/dist/stormpath-sdk-angularjs.tpls.js b/dist/stormpath-sdk-angularjs.tpls.js index 7b4fbad..4e1ea33 100644 --- a/dist/stormpath-sdk-angularjs.tpls.js +++ b/dist/stormpath-sdk-angularjs.tpls.js @@ -1,3 +1,19 @@ +/** + * stormpath-sdk-angularjs + * Copyright Stormpath, Inc. 2015 + * + * @version v0.8.2-dev-2015-11-23 + * @link https://github.com/stormpath/stormpath-sdk-angularjs + * @license Apache-2.0 + */ + +/* commonjs package manager support (eg componentjs) */ +if (typeof module !== "undefined" && typeof exports !== "undefined" && module.exports === exports){ + module.exports = 'stormpath.templates'; +} + +(function (window, angular, undefined) { + angular.module('stormpath.templates', ['spEmailVerification.tpl.html', 'spLoginForm.tpl.html', 'spPasswordResetForm.tpl.html', 'spPasswordResetRequestForm.tpl.html', 'spRegistrationForm.tpl.html']); angular.module("spEmailVerification.tpl.html", []).run(["$templateCache", function($templateCache) { @@ -78,3 +94,4 @@ angular.module("spRegistrationForm.tpl.html", []).run(["$templateCache", functio " border-color: #AF4138;\n" + " }

Your account has been created. Please check your email for a verification link.

Back to Login

Your account has been created. Login Now.

Or register with:

"); }]); +})(window, window.angular); diff --git a/dist/stormpath-sdk-angularjs.tpls.min.js b/dist/stormpath-sdk-angularjs.tpls.min.js index 44dd3f5..0642819 100644 --- a/dist/stormpath-sdk-angularjs.tpls.min.js +++ b/dist/stormpath-sdk-angularjs.tpls.min.js @@ -6,4 +6,4 @@ * @link https://github.com/stormpath/stormpath-sdk-angularjs * @license Apache-2.0 */ -angular.module("stormpath.templates",["spEmailVerification.tpl.html","spLoginForm.tpl.html","spPasswordResetForm.tpl.html","spPasswordResetRequestForm.tpl.html","spRegistrationForm.tpl.html"]),angular.module("spEmailVerification.tpl.html",[]).run(["$templateCache",function(a){a.put("spEmailVerification.tpl.html",'

We are verifying your account

Your account has has been verified! Login Now.

We have sent a new verification message to your email address, please check your email for this message.

This email verification link is not valid. If you need us to re-send an email verification message, please enter your email address or username below.
Sorry, there was a problem with that email or username. Please try again.

')}]),angular.module("spLoginForm.tpl.html",[]).run(["$templateCache",function(a){a.put("spLoginForm.tpl.html",'

Or login with:

')}]),angular.module("spPasswordResetForm.tpl.html",[]).run(["$templateCache",function(a){a.put("spPasswordResetForm.tpl.html",'

We are verifying this link

Your new password has been set. Please Login Now.

This password reset link is not valid. You may request another link by clicking here.

')}]),angular.module("spPasswordResetRequestForm.tpl.html",[]).run(["$templateCache",function(a){a.put("spPasswordResetRequestForm.tpl.html",'

We have sent a password reset link to the email address of the account that you specified. Please check your email for this message, then click on the link.

Back to Login

Sorry, there was a problem with that email or username. Please try again.

')}]),angular.module("spRegistrationForm.tpl.html",[]).run(["$templateCache",function(a){a.put("spRegistrationForm.tpl.html",'

Your account has been created. Please check your email for a verification link.

Back to Login

Your account has been created. Login Now.

Or register with:

')}]); \ No newline at end of file +"undefined"!=typeof module&&"undefined"!=typeof exports&&module.exports===exports&&(module.exports="stormpath.templates"),function(a,b,c){b.module("stormpath.templates",["spEmailVerification.tpl.html","spLoginForm.tpl.html","spPasswordResetForm.tpl.html","spPasswordResetRequestForm.tpl.html","spRegistrationForm.tpl.html"]),b.module("spEmailVerification.tpl.html",[]).run(["$templateCache",function(a){a.put("spEmailVerification.tpl.html",'

We are verifying your account

Your account has has been verified! Login Now.

We have sent a new verification message to your email address, please check your email for this message.

This email verification link is not valid. If you need us to re-send an email verification message, please enter your email address or username below.
Sorry, there was a problem with that email or username. Please try again.

')}]),b.module("spLoginForm.tpl.html",[]).run(["$templateCache",function(a){a.put("spLoginForm.tpl.html",'

Or login with:

')}]),b.module("spPasswordResetForm.tpl.html",[]).run(["$templateCache",function(a){a.put("spPasswordResetForm.tpl.html",'

We are verifying this link

Your new password has been set. Please Login Now.

This password reset link is not valid. You may request another link by clicking here.

')}]),b.module("spPasswordResetRequestForm.tpl.html",[]).run(["$templateCache",function(a){a.put("spPasswordResetRequestForm.tpl.html",'

We have sent a password reset link to the email address of the account that you specified. Please check your email for this message, then click on the link.

Back to Login

Sorry, there was a problem with that email or username. Please try again.

')}]),b.module("spRegistrationForm.tpl.html",[]).run(["$templateCache",function(a){a.put("spRegistrationForm.tpl.html",'

Your account has been created. Please check your email for a verification link.

Back to Login

Your account has been created. Login Now.

Or register with:

')}])}(window,window.angular); \ No newline at end of file