-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathforgetpassword.js
More file actions
85 lines (74 loc) · 2.09 KB
/
forgetpassword.js
File metadata and controls
85 lines (74 loc) · 2.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
import React, { Component } from 'react';
import {
Platform,
Button,
StyleSheet,
Text,
TextInput,
View,
AsyncStorage,
TouchableOpacity,
} from 'react-native';
import {styles} from './styles';
export default class forgetpassword extends React.Component {
constructor(props) {
super(props);
this.state = { email: '' ,password: ''};
}
async checkUser(data) {
try {
let response = await fetch('http://ec2-3-14-86-69.us-east-2.compute.amazonaws.com/forgetpassword', {
method: 'POST',
headers: {
Accept: 'application/json',
'Content-Type': 'application/json',
},
body: JSON.stringify(data),
});
let responseJson = await response.json();
return responseJson;
} catch (error) {
console.log(error);
return;
}
}
render() {
return (
<View style={styles.container}>
<View style={styles.innerContainer}>
<Text style={styles.header}>Password Reset</Text>
<TextInput
style={styles.textinput}
placeholder="Your email"
underlineColorAndroid={'transparent'}
onChangeText={email => this.setState({ email })}
/>
<TextInput
style={styles.textinput}
placeholder="Your Password"
secureTextEntry={true}
underlineColorAndroid={'transparent'}
onChangeText={password => this.setState({ password })}
/>
<TouchableOpacity
style={styles.button}
onPress={
async () => {
try{
let temp = this.checkUser(this.state)
// .then(
// console.log(this.state);
alert("Password has been sent to your registered email address.")
this.props.navigation.navigate('login')
// );
} catch (err) {
console.log(err);
}
}}>
<Text style={styles.btntext}>Confirm</Text>
</TouchableOpacity>
</View>
</View>
);
}
}