Skip to content

Commit

Permalink
removed email validation when registering
Browse files Browse the repository at this point in the history
  • Loading branch information
Diwakar-Gupta committed Dec 18, 2023
1 parent e3aebe8 commit 3386e99
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 27 deletions.
14 changes: 9 additions & 5 deletions src/components/HavingTrouble/HavingTrouble.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,24 @@ import {View, Text, StyleSheet} from 'react-native';

const HavingTrouble = ({error}) => {
return (
<View style={error ? styles.Error : styles.HavingTrouble}>
<Text>{error ? error : ''}</Text>
<View style={styles.HavingTrouble}>
<Text style={error ? styles.ErrorText : styles.DefaultText}>
{error ? error : ''}
</Text>
</View>
);
};

const styles = StyleSheet.create({
HavingTrouble: {
color: '#1a1a1a',
marginTop: '5%',
},
Error: {
DefaultText: {
color: '#1a1a1a',
},
ErrorText: {
color: 'red',
marginTop: '5%',
fontSize: 15, // Adjust the font size as needed
},
});

Expand Down
37 changes: 15 additions & 22 deletions src/screens/SignInScreen/SignInScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,30 +28,23 @@ const registerBackend = async (userInfo, did) => {
const userEmail = userInfo.user.email;
const domain_name_provider = userEmail?.split('@')[1];
const token = await signToken(userEmail, did);
if (
domain_name_provider === 'sst.scaler.com' ||
domain_name_provider === 'scaler.com'
) {
const UserToLogin = {
name: userInfo.user.name,
jwtToken: token,
fcmtoken: await AsyncStorage.getItem('fcmtoken'),
};
const UserToLogin = {
name: userInfo.user.name,
jwtToken: token,
fcmtoken: await AsyncStorage.getItem('fcmtoken'),
};

const response = await fetch(domain_URL + '/attendance/register/', {
method: 'POST',
body: JSON.stringify(UserToLogin),
});
const response = await fetch(domain_URL + '/attendance/register/', {
method: 'POST',
body: JSON.stringify(UserToLogin),
});

if (response.ok) {
const data = await response.json();
return {status: 'success', ...data};
} else {
const errorMessage = await response.json();
return {status: 'error', message: errorMessage.message};
}
if (response.ok) {
const data = await response.json();
return {status: 'success', ...data};
} else {
return {status: 'error', message: 'User Not authorised to signin'};
const errorMessage = await response.json();
return {status: 'error', message: errorMessage.message};
}
};

Expand Down Expand Up @@ -127,7 +120,7 @@ const SignInScreen = () => {
const styles = StyleSheet.create({
root: {
alignItems: 'center',
padding:20,
padding: 20,
},
logo: {
maxWidth: 300,
Expand Down

0 comments on commit 3386e99

Please sign in to comment.