diff --git a/src/app/screens/PasswordRecoveryChangePswdScreen.js b/src/app/screens/PasswordRecoveryChangePswdScreen.js index 66b9a6e..d5cb841 100644 --- a/src/app/screens/PasswordRecoveryChangePswdScreen.js +++ b/src/app/screens/PasswordRecoveryChangePswdScreen.js @@ -1,4 +1,4 @@ -import React, { useState } from "react"; +import React, { useContext, useState } from "react"; import { StyleSheet, View, Text } from "react-native"; import * as Yup from "yup"; @@ -9,6 +9,7 @@ import PasswordFormField from "../components/forms/PasswordFormField"; import ConfirmationModal from "../components/ConfirmationModal"; import { updatePassword } from "../api/auth"; import { KeyboardAwareScrollView } from "react-native-keyboard-aware-scroll-view"; +import { AuthContext } from "../auth/context"; const validationSchema = Yup.object().shape({ password: Yup.string() @@ -24,6 +25,7 @@ const validationSchema = Yup.object().shape({ export default function PasswordRecoveryChangePswd({ navigation, route }) { const authToken = route.params.authToken; const username = route.params.username; + const authContext = useContext(AuthContext); const [confirmatioModalData, setConfirmatioModalData] = useState({ show: false, @@ -44,7 +46,8 @@ export default function PasswordRecoveryChangePswd({ navigation, route }) { message: "Senha alterada com sucesso", show: true, onConfirmAction: () => { - navigation.navigate("Login"); + authContext.setUser(); + navigation.popToTop(); }, }); break; diff --git a/src/app/screens/PasswordRecoveryScreen.js b/src/app/screens/PasswordRecoveryScreen.js index 560d82f..e6b9de4 100644 --- a/src/app/screens/PasswordRecoveryScreen.js +++ b/src/app/screens/PasswordRecoveryScreen.js @@ -136,6 +136,8 @@ export default function PasswordRecovery({ navigation, route }) { setConfirmatioModalData({ show: false })} /> diff --git a/src/app/screens/UpdateUserInfoScreen.js b/src/app/screens/UpdateUserInfoScreen.js index 66502b1..b92764a 100644 --- a/src/app/screens/UpdateUserInfoScreen.js +++ b/src/app/screens/UpdateUserInfoScreen.js @@ -19,7 +19,6 @@ import { states, statesToCities } from "../assets/cities_states"; import PasswordFormField from "../components/forms/PasswordFormField"; import storage from "../auth/storage"; import { AuthContext } from "../auth/context"; -import getPluviometerStation from "../hooks/usePluviometricStation"; //#region PICKERS @@ -59,47 +58,6 @@ function InstitutionNamePicker({ name }) { ); } -function SecQuestionPicker({ name }) { - const [items, setItems] = useState([ - { value: "Qual a sua cor predileta?", label: "Qual a sua cor predileta?" }, - { - value: "Qual é seu livro predileto?", - label: "Qual é seu livro predileto?", - }, - { - value: "Qual o nome da rua em que você cresceu?", - label: "Qual o nome da rua em que você cresceu?", - }, - { - value: "Qual o nome do seu bicho de estimação predileto?", - label: "Qual o nome do seu bicho de estimação predileto?", - }, - { - value: "Qual a sua comida predileta?", - label: "Qual a sua comida predileta?", - }, - { - value: "Qual é o seu país preferido?", - label: "Qual é o seu país preferido?", - }, - { - value: "Qual é a sua marca de carro predileto?", - label: "Qual é a sua marca de carro predileto?", - }, - ]); - - return ( - - ); -} - function RolePicker({ name }) { const [items, setItems] = useState([ { value: "ROLE_INSTITUTION", label: "Responsável" }, @@ -284,7 +242,7 @@ export default function UpdateUserInfoScreen({ route, navigation }) { .matches(/[a-zA-Z]/, "O nome só pode conter letras"), state: Yup.string().required("O estado é obrigatório"), city: Yup.string().required("A cidade é obrigatória"), - institutionName: Yup.string(), + institutionName: Yup.string().required("A instituição é obrigatória"), }); const passwordSchema = Yup.object().shape({