Skip to content
This repository has been archived by the owner on Dec 13, 2018. It is now read-only.

Commit

Permalink
Use $location.path() to navigate between pages, allowing both HTML5 a…
Browse files Browse the repository at this point in the history
…nd hashbang modes to work

Fixes #175.
  • Loading branch information
mraible committed Oct 24, 2016
1 parent a3e2ef1 commit 42e46b4
Show file tree
Hide file tree
Showing 13 changed files with 63 additions and 33 deletions.
35 changes: 24 additions & 11 deletions dist/stormpath-sdk-angularjs.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* stormpath-sdk-angularjs
* Copyright Stormpath, Inc. 2016
*
* @version v1.1.0-dev-2016-08-17
* @version v1.1.0-dev-2016-10-24
* @link https://github.com/stormpath/stormpath-sdk-angularjs
* @license Apache-2.0
*/
Expand Down Expand Up @@ -1914,6 +1914,9 @@ angular.module('stormpath')
$scope.posting = false;
});
};
$scope.login = function(){
$location.path('/login')
};
}])

/**
Expand Down Expand Up @@ -2126,7 +2129,7 @@ angular.module('stormpath')

angular.module('stormpath')

.controller('SpLoginFormCtrl', ['$scope','$auth','$viewModel',function ($scope,$auth,$viewModel) {
.controller('SpLoginFormCtrl', ['$scope','$auth','$location','$viewModel',function ($scope,$auth,$location,$viewModel) {
$scope.viewModel = null;

$viewModel.getLoginModel().then(function (model) {
Expand Down Expand Up @@ -2154,6 +2157,9 @@ angular.module('stormpath')
$scope.error = err.message;
});
};
$scope.forgot = function(){
$location.path('/forgot')
};
}])


Expand Down Expand Up @@ -2206,7 +2212,7 @@ angular.module('stormpath')
'use strict';

angular.module('stormpath')
.controller('SpPasswordResetRequestCtrl', ['$scope','$user',function ($scope,$user) {
.controller('SpPasswordResetRequestCtrl', ['$scope','$location','$user',function ($scope,$location,$user) {
$scope.sent = false;
$scope.posting = false;
$scope.formModel = {
Expand All @@ -2226,6 +2232,12 @@ angular.module('stormpath')
$scope.posting = false;
});
};
$scope.forgot = function(){
$location.path('/forgot');
};
$scope.login = function(){
$location.path('/login');
};
}])

.controller('SpPasswordResetCtrl', ['$scope','$location','$user',function ($scope,$location,$user) {
Expand Down Expand Up @@ -2276,7 +2288,9 @@ angular.module('stormpath')
$scope.posting = false;
});
};

$scope.login = function(){
$location.path('/login');
};
}])

/**
Expand Down Expand Up @@ -2427,6 +2441,9 @@ angular.module('stormpath')
$scope.error = err.message;
});
};
$scope.login = function(){
$location.path('/login');
};
}])


Expand Down Expand Up @@ -2544,6 +2561,7 @@ angular.module('stormpath')
}
};
});

(function() {
'use strict';

Expand Down Expand Up @@ -3183,14 +3201,9 @@ angular.module('stormpath.userService',['stormpath.CONFIG'])
* verified and can be used for login. If rejected the token is expired
* or has already been used.
*
* @param {Object} data Data object
* @param {String} sptoken
*
* An object literal for passing the email verification token.
* Must follow this format:
* ```
* {
* sptoken: '<token from email>'
* }```
* The value of the `sptoken` that was sent by email to the user
*
* @description
*
Expand Down
4 changes: 2 additions & 2 deletions dist/stormpath-sdk-angularjs.min.js

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions dist/stormpath-sdk-angularjs.tpls.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* stormpath-sdk-angularjs
* Copyright Stormpath, Inc. 2016
*
* @version v1.1.0-dev-2016-08-17
* @version v1.1.0-dev-2016-10-24
* @link https://github.com/stormpath/stormpath-sdk-angularjs
* @license Apache-2.0
*/
Expand All @@ -18,7 +18,7 @@ angular.module('stormpath.templates', ['spEmailVerification.tpl.html', 'spLoginF

angular.module("spEmailVerification.tpl.html", []).run(["$templateCache", function($templateCache) {
$templateCache.put("spEmailVerification.tpl.html",
"<div class=row><div class=\"col-sm-offset-4 col-xs-12 col-sm-4\"><p ng-show=verifying class=\"alert alert-warning\">We are verifying your account</p><p ng-show=verified class=\"alert alert-success\">Your account has has been verified! <a href=/login>Login Now.</a></p><p ng-show=reVerificationSent class=\"alert alert-success\">We have sent a new verification message to your email address, please check your email for this message.</p><div ng-show=showVerificationError class=\"alert alert-danger\">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.</div><div ng-show=resendFailed class=\"alert alert-danger\">Sorry, there was a problem with that email or username. Please try again.</div></div></div><div class=row><div class=col-xs-12><form class=form-horizontal ng-show=\"needsReVerification && !reVerificationSent\" ng-submit=submit()><div class=form-group><label for=spEmail class=\"col-xs-12 col-sm-4 control-label\">Email or Username</label><div class=\"col-xs-12 col-sm-4\"><input class=form-control id=spUsername ng-model=formModel.username placeholder=\"Username or Email\" ng-disabled=posting></div></div><div class=form-group><div class=\"col-sm-offset-4 col-xs-12\"><p class=text-danger ng-show=error ng-bind=error></p><button type=submit class=\"btn btn-primary\" ng-disabled=posting>Re-Send Verification</button></div></div></form></div></div>");
"<div class=row><div class=\"col-sm-offset-4 col-xs-12 col-sm-4\"><p ng-show=verifying class=\"alert alert-warning\">We are verifying your account</p><p ng-show=verified class=\"alert alert-success\">Your account has has been verified! <a href=\"\" ng-click=login()>Login Now.</a></p><p ng-show=reVerificationSent class=\"alert alert-success\">We have sent a new verification message to your email address, please check your email for this message.</p><div ng-show=showVerificationError class=\"alert alert-danger\">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.</div><div ng-show=resendFailed class=\"alert alert-danger\">Sorry, there was a problem with that email or username. Please try again.</div></div></div><div class=row><div class=col-xs-12><form class=form-horizontal ng-show=\"needsReVerification && !reVerificationSent\" ng-submit=submit()><div class=form-group><label for=spEmail class=\"col-xs-12 col-sm-4 control-label\">Email or Username</label><div class=\"col-xs-12 col-sm-4\"><input class=form-control id=spEmail ng-model=formModel.username placeholder=\"Username or Email\" ng-disabled=posting></div></div><div class=form-group><div class=\"col-sm-offset-4 col-xs-12\"><p class=text-danger ng-show=error ng-bind=error></p><button type=submit class=\"btn btn-primary\" ng-disabled=posting>Re-Send Verification</button></div></div></form></div></div>");
}]);

angular.module("spLoginForm.tpl.html", []).run(["$templateCache", function($templateCache) {
Expand Down Expand Up @@ -54,17 +54,17 @@ angular.module("spLoginForm.tpl.html", []).run(["$templateCache", function($temp
"\n" +
" .sp-loading {\n" +
" text-align: center;\n" +
" }</style><div class=row><div class=col-xs-12><div ng-show=!viewModel class=sp-loading>Loading...</div><form class=form-horizontal ng-hide=\"accepted || !viewModel\" ng-submit=submit()><div class=form-group ng-repeat=\"field in viewModel.form.fields\"><label for=sp-{{field.name}} class=\"col-xs-12 col-sm-4 control-label\">{{field.label}}</label><div class=\"col-xs-12 col-sm-4\"><input class=form-control name={{field.name}} id=sp-{{field.name}} type={{field.type}} ng-model=formModel[field.name] placeholder={{field.placeholder}} ng-disabled=posting ng-required=field.required></div></div><div class=form-group><div class=\"col-sm-offset-4 col-sm-4\"><p class=text-danger ng-show=error ng-bind=error></p><button type=submit class=\"btn btn-primary\" ng-disabled=posting>Login</button> <a href=/forgot class=pull-right>Forgot Password</a></div></div><div class=form-group ng-show=viewModel.accountStores.length><div class=\"col-sm-offset-4 col-sm-4\"><p>Or login with:</p><button ng-repeat=\"accountStore in viewModel.accountStores\" type=button class=\"btn btn-social btn-{{accountStore.provider.providerId}}\" sp-social-login={{accountStore.provider.providerId}} sp-client-id={{accountStore.provider.clientId}} sp-scope={{accountStore.provider.scope}}>{{providerName}}</button></div></div></form></div></div>");
" }</style><div class=row><div class=col-xs-12><div ng-show=!viewModel class=sp-loading>Loading...</div><form class=form-horizontal ng-hide=\"accepted || !viewModel\" ng-submit=submit()><div class=form-group ng-repeat=\"field in viewModel.form.fields\"><label for=sp-{{field.name}} class=\"col-xs-12 col-sm-4 control-label\">{{field.label}}</label><div class=\"col-xs-12 col-sm-4\"><input class=form-control name={{field.name}} id=sp-{{field.name}} type={{field.type}} ng-model=formModel[field.name] placeholder={{field.placeholder}} ng-disabled=posting ng-required=field.required></div></div><div class=form-group><div class=\"col-sm-offset-4 col-sm-4\"><p class=text-danger ng-show=error ng-bind=error></p><button type=submit class=\"btn btn-primary\" ng-disabled=posting>Login</button> <a href=\"\" ng-click=forgot() class=pull-right>Forgot Password</a></div></div><div class=form-group ng-show=viewModel.accountStores.length><div class=\"col-sm-offset-4 col-sm-4\"><p>Or login with:</p><button ng-repeat=\"accountStore in viewModel.accountStores\" type=button class=\"btn btn-social btn-{{accountStore.provider.providerId}}\" sp-social-login={{accountStore.provider.providerId}} sp-client-id={{accountStore.provider.clientId}} sp-scope={{accountStore.provider.scope}}>{{providerName}}</button></div></div></form></div></div>");
}]);

angular.module("spPasswordResetForm.tpl.html", []).run(["$templateCache", function($templateCache) {
$templateCache.put("spPasswordResetForm.tpl.html",
"<div class=row><div class=\"col-sm-offset-4 col-xs-12 col-sm-4\"><p ng-show=verifying class=\"alert alert-warning text-center\">We are verifying this link</p><p class=\"alert alert-success\" ng-show=reset>Your new password has been set. Please <a href=/login>Login Now</a>.</p><div ng-show=showVerificationError class=\"alert alert-danger\">This password reset link is not valid. You may request another link by <a href=/forgot>clicking here</a>.</div></div></div><div class=row><div class=col-xs-12><form class=form-horizontal ng-show=\"verified && !reset\" ng-submit=submit()><div class=form-group><label for=spEmail class=\"col-xs-12 col-sm-4 control-label\">New Password</label><div class=\"col-xs-12 col-sm-4\"><input class=form-control id=spUsername ng-model=formModel.password placeholder=\"New Password\" type=password ng-disabled=posting></div></div><div class=form-group><label for=spEmail class=\"col-xs-12 col-sm-4 control-label\">Confirm New Password</label><div class=\"col-xs-12 col-sm-4\"><input class=form-control id=spUsername ng-model=formModel.confirmPassword placeholder=\"Confirm New Password\" type=password ng-disabled=posting></div></div><div class=form-group><div class=\"col-sm-offset-4 col-sm-4\"><p class=\"alert alert-danger\" ng-show=error ng-bind=error></p><button type=submit class=\"btn btn-primary\" ng-disabled=posting>Set New Password</button></div></div></form></div></div>");
"<div class=row><div class=\"col-sm-offset-4 col-xs-12 col-sm-4\"><p ng-show=verifying class=\"alert alert-warning text-center\">We are verifying this link</p><p class=\"alert alert-success\" ng-show=reset>Your new password has been set. Please <a href=\"\" ng-click=login()>Login Now</a>.</p><div ng-show=showVerificationError class=\"alert alert-danger\">This password reset link is not valid. You may request another link by <a href=\"\" ng-click=forgot()>clicking here</a>.</div></div></div><div class=row><div class=col-xs-12><form class=form-horizontal ng-show=\"verified && !reset\" ng-submit=submit()><div class=form-group><label for=spNewPassword class=\"col-xs-12 col-sm-4 control-label\">New Password</label><div class=\"col-xs-12 col-sm-4\"><input class=form-control id=spNewPassword ng-model=formModel.password placeholder=\"New Password\" type=password ng-disabled=posting></div></div><div class=form-group><label for=spConfirmPassword class=\"col-xs-12 col-sm-4 control-label\">Confirm New Password</label><div class=\"col-xs-12 col-sm-4\"><input class=form-control id=spConfirmPassword ng-model=formModel.confirmPassword placeholder=\"Confirm New Password\" type=password ng-disabled=posting></div></div><div class=form-group><div class=\"col-sm-offset-4 col-sm-4\"><p class=\"alert alert-danger\" ng-show=error ng-bind=error></p><button type=submit class=\"btn btn-primary\" ng-disabled=posting>Set New Password</button></div></div></form></div></div>");
}]);

angular.module("spPasswordResetRequestForm.tpl.html", []).run(["$templateCache", function($templateCache) {
$templateCache.put("spPasswordResetRequestForm.tpl.html",
"<div class=row><div class=\"col-sm-offset-4 col-xs-12 col-sm-4\"><p ng-show=sent class=\"alert alert-success\">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.</p><p ng-show=sent class=pull-right><a href=/login>Back to Login</a></p><div ng-show=error class=\"alert alert-danger\" ng-bind=error></div></div></div><div class=row><div class=col-xs-12><form class=form-horizontal ng-hide=sent ng-submit=submit()><div class=form-group><label for=spEmail class=\"col-xs-12 col-sm-4 control-label\">Email or Username</label><div class=\"col-xs-12 col-sm-4\"><input class=form-control id=spEmail ng-model=formModel.email placeholder=\"Your Email Address\" ng-disabled=posting></div></div><div class=form-group><div class=\"col-sm-offset-4 col-xs-12\"><p class=text-danger ng-show=error ng-bind=error></p><button type=submit class=\"btn btn-primary\" ng-disabled=posting>Request Password Reset</button></div></div></form></div></div>");
"<div class=row><div class=\"col-sm-offset-4 col-xs-12 col-sm-4\"><p ng-show=sent class=\"alert alert-success\">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.</p><p ng-show=sent class=pull-right><a href=\"\" ng-click=login()>Back to Login</a></p><div ng-show=error class=\"alert alert-danger\" ng-bind=error></div></div></div><div class=row><div class=col-xs-12><form class=form-horizontal ng-hide=sent ng-submit=submit()><div class=form-group><label for=spEmail class=\"col-xs-12 col-sm-4 control-label\">Email or Username</label><div class=\"col-xs-12 col-sm-4\"><input class=form-control id=spEmail ng-model=formModel.email placeholder=\"Your Email Address\" ng-disabled=posting></div></div><div class=form-group><div class=\"col-sm-offset-4 col-xs-12\"><p class=text-danger ng-show=error ng-bind=error></p><button type=submit class=\"btn btn-primary\" ng-disabled=posting>Request Password Reset</button></div></div></form></div></div>");
}]);

