From ccbbfbc24e427558481e3cf03f36d3df2d046c1b Mon Sep 17 00:00:00 2001 From: Neil Lalonde Date: Wed, 3 Feb 2016 12:18:33 -0500 Subject: [PATCH] FIX: /signup route will show sign up modal for private sites too if they allow registrations --- .../discourse/routes/signup.js.es6 | 30 ++++++++++++++----- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/app/assets/javascripts/discourse/routes/signup.js.es6 b/app/assets/javascripts/discourse/routes/signup.js.es6 index 54e35374d..bbd77e95b 100644 --- a/app/assets/javascripts/discourse/routes/signup.js.es6 +++ b/app/assets/javascripts/discourse/routes/signup.js.es6 @@ -1,9 +1,25 @@ -export default Discourse.Route.extend({ - beforeModel: function() { - this.replaceWith('discovery.latest').then(function(e) { - Ember.run.next(function() { - e.send('showCreateAccount'); +import buildStaticRoute from 'discourse/routes/build-static-route'; + +const SignupRoute = buildStaticRoute('signup'); + +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;