Reset the target url after oauth login
This is required for the cloudron button to work for users which are not logged in
This commit is contained in:
@@ -616,6 +616,9 @@ angular.module('Application').service('Client', ['$http', 'md5', 'Notification',
|
||||
var state = Math.floor((1 + Math.random()) * 0x1000000000000).toString(16).substring(1);
|
||||
window.localStorage.oauth2State = state;
|
||||
|
||||
// stash for further use in login_callback
|
||||
window.localStorage.returnTo = '/' + window.location.hash;
|
||||
|
||||
window.location.href = this.apiOrigin + '/api/v1/oauth/dialog/authorize?response_type=token&client_id=' + this._clientId + '&redirect_uri=' + callbackURL + '&scope=' + scope + '&state=' + state;
|
||||
};
|
||||
|
||||
|
||||
@@ -19,7 +19,8 @@
|
||||
// clear oauth2 state
|
||||
delete window.localStorage.oauth2State;
|
||||
|
||||
window.location.href = '/';
|
||||
if (window.localStorage.returnTo) window.location.href = window.localStorage.returnTo;
|
||||
else window.location.href = '/';
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user