diff --git a/ForgotForm.js b/ForgotForm.js index 53361bc..2d0878b 100644 --- a/ForgotForm.js +++ b/ForgotForm.js @@ -27,11 +27,11 @@ export class ForgotForm extends Component { submit() { firebase.auth().sendPasswordResetEmail(this.state.email) .then(function() { - alert("Password Reset Email Sent!"); + Alert.alert("Password Reset Email Sent!"); Actions.pop(); }) .catch(function(error) { - alert(error.message); + Alert.alert(error.message); this.setState({ email: '', }); diff --git a/LoginForm.js b/LoginForm.js index 09bfa75..099bc7d 100644 --- a/LoginForm.js +++ b/LoginForm.js @@ -6,13 +6,13 @@ import { View, TextInput, TouchableOpacity, - StatusBar + StatusBar, + Alert } from 'react-native'; import { Actions } from 'react-native-router-flux'; import * as firebase from 'firebase'; - export class LoginForm extends Component { constructor(props) { @@ -20,6 +20,7 @@ export class LoginForm extends Component { this.state = { email: '', password: '', + state: '' }; this.onLoginPress=this.onLoginPress.bind(this); } @@ -32,7 +33,7 @@ export class LoginForm extends Component { // email not empty if(!uname.length) { - alert("Please enter email!"); + Alert.alert("Please enter email!"); this.setState({ email: '', password: '', @@ -51,14 +52,13 @@ export class LoginForm extends Component { // pw length, contains lower/upper case and special char if(pw.length < 6 || pw.length > 12 || pw.toUpperCase() == pw || pw.toLowerCase() == pw || !speicalCharCheck(pw)) { - alert("Invalid Password!"); + Alert.alert("Invalid Password!"); this.setState({ password: '', }); return; } - // authenticate email and password here firebase.auth().signInWithEmailAndPassword(this.state.email, this.state.password) .then(function() { @@ -75,10 +75,10 @@ export class LoginForm extends Component { var errorCode = error.code; var errorMessage = error.message; if (errorCode === 'auth/wrong-password') { - alert('Wrong password.'); + Alert.alert('Wrong password.'); } else { - alert(errorMessage); + Alert.alert(errorMessage); } this.setState({ password: '', diff --git a/SignupForm.js b/SignupForm.js index e40752a..02e85a1 100644 --- a/SignupForm.js +++ b/SignupForm.js @@ -6,7 +6,8 @@ import { View, TextInput, TouchableOpacity, - StatusBar + StatusBar, + Alert } from 'react-native'; import { Actions } from 'react-native-router-flux'; @@ -33,7 +34,7 @@ export class SignupForm extends Component { // email not empty if(!uname.length) { - alert("Please enter email!"); + Alert.alert("Please enter email!"); this.setState({ email: '', password: '', @@ -43,7 +44,7 @@ export class SignupForm extends Component { // pw length if(pw.length < 6 || pw.length > 12) { - alert("Invalid Password Length (6-12 characters)"); + Alert.alert("Invalid Password", "Length should be 6-12 characters"); this.setState({ password: '', }); @@ -52,7 +53,7 @@ export class SignupForm extends Component { // has upper/lower chars if(pw.toUpperCase() == pw || pw.toLowerCase() == pw) { - alert("Invalid Password (must contain Uppercase and Lowercase letters)"); + Alert.alert("Invalid Password", "Password must contain at least one uppercase and lowercase letter."); this.setState({ password: '', }); @@ -72,7 +73,7 @@ export class SignupForm extends Component { } if(!speicalCharCheck(pw)) { - alert("Invalid Password (must contain one speical character)"); + Alert.alert("Invalid Password", "Password must contain at least one speical character."); this.setState({ password: '', }); @@ -85,7 +86,7 @@ export class SignupForm extends Component { firebase.auth().createUserWithEmailAndPassword(this.state.email, pw) .then(function() { - alert("Sign up successful!"); + Alert.alert("Sign up successful!"); // return to login page after sign up Actions.pop(); })