Disabled ’sign in’ link when the proxy does not support creating new accounts

This commit is contained in:
Giulio Cesare Solaroli 2015-03-11 18:19:29 +01:00
parent 9d8bdceac4
commit 867666b949
2 changed files with 15 additions and 8 deletions

View File

@ -141,16 +141,22 @@ Clipperz.PM.UI.Components.Pages.LoginPage = React.createClass({
}, },
render: function() { render: function() {
var registrationLink = React.DOM.footer({'key':'registrationLink', 'className':'registrationLink'}, [ //console.log("LOGIN PAGE", this.props);
React.DOM.a({'key':'signup', 'onClick':this.handleRegistrationLinkClick}, "Sign up") // var registrationLink = React.DOM.footer({'key':'registrationLink', 'className':'registrationLink'}, [
]); // React.DOM.a({'key':'signup', 'onClick':this.handleRegistrationLinkClick}, "Sign up")
// ]);
var registrationLink = React.DOM.a({'key':'signup', 'onClick':this.handleRegistrationLinkClick}, "Sign up");
return React.DOM.div({'className':'loginForm ' + this.props['style']}, [ return React.DOM.div({'className':'loginForm ' + this.props['style']}, [
React.DOM.header({'key':'header'}, 'clipperz'), React.DOM.header({'key':'header'}, 'clipperz'),
React.DOM.div({'key':'form-wrapper', 'className':'form'}, [ React.DOM.div({'key':'form-wrapper', 'className':'form'}, [
this.props.mode == 'PIN' ? this.pinForm() : this.loginForm(), this.props.mode == 'PIN' ? this.pinForm() : this.loginForm(),
]), ]),
this.props.isNewUserRegistrationAvailable ? registrationLink : null React.DOM.footer({'key':'registrationLink', 'className':'registrationLink'}, [
this.props['isNewUserRegistrationAvailable'] ? registrationLink : null
])
// this.props['isNewUserRegistrationAvailable'] ? registrationLink : null
]); ]);
} }
}); });

View File

@ -237,10 +237,10 @@ console.log("THE BROWSER IS OFFLINE");
var canRegisterNewUsers; var canRegisterNewUsers;
canRegisterNewUsers = Clipperz.PM.Proxy.defaultProxy.canRegisterNewUsers(); canRegisterNewUsers = Clipperz.PM.Proxy.defaultProxy.canRegisterNewUsers();
//console.log("CAN REGISTER NEW USERS", canRegisterNewUsers);
this.selectInitialProxy(); this.selectInitialProxy();
shouldShowRegistrationForm = parameters['shouldShowRegistrationForm'] && canRegisterNewUsers; shouldShowRegistrationForm = parameters['shouldShowRegistrationForm'] && canRegisterNewUsers;
this.pages()['loginPage'].setProps({'mode':this.loginMode(), 'isNewUserRegistrationAvailable':canRegisterNewUsers}); // this.pages()['loginPage'].setProps({'mode':this.loginMode(), 'isNewUserRegistrationAvailable':canRegisterNewUsers});
this.showLoginForm(); this.showLoginForm();
if (shouldShowRegistrationForm) { if (shouldShowRegistrationForm) {
@ -257,7 +257,8 @@ console.log("THE BROWSER IS OFFLINE");
var loginFormPage; var loginFormPage;
loginFormPage = this.pages()['loginPage']; loginFormPage = this.pages()['loginPage'];
loginFormPage.setProps({'mode':this.loginMode(), 'isNewUserRegistrationAvailable':Clipperz.PM.Proxy.defaultProxy.canRegisterNewUsers()}); // loginFormPage.setProps({'mode':this.loginMode(), 'isNewUserRegistrationAvailable':Clipperz.PM.Proxy.defaultProxy.canRegisterNewUsers()});
loginFormPage.setProps({'mode':this.loginMode()});
this.moveInPage(this.currentPage(), 'loginPage'); this.moveInPage(this.currentPage(), 'loginPage');
MochiKit.Async.callLater(0.5, MochiKit.Base.method(loginFormPage, 'setInitialFocus')); MochiKit.Async.callLater(0.5, MochiKit.Base.method(loginFormPage, 'setInitialFocus'));
}, },
@ -979,7 +980,7 @@ console.log("THE BROWSER IS OFFLINE");
if (aPageName == 'loginPage') { if (aPageName == 'loginPage') {
extraProperties = { extraProperties = {
'mode': 'CREDENTIALS', 'mode': 'CREDENTIALS',
'isNewUserRegistrationAvailable': true, 'isNewUserRegistrationAvailable': Clipperz.PM.Proxy.defaultProxy.canRegisterNewUsers(),
'disabled': false, 'disabled': false,
}; };
} else if (aPageName == 'registrationPage') { } else if (aPageName == 'registrationPage') {