【问题标题】:Why do I keep getting this error: Error: Email is badly formatted?为什么我不断收到此错误:错误:电子邮件格式错误?
【发布时间】:2020-08-31 19:20:43
【问题描述】:

在我的网站上输入此电子邮件地址 (danidust277@gmail.com) 时,我不断收到此错误消息。为什么?

HTML:

<div>
    <input type="text" id="update_profile_displayname" placeholder="Display Name"><br></br>
    <input type="email" id="update_profile_email" placeholder="Email Address"><br></br>
    <button type="button" type="submit" id="update_profile_submit">Save changes</button>
</div>

JS:

var update_email = document.getElementById("update_profile_email");    
var update_name = document.getElementById("update_profile_displayname");

user.updateEmail('update_email').then(function() {    
}).catch(function(error) {
    console.log(error)
    window.alert(`An error occured:${error}`);  
})

【问题讨论】:

  • 我不知道你使用的库,但我猜'update_email'应该是update_email.value

标签: javascript html firebase firebase-authentication


【解决方案1】:

我猜user.updateEmail 是一种接受有效电子邮件地址作为参数的方法。在这种情况下,您不应传递字符串“update_email”,而是传递输入字段的值,这将导致user.updateEmail(update_email.value)。你已经试过了吗?

【讨论】:

    【解决方案2】:

    我认为您应该将 update_email.value 作为参数传递给 user.updateEmail,就像上面 Davide Bulbarelli 所说的那样。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-11-28
      • 1970-01-01
      • 1970-01-01
      • 2018-02-24
      • 1970-01-01
      • 2018-07-15
      相关资源
      最近更新 更多