FIX: redirect loop for new users visiting /new-topic using full screen login

This commit is contained in:
Leo McArdle 2017-08-30 16:58:40 +01:00
parent a9737e2813
commit e183600563
4 changed files with 13 additions and 2 deletions

View File

@ -8,6 +8,7 @@ const Discourse = Ember.Application.extend({
_docTitle: document.title,
RAW_TEMPLATES: {},
__widget_helpers: {},
showingSignup: false,
getURL(url) {
if (!url) return url;

View File

@ -34,7 +34,11 @@ export default Discourse.Route.extend({
});
} else {
$.cookie('destination_url', window.location.href);
this.replaceWith('login');
if (Discourse.showingSignup) {
Discourse.showingSignup = false;
} else {
self.replaceWith('login');
}
}
}

View File

@ -14,7 +14,12 @@ export default Discourse.Route.extend({
} else {
// User is not logged in
$.cookie('destination_url', window.location.href);
self.replaceWith('login');
if (Discourse.showingSignup) {
// We're showing the sign up modal
Discourse.showingSignup = false;
} else {
self.replaceWith('login');
}
}
}
});

View File

@ -21,6 +21,7 @@
<script>
<%- if !current_user && flash[:authentication_data] %>
Discourse.showingSignup = true
require('discourse/routes/application').default.reopen({
actions: {
didTransition: function() {