[IMPROVEMENT] Hide "Forgot password" by server "Accounts_PasswordReset" property (#1117)

This commit is contained in:
Juan Petterson 2019-08-09 10:11:28 -03:00 committed by Diego Mello
parent 6ab5ecdf93
commit 2d3894ccb2
2 changed files with 19 additions and 8 deletions

View File

@ -11,6 +11,9 @@ export default {
Accounts_PasswordPlaceholder: {
type: 'valueAsString'
},
Accounts_PasswordReset: {
type: 'valueAsBoolean'
},
CROWD_Enable: {
type: 'valueAsBoolean'
},

View File

@ -57,10 +57,15 @@ class LoginView extends React.Component {
Site_Name: PropTypes.string,
Accounts_EmailOrUsernamePlaceholder: PropTypes.string,
Accounts_PasswordPlaceholder: PropTypes.string,
Accounts_PasswordReset: PropTypes.bool,
isFetching: PropTypes.bool,
failure: PropTypes.bool
}
static defaultProps = {
Accounts_PasswordReset: true
}
constructor(props) {
super(props);
this.state = {
@ -195,7 +200,7 @@ class LoginView extends React.Component {
renderUserForm = () => {
const {
Accounts_EmailOrUsernamePlaceholder, Accounts_PasswordPlaceholder, isFetching
Accounts_EmailOrUsernamePlaceholder, Accounts_PasswordPlaceholder, Accounts_PasswordReset, isFetching
} = this.props;
return (
<SafeAreaView style={sharedStyles.container} testID='login-view' forceInset={{ vertical: 'never' }}>
@ -229,12 +234,14 @@ class LoginView extends React.Component {
loading={isFetching}
disabled={!this.valid()}
/>
{Accounts_PasswordReset && (
<Button
title={I18n.t('Forgot_password')}
type='secondary'
onPress={this.forgotPassword}
testID='login-view-forgot-password'
/>
)}
<View style={styles.bottomContainer}>
<Text style={styles.dontHaveAccount}>{I18n.t('Dont_Have_An_Account')}</Text>
<Text
@ -272,7 +279,8 @@ const mapStateToProps = state => ({
error: state.login.error && state.login.error.data,
Site_Name: state.settings.Site_Name,
Accounts_EmailOrUsernamePlaceholder: state.settings.Accounts_EmailOrUsernamePlaceholder,
Accounts_PasswordPlaceholder: state.settings.Accounts_PasswordPlaceholder
Accounts_PasswordPlaceholder: state.settings.Accounts_PasswordPlaceholder,
Accounts_PasswordReset: state.settings.Accounts_PasswordReset
});
const mapDispatchToProps = dispatch => ({