Merge pull request #8299 from jakemcdermott/fix-8154

Force logout and clear before social auth login

Reviewed-by: Jake McDermott <yo@jakemcdermott.me>
             https://github.com/jakemcdermott
This commit is contained in:
softwarefactory-project-zuul[bot]
2020-10-01 17:47:12 +00:00
committed by GitHub

View File

@@ -11,8 +11,8 @@
* Controller for handling third party supported login options. * Controller for handling third party supported login options.
*/ */
export default ['$window', '$scope', 'thirdPartySignOnService', export default ['$window', '$scope', 'thirdPartySignOnService', '$cookies', 'Authorization',
function ($window, $scope, thirdPartySignOnService) { function ($window, $scope, thirdPartySignOnService, $cookies, Authorization) {
thirdPartySignOnService( thirdPartySignOnService(
{scope: $scope, url: "api/v2/auth/"}).then(function (data) { {scope: $scope, url: "api/v2/auth/"}).then(function (data) {
@@ -29,8 +29,16 @@ export default ['$window', '$scope', 'thirdPartySignOnService',
}); });
$scope.goTo = function(link) { $scope.goTo = function(link) {
// this is used because $location only lets you navigate inside // clear out any prior auth state that might exist (e.g: from other
// the "/#/" path, and these are API urls. // tabs, etc.) before redirecting to the auth service
$window.location.href = link; Authorization.logout().then(() => {
angular.forEach($cookies.getAll(), (val, name) => {
$cookies.remove(name);
});
$window.location.reload();
// this is used because $location only lets you navigate inside
// the "/#/" path, and these are API urls.
$window.location.href = link;
});
}; };
}]; }];