diff --git a/app/views/LoginView.js b/app/views/LoginView.js index 67cee69c..8e46bd48 100644 --- a/app/views/LoginView.js +++ b/app/views/LoginView.js @@ -73,7 +73,8 @@ class LoginView extends React.Component { error: PropTypes.object, failure: PropTypes.bool, theme: PropTypes.string, - loginRequest: PropTypes.func + loginRequest: PropTypes.func, + inviteLinkToken: PropTypes.string } constructor(props) { @@ -91,6 +92,11 @@ class LoginView extends React.Component { } } + get showRegistrationButton() { + const { Accounts_RegistrationForm, inviteLinkToken } = this.props; + return Accounts_RegistrationForm === 'Public' || (Accounts_RegistrationForm === 'Secret URL' && inviteLinkToken?.length); + } + login = () => { const { navigation, Site_Name } = this.props; navigation.navigate('LoginView', { title: Site_Name }); @@ -125,7 +131,7 @@ class LoginView extends React.Component { renderUserForm = () => { const { - Accounts_EmailOrUsernamePlaceholder, Accounts_PasswordPlaceholder, Accounts_PasswordReset, Accounts_RegistrationForm, Accounts_RegistrationForm_LinkReplacementText, isFetching, theme, Accounts_ShowFormLogin + Accounts_EmailOrUsernamePlaceholder, Accounts_PasswordPlaceholder, Accounts_PasswordReset, Accounts_RegistrationForm_LinkReplacementText, isFetching, theme, Accounts_ShowFormLogin } = this.props; if (!Accounts_ShowFormLogin) { @@ -183,7 +189,7 @@ class LoginView extends React.Component { fontSize={14} /> )} - {Accounts_RegistrationForm === 'Public' ? ( + {this.showRegistrationButton ? ( {I18n.t('Dont_Have_An_Account')} ({ error: state.login.error && state.login.error.data, Accounts_EmailOrUsernamePlaceholder: state.settings.Accounts_EmailOrUsernamePlaceholder, Accounts_PasswordPlaceholder: state.settings.Accounts_PasswordPlaceholder, - Accounts_PasswordReset: state.settings.Accounts_PasswordReset + Accounts_PasswordReset: state.settings.Accounts_PasswordReset, + inviteLinkToken: state.inviteLinks.token }); const mapDispatchToProps = dispatch => ({ diff --git a/app/views/WorkspaceView/index.js b/app/views/WorkspaceView/index.js index 3a877056..727931e5 100644 --- a/app/views/WorkspaceView/index.js +++ b/app/views/WorkspaceView/index.js @@ -26,9 +26,15 @@ class WorkspaceView extends React.Component { Site_Url: PropTypes.string, server: PropTypes.string, Assets_favicon_512: PropTypes.object, - registrationEnabled: PropTypes.bool, + registrationForm: PropTypes.string, registrationText: PropTypes.string, - showLoginButton: PropTypes.bool + showLoginButton: PropTypes.bool, + inviteLinkToken: PropTypes.string + } + + get showRegistrationButton() { + const { registrationForm, inviteLinkToken } = this.props; + return registrationForm === 'Public' || (registrationForm === 'Secret URL' && inviteLinkToken?.length); } login = () => { @@ -43,7 +49,7 @@ class WorkspaceView extends React.Component { render() { const { - theme, Site_Name, Site_Url, Assets_favicon_512, server, registrationEnabled, registrationText, showLoginButton + theme, Site_Name, Site_Url, Assets_favicon_512, server, registrationText, showLoginButton } = this.props; return ( @@ -64,7 +70,7 @@ class WorkspaceView extends React.Component { /> ) : null} { - registrationEnabled ? ( + this.showRegistrationButton ? (