FIX: redirect to original URL when logging in via OAuth

This commit is contained in:
Arpit Jalan 2015-09-18 18:29:57 +05:30
parent f37f6f7673
commit 7abd4687e2

View File

@ -184,7 +184,12 @@ export default Ember.Controller.extend(ModalFunctionality, {
// Reload the page if we're authenticated
if (options.authenticated) {
if (window.location.pathname === Discourse.getURL('/login')) {
const destinationUrl = $.cookie('destination_url');
if (self.get('loginRequired') && destinationUrl) {
// redirect client to the original URL
$.cookie('destination_url', null);
window.location.href = destinationUrl;
} else if (window.location.pathname === Discourse.getURL('/login')) {
window.location.pathname = Discourse.getURL('/');
} else {
window.location.reload();