mirror of
https://github.com/discourse/discourse.git
synced 2025-02-08 04:18:23 +00:00
FIX: make /new-topic redirect survive full screen login (#5105)
This commit is contained in:
parent
6bc74ceb50
commit
fd2cd63b08
@ -90,7 +90,6 @@ export default Ember.Controller.extend(ModalFunctionality, {
|
|||||||
// Trigger the browser's password manager using the hidden static login form:
|
// Trigger the browser's password manager using the hidden static login form:
|
||||||
const $hidden_login_form = $('#hidden-login-form');
|
const $hidden_login_form = $('#hidden-login-form');
|
||||||
const destinationUrl = $.cookie('destination_url');
|
const destinationUrl = $.cookie('destination_url');
|
||||||
const shouldRedirectToUrl = self.session.get("shouldRedirectToUrl");
|
|
||||||
const ssoDestinationUrl = $.cookie('sso_destination_url');
|
const ssoDestinationUrl = $.cookie('sso_destination_url');
|
||||||
$hidden_login_form.find('input[name=username]').val(self.get('loginName'));
|
$hidden_login_form.find('input[name=username]').val(self.get('loginName'));
|
||||||
$hidden_login_form.find('input[name=password]').val(self.get('loginPassword'));
|
$hidden_login_form.find('input[name=password]').val(self.get('loginPassword'));
|
||||||
@ -103,9 +102,6 @@ export default Ember.Controller.extend(ModalFunctionality, {
|
|||||||
// redirect client to the original URL
|
// redirect client to the original URL
|
||||||
$.cookie('destination_url', null);
|
$.cookie('destination_url', null);
|
||||||
$hidden_login_form.find('input[name=redirect]').val(destinationUrl);
|
$hidden_login_form.find('input[name=redirect]').val(destinationUrl);
|
||||||
} else if (shouldRedirectToUrl) {
|
|
||||||
self.session.set("shouldRedirectToUrl", null);
|
|
||||||
$hidden_login_form.find('input[name=redirect]').val(shouldRedirectToUrl);
|
|
||||||
} else {
|
} else {
|
||||||
$hidden_login_form.find('input[name=redirect]').val(window.location.href);
|
$hidden_login_form.find('input[name=redirect]').val(window.location.href);
|
||||||
}
|
}
|
||||||
@ -222,14 +218,10 @@ export default Ember.Controller.extend(ModalFunctionality, {
|
|||||||
// Reload the page if we're authenticated
|
// Reload the page if we're authenticated
|
||||||
if (options.authenticated) {
|
if (options.authenticated) {
|
||||||
const destinationUrl = $.cookie('destination_url');
|
const destinationUrl = $.cookie('destination_url');
|
||||||
const shouldRedirectToUrl = self.session.get("shouldRedirectToUrl");
|
if (destinationUrl) {
|
||||||
if (self.get('loginRequired') && destinationUrl) {
|
|
||||||
// redirect client to the original URL
|
// redirect client to the original URL
|
||||||
$.cookie('destination_url', null);
|
$.cookie('destination_url', null);
|
||||||
window.location.href = destinationUrl;
|
window.location.href = destinationUrl;
|
||||||
} else if (shouldRedirectToUrl) {
|
|
||||||
self.session.set("shouldRedirectToUrl", null);
|
|
||||||
window.location.href = shouldRedirectToUrl;
|
|
||||||
} else if (window.location.pathname === Discourse.getURL('/login')) {
|
} else if (window.location.pathname === Discourse.getURL('/login')) {
|
||||||
window.location.pathname = Discourse.getURL('/');
|
window.location.pathname = Discourse.getURL('/');
|
||||||
} else {
|
} else {
|
||||||
|
@ -33,7 +33,7 @@ export default Discourse.Route.extend({
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
this.session.set("shouldRedirectToUrl", window.location.href);
|
$.cookie('destination_url', window.location.href);
|
||||||
this.replaceWith('login');
|
this.replaceWith('login');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,7 @@ export default Discourse.Route.extend({
|
|||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
// User is not logged in
|
// User is not logged in
|
||||||
self.session.set("shouldRedirectToUrl", window.location.href);
|
$.cookie('destination_url', window.location.href);
|
||||||
self.replaceWith('login');
|
self.replaceWith('login');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user