FIX: Don't show Sign Up button in cases where users can't sign up
This commit is contained in:
parent
532726005b
commit
11e43bd434
|
@ -1,3 +1,9 @@
|
|||
export default Ember.Controller.extend({
|
||||
styleCategory: null,
|
||||
|
||||
canSignUp: function() {
|
||||
return !Discourse.SiteSettings.invite_only &&
|
||||
Discourse.SiteSettings.allow_new_registrations &&
|
||||
!Discourse.SiteSettings.enable_sso;
|
||||
}.property(),
|
||||
});
|
||||
|
|
|
@ -11,6 +11,9 @@ export default Discourse.Controller.extend({
|
|||
showExtraInfo: null,
|
||||
notifications: null,
|
||||
loadingNotifications: false,
|
||||
needs: ['application'],
|
||||
|
||||
showSignUpButton: Em.computed.alias('controllers.application.canSignUp'),
|
||||
|
||||
showStarButton: function() {
|
||||
return Discourse.User.current() && !this.get('topic.isPrivateMessage');
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
@module Discourse
|
||||
**/
|
||||
export default Discourse.Controller.extend(Discourse.ModalFunctionality, {
|
||||
needs: ['modal', 'createAccount'],
|
||||
needs: ['modal', 'createAccount', 'application'],
|
||||
authenticate: null,
|
||||
loggingIn: false,
|
||||
loggedIn: false,
|
||||
|
@ -37,8 +37,7 @@ export default Discourse.Controller.extend(Discourse.ModalFunctionality, {
|
|||
loginDisabled: Em.computed.or('loggingIn', 'loggedIn'),
|
||||
|
||||
showSignupLink: function() {
|
||||
return !Discourse.SiteSettings.invite_only &&
|
||||
Discourse.SiteSettings.allow_new_registrations &&
|
||||
return this.get('controllers.application.canSignUp') &&
|
||||
!this.get('loggingIn') &&
|
||||
this.blank('authenticate');
|
||||
}.property('loggingIn', 'authenticate'),
|
||||
|
@ -77,7 +76,7 @@ export default Discourse.Controller.extend(Discourse.ModalFunctionality, {
|
|||
$hidden_login_form.submit();
|
||||
}
|
||||
|
||||
}, function(e) {
|
||||
}, function() {
|
||||
// Failed to login
|
||||
if (self.blank('loginName') || self.blank('loginPassword')) {
|
||||
self.flash(I18n.t('login.blank_username_or_password'), 'error');
|
||||
|
|
|
@ -41,9 +41,11 @@
|
|||
</div>
|
||||
{{/unless}}
|
||||
{{#unless currentUser}}
|
||||
{{#if showSignUpButton}}
|
||||
<button {{action showCreateAccount}} class='btn btn-primary btn-small sign-up-button'>
|
||||
{{i18n sign_up}}
|
||||
</button>
|
||||
{{/if}}
|
||||
<button {{action showLogin}} class='btn btn-primary btn-small login-button'>
|
||||
{{icon user}} {{i18n log_in}}
|
||||
</button>
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
moduleFor("controller:header", "controller:header");
|
||||
moduleFor("controller:header", "controller:header", {
|
||||
needs: ['controller:application']
|
||||
});
|
||||
|
||||
test("showNotifications action", function() {
|
||||
var resolveRequestWith;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
moduleFor('controller:topic', 'controller:topic', {
|
||||
needs: ['controller:header', 'controller:modal', 'controller:composer', 'controller:quote-button',
|
||||
'controller:search', 'controller:topic-progress']
|
||||
'controller:search', 'controller:topic-progress', 'controller:application']
|
||||
});
|
||||
|
||||
var buildTopic = function() {
|
||||
|
|
Loading…
Reference in New Issue