Skip to content

Commit

Permalink
turn these into functions so they function properly
Browse files Browse the repository at this point in the history
  • Loading branch information
rickycodes committed Aug 17, 2021
1 parent 3ab6e9d commit ecff068
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions app/components/Views/Login/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -184,11 +184,11 @@ const styles = StyleSheet.create({
});

const DELETE = 'delete';
const PASSCODE_NOT_SET_ERROR = strings('login.passcode_not_set_error');
const WRONG_PASSWORD_ERROR = strings('login.wrong_password_error');
const WRONG_PASSWORD_ERROR_ANDROID = strings('login.wrong_password_error_android');
const VAULT_ERROR = strings('login.vault_error');
const CLEAN_VAULT_ERROR = strings('login.clean_vault_error');
const PASSCODE_NOT_SET_ERROR = () => strings('login.passcode_not_set_error');
const WRONG_PASSWORD_ERROR = () => strings('login.wrong_password_error');
const WRONG_PASSWORD_ERROR_ANDROID = () => strings('login.wrong_password_error_android');
const VAULT_ERROR = () => strings('login.vault_error');
const CLEAN_VAULT_ERROR = () => strings('login.clean_vault_error');
const isTextDelete = text => tlc(text) === DELETE;

/**
Expand Down Expand Up @@ -319,24 +319,24 @@ class Login extends PureComponent {
// Should we force people to enable passcode / biometrics?
const error = e.toString();
if (
toLowerCaseEquals(error, WRONG_PASSWORD_ERROR) ||
toLowerCaseEquals(error, WRONG_PASSWORD_ERROR_ANDROID)
toLowerCaseEquals(error, WRONG_PASSWORD_ERROR()) ||
toLowerCaseEquals(error, WRONG_PASSWORD_ERROR_ANDROID())
) {
this.setState({ loading: false, error: strings('login.invalid_password') });

trackErrorAsAnalytics('Login: Invalid Password', error);

return;
} else if (error === PASSCODE_NOT_SET_ERROR) {
} else if (error === PASSCODE_NOT_SET_ERROR()) {
Alert.alert(
'Security Alert',
'In order to proceed, you need to turn Passcode on or any biometrics authentication method supported in your device (FaceID, TouchID or Fingerprint)'
);
this.setState({ loading: false });
} else if (toLowerCaseEquals(error, VAULT_ERROR)) {
} else if (toLowerCaseEquals(error, VAULT_ERROR())) {
this.setState({
loading: false,
error: CLEAN_VAULT_ERROR
error: CLEAN_VAULT_ERROR()
});
} else {
this.setState({ loading: false, error });
Expand Down

0 comments on commit ecff068

Please sign in to comment.