forked from sgirvan/fsl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ForgotForm.js
93 lines (84 loc) · 1.69 KB
/
ForgotForm.js
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
84
85
86
87
88
89
90
91
92
93
import React, { Component } from 'react';
import {
Platform,
StyleSheet,
Text,
View,
TextInput,
TouchableOpacity,
StatusBar,
Alert
} from 'react-native';
import { Actions } from 'react-native-router-flux';
import firebase from 'firebase';
export class ForgotForm extends Component {
constructor(props) {
super(props);
this.state = {
email: '',
};
this.submit=this.submit.bind(this);
}
submit() {
firebase.auth().sendPasswordResetEmail(this.state.email)
.then(function() {
Alert.alert("Password Reset Email Sent!");
Actions.pop();
})
.catch(function(error) {
Alert.alert(error.message);
this.setState({
email: '',
});
}.bind(this));
}
render() {
return (
<View style = {styles.container}>
<StatusBar
barStyle="light-content"
/>
<TextInput
placeholder="username or email"
placeholderTextColor='rgba(255,255,255,0.7)'
returnKeyType="next"
keyboardType="email-address"
autoCapitalize="none"
autoCorrect={false}
style={styles.input}
onChangeText={(email) => this.setState({email})}
value={this.state.email}
/>
<TouchableOpacity style={styles.buttonContainer}>
<Text
style={styles.buttonText}
onPress={this.submit}
>
Submit
</Text>
</TouchableOpacity>
</View>
);
}
}
const styles = StyleSheet.create({
container: {
padding: 20,
},
input: {
height: 40,
backgroundColor: 'rgba(255,255,255,0.2)',
marginBottom: 10,
color: '#FFF',
paddingHorizontal: 10,
},
buttonContainer: {
backgroundColor: '#2980b9',
paddingVertical: 15,
},
buttonText: {
textAlign: 'center',
color: '#FFFFFF',
fontWeight: '700'
}
});