diff --git a/src/components/Forms/DropdownForm.tsx b/src/components/Forms/DropdownForm.tsx index ab3fbf889271091238343c378340b8bf627a9f2f..3554f48f8c74823815f40902196c692841bce4db 100644 --- a/src/components/Forms/DropdownForm.tsx +++ b/src/components/Forms/DropdownForm.tsx @@ -36,6 +36,7 @@ const DropdownForm = ({ } return ( { - if (validateEmail(email)) { - firebase.auth().sendPasswordResetEmail(email); - nav.navigate("Auth", { screen: "ForgotPasswordDone" }); - } + forgotPassword(email) + .then(() => + nav.navigate("Auth", { screen: "ForgotPasswordDone" }) + ) + .catch((e) => + Alert.alert( + "Email tidak ditemukan", + "Silahkan masukkan email yang terdaftar" + ) + ); }} /> diff --git a/src/screens/auth/RegisterScreen.tsx b/src/screens/auth/RegisterScreen.tsx index 7679c3a4ae90f115240f879a1168c310424ec6f9..a81d1e2b8278b7be0dff136cfc062d7671149f85 100644 --- a/src/screens/auth/RegisterScreen.tsx +++ b/src/screens/auth/RegisterScreen.tsx @@ -54,87 +54,85 @@ const RegisterScreen = ({ navigation }: RootTabScreenProps<"TabOne">) => { }; return ( - - - - Selamat Datang! - - - - nav.navigate("Auth", { screen: "RegisterGoogle" })} - /> - - - - nav.navigate("Auth", { screen: "RegisterGoogle" })} - /> - - - - - Silakan isi formulir berikut untuk membuat akun Click - - - - - - - - - - - - - - - - - - - - - - - + + + Selamat Datang! + + + + nav.navigate("Auth", { screen: "RegisterGoogle" })} + /> + + + + nav.navigate("Auth", { screen: "RegisterGoogle" })} + /> + + + + + Silakan isi formulir berikut untuk membuat akun Click + + + + + + + + + + + + + + + + + + + + + + @@ -161,18 +159,15 @@ const RegisterScreen = ({ navigation }: RootTabScreenProps<"TabOne">) => { - - + + ); }; const styles = StyleSheet.create({ container: { - flex: 1, - fontStyle: "normal", - display: "flex", + padding: 24, backgroundColor: Colors.background, - paddingHorizontal: 24, }, titleText: { fontSize: 32, diff --git a/src/service/firebase/auth.ts b/src/service/firebase/auth.ts index 0dca517124a071ddb5735ba937694bc98f97307b..417b8abdced9a0860444a43c4b22d89e8940cf05 100644 --- a/src/service/firebase/auth.ts +++ b/src/service/firebase/auth.ts @@ -35,3 +35,7 @@ export const changePassword = async (password: string) => { export const signUpAuth = async (email: string, password: string) => { return await firebase.auth().createUserWithEmailAndPassword(email, password); }; + +export const forgotPassword = async (email: string) => { + return await firebase.auth().sendPasswordResetEmail(email); +};