angular.module("spRegistrationForm.tpl.html", []).run(["$templateCache", function($templateCache) {
Expand Down Expand Up @@ -100,6 +100,6 @@ angular.module("spRegistrationForm.tpl.html", []).run(["$templateCache", functio
"\n" +
" .sp-loading {\n" +
" text-align: center;\n" +
" }</style><div class=row><div class=\"col-sm-offset-4 col-xs-12 col-sm-4\"><p class=\"alert alert-success\" ng-show=\"created && !enabled\">Your account has been created. Please check your email for a verification link.</p><p ng-show=\"created && !enabled\" class=pull-right><a href=/login>Back to Login</a></p><p class=\"alert alert-success\" ng-show=\"created && enabled && !authenticating\">Your account has been created. <a href=/login>Login Now</a>.</p></div></div><div class=row><div class=col-xs-12><div ng-show=!viewModel class=sp-loading>Loading...</div><form class=form-horizontal ng-hide=\"!viewModel || (created && !authenticating)\" ng-submit=submit()><div class=form-group ng-repeat=\"field in viewModel.form.fields\"><label for=sp-{{field.name}} class=\"col-xs-12 col-sm-4 control-label\">{{field.label}}</label><div class=\"col-xs-12 col-sm-4\"><input class=form-control name={{field.name}} id=sp-{{field.name}} type={{field.type}} ng-model=formModel[field.name] placeholder={{field.placeholder}} ng-disabled=creating ng-required=field.required></div></div><div class=form-group><div class=\"col-sm-offset-4 col-sm-4\"><p class=\"alert alert-danger\" ng-show=error ng-bind=error></p><button type=submit class=\"btn btn-primary\" ng-disabled=creating>Register</button></div></div><div class=form-group ng-show=viewModel.accountStores.length><div class=\"col-sm-offset-4 col-sm-4\"><p>Or register with:</p><button ng-repeat=\"accountStore in viewModel.accountStores\" type=button class=\"btn btn-social btn-{{accountStore.provider.providerId}}\" sp-social-login={{accountStore.provider.providerId}} sp-client-id={{accountStore.provider.clientId}} sp-scope={{accountStore.provider.scope}}>{{providerName}}</button></div></div></form></div></div>");
" }</style><div class=row><div class=\"col-sm-offset-4 col-xs-12 col-sm-4\"><p class=\"alert alert-success\" ng-show=\"created && !enabled\">Your account has been created. Please check your email for a verification link.</p><p ng-show=\"created && !enabled\" class=pull-right><a href=\"\" ng-click=login()>Back to Login</a></p><p class=\"alert alert-success\" ng-show=\"created && enabled && !authenticating\">Your account has been created. <a href=\"\" ng-click=login()>Login Now</a>.</p></div></div><div class=row><div class=col-xs-12><div ng-show=!viewModel class=sp-loading>Loading...</div><form class=form-horizontal ng-hide=\"!viewModel || (created && !authenticating)\" ng-submit=submit()><div class=form-group ng-repeat=\"field in viewModel.form.fields\"><label for=sp-{{field.name}} class=\"col-xs-12 col-sm-4 control-label\">{{field.label}}</label><div class=\"col-xs-12 col-sm-4\"><input class=form-control name={{field.name}} id=sp-{{field.name}} type={{field.type}} ng-model=formModel[field.name] placeholder={{field.placeholder}} ng-disabled=creating ng-required=field.required></div></div><div class=form-group><div class=\"col-sm-offset-4 col-sm-4\"><p class=\"alert alert-danger\" ng-show=error ng-bind=error></p><button type=submit class=\"btn btn-primary\" ng-disabled=creating>Register</button></div></div><div class=form-group ng-show=viewModel.accountStores.length><div class=\"col-sm-offset-4 col-sm-4\"><p>Or register with:</p><button ng-repeat=\"accountStore in viewModel.accountStores\" type=button class=\"btn btn-social btn-{{accountStore.provider.providerId}}\" sp-social-login={{accountStore.provider.providerId}} sp-client-id={{accountStore.provider.clientId}} sp-scope={{accountStore.provider.scope}}>{{providerName}}</button></div></div></form></div></div>");
}]);
})(window, window.angular);
Loading

0 comments on commit 42e46b4

Please sign in to comment.