Skip to content

Email verification not sent to edu account #329

Open
@Joe-ChenZ

Description

@Joe-ChenZ

handler code:

const handleEmailVerification = (user) => {
      console.log("email verification sent")
      console.log(user);
      if (user)
        user.sendEmailVerification()
          .then(_ => alert(`Email Verification is sent to ${email}`))
          .catch(error => alert(error.message))
      else alert("User is null")
    }

    const handleDeleteUser = () => {
      const {user} = auth.currentUser
      if (user) {
        user.delete()
        console.log(`delete account ${email}`)
        return
      }
      auth
        .signInWithEmailAndPassword(email, password)
        .then(userCredentials => {
          const user = userCredentials.user;
          // console.log('Logged in with:', user.email);
          user.delete();
          console.log(`delete account ${email}`)
        })
        .catch(error => alert(error.message))
      // console.log(auth.currentUser)
    }

    const handleSignUp = () => {
      const {user} = auth
        .createUserWithEmailAndPassword(email, password)
        .then(userCredentials => {
          const user = userCredentials.user;
          console.log('Registered with:', user.email);

          handleEmailVerification(user)
        })
        .catch(error => alert(error.message))
      
      
    }

    const handleLogin = () => {
      const user = auth.currentUser;
      if (user) {
        user.reload().then(_ => {
          if (user.emailVerified) {
            auth
            .signInWithEmailAndPassword(email, password)
            .then(userCredentials => {
              const user = userCredentials.user;
              console.log('Logged in with:', user.email);
            })
            .catch(error => alert(error.message));
          } else {
            alert("email is not verified");
          }
        })
      } else {
        alert("User is null");
      }

UI code:

<KeyboardAvoidingView
      style={styles.container}
      behavior="padding"
    >
      <View style={styles.inputContainer}>
        <View>
        <TextInput
          placeholder="GT Username"
          value={email}
          onChangeText={text => setEmail(text)}
          style={styles.input}
          />
        </View>
        <TextInput
          placeholder="Password"
          value={password}
          onChangeText={text => setPassword(text)}
          style={styles.input}
          secureTextEntry
        />
      </View>

      <View style={styles.buttonContainer}>
        <TouchableOpacity
          onPress={handleLogin}
          style={styles.button}
        >
          <Text style={styles.buttonText}>Login</Text>
        </TouchableOpacity>

        <TouchableOpacity
          onPress={handleSignUp}
          style={[styles.button, styles.buttonOutline]}
        >
        <Text style={styles.buttonOutlineText}>Register</Text>
        </TouchableOpacity>

        <TouchableOpacity
          onPress={handleDeleteUser}
          style={[styles.button, styles.buttonOutline]}
        >
        <Text style={styles.buttonOutlineText}>Delete Account</Text>
        </TouchableOpacity>
        <TouchableOpacity
          onPress={()=>handleEmailVerification(auth.currentUser)}
          style={[styles.button, styles.buttonOutline]}
        >
        <Text style={styles.buttonOutlineText}>Resend Email Verification</Text>
        </TouchableOpacity>
      </View>

      
    </KeyboardAvoidingView>

firebase auth

import * as firebase from "firebase";
const auth = firebase.auth()

Very oddly, this code works for my personal gmail account, but no verification is ever sent to my school account, which ends with @gatech.edu

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions