decryption for password

This commit is contained in:
Maria Sanchez 2022-08-29 17:15:46 -06:00
parent 0ebe59cb80
commit 697d55b5d5
3 changed files with 13 additions and 43 deletions

View File

@ -7,6 +7,7 @@ import {
import { Dimensions, StyleSheet, TextInput, useWindowDimensions } from "react-native"; import { Dimensions, StyleSheet, TextInput, useWindowDimensions } from "react-native";
import { UserContext } from "../context/UserContext"; import { UserContext } from "../context/UserContext";
import { createMaterialTopTabNavigator } from '@react-navigation/material-top-tabs'; import { createMaterialTopTabNavigator } from '@react-navigation/material-top-tabs';
import { stringMd5 } from 'react-native-quick-md5';
const { Navigator, Screen } = createMaterialTopTabNavigator(); const { Navigator, Screen } = createMaterialTopTabNavigator();
@ -19,19 +20,18 @@ export default function Profile({ navigation }) {
const [password, setPassword] = useState(); const [password, setPassword] = useState();
const [index, setIndex] = useState(0); const [index, setIndex] = useState(0);
const layout = useWindowDimensions(); const layout = useWindowDimensions();
// const [routes] = useState([{
// key: "first",
// title: 'Información'
// }, {
// key: "second",
// title: 'Contraseña'}])
const userData = useContext(UserContext) const userData = useContext(UserContext)
const id = userData.user._id; const id = userData.user._id;
const decode = userData.Password;
console.log(userData.user); console.log(userData.user);
const onHandleChangePassword = (value) => {
console.log(value);
const dpassword = stringMd5(value)
console.log(dpassword);
}
const ProfileView = () => ( const ProfileView = () => (
<ScrollView width='100%' h='550' ml='36' _contentContainerStyle={{ <ScrollView width='100%' h='550' ml='36' _contentContainerStyle={{
@ -107,7 +107,7 @@ export default function Profile({ navigation }) {
<VStack space={3} mt="5"> <VStack space={3} mt="5">
<FormControl> <FormControl>
<FormControl.Label>Contraseña actual</FormControl.Label> <FormControl.Label>Contraseña actual</FormControl.Label>
<TextInput style={styles.input} type="password" defaultValue="" onChangeText={(value) => setPassword(value) }/> <TextInput style={styles.input} type="password" defaultValue="" onChangeText={(value) => onHandleChangePassword(value) }/>
</FormControl> </FormControl>
<FormControl> <FormControl>
<FormControl.Label>Nueva Contraseña</FormControl.Label> <FormControl.Label>Nueva Contraseña</FormControl.Label>
@ -131,40 +131,9 @@ export default function Profile({ navigation }) {
) )
// const initialLayout = { const updatePassword = async() =>{
// width: Dimensions.get('window').width
// }
// const renderScene = SceneMap({
// first: ProfileView,
// second: PasswordView
// })
// const renderTabBar = props => {
// const inputRange = props.navigationState.routes.map((x, i) => i);
// return <Box flexDirection="row">
// {props.navigationState.routes.map((route, i) => {
// const opacity = props.position.interpolate({
// inputRange,
// outputRange: inputRange.map(inputIndex => inputIndex === i ? 1 : 0.5)
// });
// const color = index === i ? useColorModeValue('#000', '#e5e5e5') : useColorModeValue('#1f2937', '#a1a1aa');
// const borderColor = index === i ? 'cyan.500' : useColorModeValue('coolGray.200', 'gray.400');
// return <Box borderBottomWidth="3" borderColor={borderColor} flex={1} alignItems="center" p="3" cursor="pointer">
// <Pressable onPress={() => {
// console.log(i);
// setIndex(i);
// }}>
// <Animated.Text style={{
// color
// }}>{route.title}</Animated.Text>
// </Pressable>
// </Box>;
// })}
// </Box>;
// };
}
const updateInfo = async() => { const updateInfo = async() => {

View File

@ -1,6 +1,6 @@
import { format } from "date-fns"; import { format } from "date-fns";
import { import {
Box, HStack, Box,
ScrollView, ScrollView,
Text, Text,
Stack, Stack,

View File

@ -34,6 +34,7 @@
"react-native": "0.64.3", "react-native": "0.64.3",
"react-native-gesture-handler": "~2.1.0", "react-native-gesture-handler": "~2.1.0",
"react-native-pager-view": "5.4.9", "react-native-pager-view": "5.4.9",
"react-native-quick-md5": "^3.0.4",
"react-native-reanimated": "~2.3.1", "react-native-reanimated": "~2.3.1",
"react-native-safe-area-context": "3.3.2", "react-native-safe-area-context": "3.3.2",
"react-native-screens": "~3.10.1", "react-native-screens": "~3.10.1",