mirror of
https://github.com/discourse/discourse.git
synced 2024-11-27 08:23:37 +08: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:
|
||||
const $hidden_login_form = $('#hidden-login-form');
|
||||
const destinationUrl = $.cookie('destination_url');
|
||||
const shouldRedirectToUrl = self.session.get("shouldRedirectToUrl");
|
||||
const ssoDestinationUrl = $.cookie('sso_destination_url');
|
||||
$hidden_login_form.find('input[name=username]').val(self.get('loginName'));
|
||||
$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
|
||||
$.cookie('destination_url', null);
|
||||
$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 {
|
||||
$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
|
||||
if (options.authenticated) {
|
||||
const destinationUrl = $.cookie('destination_url');
|
||||
const shouldRedirectToUrl = self.session.get("shouldRedirectToUrl");
|
||||
if (self.get('loginRequired') && destinationUrl) {
|
||||
if (destinationUrl) {
|
||||
// redirect client to the original URL
|
||||
$.cookie('destination_url', null);
|
||||
window.location.href = destinationUrl;
|
||||
} else if (shouldRedirectToUrl) {
|
||||
self.session.set("shouldRedirectToUrl", null);
|
||||
window.location.href = shouldRedirectToUrl;
|
||||
} else if (window.location.pathname === Discourse.getURL('/login')) {
|
||||
window.location.pathname = Discourse.getURL('/');
|
||||
} else {
|
||||
|
|
|
@ -33,7 +33,7 @@ export default Discourse.Route.extend({
|
|||
}
|
||||
});
|
||||
} else {
|
||||
this.session.set("shouldRedirectToUrl", window.location.href);
|
||||
$.cookie('destination_url', window.location.href);
|
||||
this.replaceWith('login');
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ export default Discourse.Route.extend({
|
|||
});
|
||||
} else {
|
||||
// User is not logged in
|
||||
self.session.set("shouldRedirectToUrl", window.location.href);
|
||||
$.cookie('destination_url', window.location.href);
|
||||
self.replaceWith('login');
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user