Fix login and use login placeholders from settings

This commit is contained in:
Rodrigo Nascimento 2017-08-13 20:14:02 -03:00
parent 10652002bc
commit 0ccfbbb574
2 changed files with 9 additions and 6 deletions

View File

@ -190,7 +190,6 @@ const RocketChat = {
} }
} }
console.log({ params });
this.login(params, callback); this.login(params, callback);
}, },

View File

@ -29,14 +29,18 @@ const styles = StyleSheet.create({
}); });
@connect(state => ({ @connect(state => ({
server: state.server server: state.server,
Accounts_EmailOrUsernamePlaceholder: state.settings.Accounts_EmailOrUsernamePlaceholder,
Accounts_PasswordPlaceholder: state.settings.Accounts_PasswordPlaceholder
}), dispatch => ({ }), dispatch => ({
actions: bindActionCreators(actions, dispatch) actions: bindActionCreators(actions, dispatch)
})) }))
export default class LoginView extends React.Component { export default class LoginView extends React.Component {
static propTypes = { static propTypes = {
navigator: PropTypes.object.isRequired, navigator: PropTypes.object.isRequired,
server: PropTypes.string.isRequired server: PropTypes.string.isRequired,
Accounts_EmailOrUsernamePlaceholder: PropTypes.string,
Accounts_PasswordPlaceholder: PropTypes.string
} }
static navigationOptions = () => ({ static navigationOptions = () => ({
@ -63,7 +67,7 @@ export default class LoginView extends React.Component {
} }
submit = () => { submit = () => {
RocketChat.loginWithPassword({ username: this.state.username }, this.state.password, () => { RocketChat.loginWithPassword(this.state.username, this.state.password, () => {
this.props.navigator.dismissModal(); this.props.navigator.dismissModal();
}); });
} }
@ -80,7 +84,7 @@ export default class LoginView extends React.Component {
autoCapitalize='none' autoCapitalize='none'
autoFocus autoFocus
onSubmitEditing={this.submit} onSubmitEditing={this.submit}
placeholder='Email or username' placeholder={this.props.Accounts_EmailOrUsernamePlaceholder || 'Email or username'}
/> />
<TextInput <TextInput
style={styles.input} style={styles.input}
@ -90,7 +94,7 @@ export default class LoginView extends React.Component {
returnKeyType='done' returnKeyType='done'
autoCapitalize='none' autoCapitalize='none'
onSubmitEditing={this.submit} onSubmitEditing={this.submit}
placeholder='Password' placeholder={this.props.Accounts_PasswordPlaceholder || 'Password'}
/> />
</KeyboardView> </KeyboardView>
); );