FIX: /signup route will show sign up modal for private sites too if they allow registrations

This commit is contained in:
Neil Lalonde 2016-02-03 12:18:33 -05:00
parent 2ff4248c19
commit ccbbfbc24e

View File

@ -1,9 +1,25 @@
export default Discourse.Route.extend({ import buildStaticRoute from 'discourse/routes/build-static-route';
beforeModel: function() {
this.replaceWith('discovery.latest').then(function(e) { const SignupRoute = buildStaticRoute('signup');
Ember.run.next(function() {
e.send('showCreateAccount'); SignupRoute.reopen({
beforeModel() {
var canSignUp = this.controllerFor("application").get('canSignUp');
if (!this.siteSettings.login_required) {
this.replaceWith('discovery.latest').then(e => {
if (canSignUp) {
Ember.run.next(() => e.send('showCreateAccount'));
}
}); });
}); } else {
}, this.replaceWith('login').then(e => {
if (canSignUp) {
Ember.run.next(() => e.send('showCreateAccount'));
}
});
}
}
}); });
export default SignupRoute;