Typos, iOS player and reset password
This commit is contained in:
@@ -10,16 +10,33 @@ let LoginForm = () => {
|
||||
const [email, setEmail] = useState('');
|
||||
const [password, setPassword] = useState('');
|
||||
const [error, setError] = useState('');
|
||||
const [tries, setTries] = useState(0);
|
||||
const navigation = useNavigation();
|
||||
const resetPasswordBol = tries > 2;
|
||||
|
||||
const loginCall = async ()=>{
|
||||
const resetPassword = async () => {
|
||||
await API.resetPassword(email);
|
||||
alert("We sent you instructions to your email!")
|
||||
}
|
||||
|
||||
const loginCall = async () => {
|
||||
let r = await API.logIn(email.trim(), password);
|
||||
if (r.status === "ok") return navigation.reset({
|
||||
index: 0,
|
||||
routes: [{ name: 'MainNavigation' }],
|
||||
});
|
||||
index: 0,
|
||||
routes: [{ name: 'MainNavigation' }],
|
||||
});
|
||||
//console.log(r)
|
||||
setError(r.status);
|
||||
if (r.status === 'incorrect password') {
|
||||
if (resetPasswordBol) {
|
||||
await resetPassword();
|
||||
setTries(0);
|
||||
} else {
|
||||
setTries(tries + 1);
|
||||
}
|
||||
} else {
|
||||
setTries(0);
|
||||
}
|
||||
//alert(i18n.t('message.wrongInformation'))
|
||||
};
|
||||
|
||||
@@ -29,7 +46,7 @@ let LoginForm = () => {
|
||||
style={styles.logo}
|
||||
source={require('./../assets/icon.png')}
|
||||
/>
|
||||
<Text style={styles.header}>EMI Social</Text>
|
||||
<Text style={styles.header}>EMI Fellowship</Text>
|
||||
<Text >{i18n.t("message.login")}</Text>
|
||||
<TextInput
|
||||
style={styles.input}
|
||||
@@ -41,6 +58,7 @@ let LoginForm = () => {
|
||||
autoComplete='email'
|
||||
autoCorrect={false}
|
||||
mode="outlined"
|
||||
keyboardType='email-address'
|
||||
/>
|
||||
{error !== '' && error !== 'incorrect password' ? <HelperText type="error" visible={true}>
|
||||
{i18n.t("message.invalidEmail")}
|
||||
@@ -61,12 +79,26 @@ let LoginForm = () => {
|
||||
{error === 'incorrect password' ? <HelperText type="error" visible={true}>
|
||||
{i18n.t("message.reviewPassword")}
|
||||
</HelperText> : <></>}
|
||||
<Button
|
||||
style={styles.button}
|
||||
onPress={async () => {
|
||||
await loginCall();
|
||||
}}
|
||||
>{i18n.t("message.submit")}</Button>
|
||||
<View style={{ flexDirection: "row" }}>
|
||||
<Button
|
||||
style={styles.button}
|
||||
onPress={async () => {
|
||||
await loginCall();
|
||||
}}
|
||||
>
|
||||
{resetPasswordBol ? i18n.t("message.resetPassword") : i18n.t("message.submit")}
|
||||
</Button>
|
||||
{
|
||||
resetPasswordBol ? <Button
|
||||
style={styles.button}
|
||||
onPress={async () => {
|
||||
setTries(0);
|
||||
}}
|
||||
>
|
||||
{i18n.t("message.cancel")}
|
||||
</Button> : <></>
|
||||
}
|
||||
</View>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
@@ -92,17 +124,17 @@ const styles = StyleSheet.create({
|
||||
color: '#777',
|
||||
alignContent: 'center'
|
||||
},
|
||||
logo:{
|
||||
width: 250,
|
||||
logo: {
|
||||
width: 250,
|
||||
height: 250,
|
||||
justifyContent: 'center',
|
||||
alignItems: 'center',
|
||||
},
|
||||
input:{
|
||||
input: {
|
||||
backgroundColor: 'white',
|
||||
width: "80%"
|
||||
},
|
||||
button:{
|
||||
button: {
|
||||
marginTop: 10,
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user