Skip to content

Commit

Permalink
Ajustes na tela de esqueci minha senha, e config do app.json funciona…
Browse files Browse the repository at this point in the history
…ndo para o APK
  • Loading branch information
Faehzin committed Dec 16, 2024
1 parent 352bfc2 commit 64d899c
Show file tree
Hide file tree
Showing 4 changed files with 91 additions and 13 deletions.
14 changes: 12 additions & 2 deletions app.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
"supportsTablet": true
},
"android": {
"permissions": [],
"usesCleartextTraffic": true,
"adaptiveIcon": {
"foregroundImage": "./assets/adaptive-icon.png",
"backgroundColor": "#ffffff"
Expand All @@ -34,14 +36,22 @@
},
"plugins": [
"expo-router",
"expo-build-properties"
[
"expo-build-properties",
{
"android": {
"usesCleartextTraffic": true
}
}
]
],
"extra": {
"expoEnv": "process.env.EXPO_PUBLIC_API_URL",
"router": {
"origin": false
},
"eas": {
"projectId": "7b777975-c65a-4ae3-ab23-93691fd81c12"
"projectId": "53b640fc-f72d-4fb5-88b4-c80d4162aa8b"
}
},
"runtimeVersion": {
Expand Down
47 changes: 47 additions & 0 deletions src/app/components/RecoverButton.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import React from "react";
import { ActivityIndicator, StyleSheet, Text } from "react-native";
import { router } from "expo-router";
import { View } from 'react-native';

interface Props {
title: string;
showLoading?: boolean;
}

export default function RecoverButton({
title,
showLoading,
}: Readonly<Props>) {

const handlePress = () => {
router.push("/private/pages/event");
};

return (
<View>
{showLoading ? (
<ActivityIndicator size="small" color="#0000ff" />
) : (
<Text
style={styles.linkText}
onPress={handlePress}
>
{title}
</Text>
)}
</View>
);
}

const styles = StyleSheet.create({
linkText: {
width: "40%",
color: "#2CCDB5",
maxWidth: 300,
textDecorationLine: "underline",
paddingVertical: 12,
paddingHorizontal: 18,
textAlign: "left",
borderRadius: 20,
},
});
36 changes: 28 additions & 8 deletions src/app/private/pages/esqueciSenha.tsx
Original file line number Diff line number Diff line change
@@ -1,30 +1,44 @@
import React, { useState } from "react";
import { forgotPassword } from "../../services/user.service";
import { Alert, Text, View, TextInput, StyleSheet, TouchableOpacity } from "react-native";
import axios from 'axios';
import { Image, Alert, Text, View, TextInput, StyleSheet, TouchableOpacity } from "react-native";
import { router } from "expo-router";
import { ScrollView } from "react-native";
import BackButton from "../../components/BackButton"
//import BackButton from "/components/BackButton.tsx"; Não consigo achar esse caminho, preciso fazer rodar... (é o botão q volta pra outra pag)

export default function EsqueciSenha() {
const API_URL = process.env.EXPO_PUBLIC_API_URL;
const API_PORT = process.env.EXPO_PUBLIC_API_USUARIO_PORT;
const BASE_URL = `${API_URL}:${API_PORT}/api/usuario/esqueci-senha`;
const [email, setEmail] = useState("");

const handleRecuperarSenha = async () => {
if (!email) {
Alert.alert("Erro", "Por favor, insira um email válido.");
return;
}
else if(email){
Alert.alert("Mensagem de email enviada com sucesso!")
router.push("/public/login")
}
try {
const response = await forgotPassword(email);
console.log("E-mail de recuperação enviado:", response);
} catch (error) {
console.error("Erro ao solicitar recuperação de senha:", error.message);
}
};

return (


<View style={styles.container}>
<BackButton color="#000" route="/" />

<View style={styles.imagem}>
<Image
source={require("../../../../assets/logo2.png")}
style={{ width: 200, height: 90 }}
/>
</View>

{/* Logo deveria estar aqui, mas não consegui encaixá-la */}

<Text style={styles.title}>Esqueceu sua senha? </Text>
Expand All @@ -51,11 +65,11 @@ export default function EsqueciSenha() {
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: "center",
justifyContent: "space-between",
alignItems: "center",
backgroundColor: "#FFF",
padding: 16,
},
padding: 20,
},
logo: {
width: 280,
height: 90,
Expand Down Expand Up @@ -100,4 +114,10 @@ const styles = StyleSheet.create({
fontSize: 16,
fontWeight: "600",
},
imagem: {
flex: 1,
justifyContent: "center",
alignItems: "center",
marginTop: 50,
},
});
7 changes: 4 additions & 3 deletions src/app/public/login.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ export default function Login() {
Toast.show({
type: 'error',
text1: 'Erro!',
text2: 'Formato de email inválido!',
text2: 'Formato de email inválido!!',
});
}

Expand All @@ -96,10 +96,11 @@ export default function Login() {
hasErrors = true;
Toast.show({
type: 'error',
text1: 'Erro!',
text2: 'O campo de senha é obrigatório!',
text1: ` ${API_PORT} , ${BASE_URL}`,
text2: `Você está utilizando o endpoint: ${API_URL}`,
});
}


setErros(erros);

Expand Down

0 comments on commit 64d899c

Please sign in to comment.