使用 AngularFire 获取用户电子邮件地址列表

编程入门 行业动态 更新时间:2024-10-28 12:22:15
本文介绍了使用 AngularFire 获取用户电子邮件地址列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时送ChatGPT账号..

我的网络应用程序使用 Firebase JS + AngularFire 来显示应用程序中的用户报告(仅管理员可见).如何使用 AngularFire 检索用户的电子邮件地址?

My web application uses Firebase JS + AngularFire to display a report of users in the application (visible only to admins). How can I retrieve a user's email address using AngularFire?

查看 AngularFire API 参考,我在 $firebaseAuth 部分没有看到执行此操作的可用方法:https://github/firebase/angularfire/blob/master/docs/reference.md

Looking at the AngularFire API Reference, I don't see an available method for doing this in the $firebaseAuth section: https://github/firebase/angularfire/blob/master/docs/reference.md

推荐答案

除非您转到 firebase 控制台并进行手动检查,否则您无法轻松访问它.在 firebase 中,建议您在数据库中创建另一个名为 Users 的节点,用于存储用户信息.这将帮助您在需要时轻松获取信息.

You can't easily access that unless you go to the firebase console and do a manual check. In firebase it is advised that you create another node called Users in your database to be used in storing Users info. This will help you to easily get the info when you need them.

查看我的示例代码,了解如何创建新用户.

Check my sample code on how to create a new user.

  signUp() {

    if (this.signupForm.valid) {
     //grab login form values
          let email = this.signupForm.get('email').value;
          let password = this.signupForm.get('password').value;
          let confirmpassword = this.signupForm.get('confirmpassword').value;
          let petname = this.signupForm.get('petname').value;
          let full_name = this.signupForm.get('full_name').value;
          let address = this.signupForm.get('address').value;
          let phone = this.signupForm.get('phone').value;
          let default_role = this.signupForm.get('default_role').value;

          //signup new user
          this.security.signup(email, password).then((response) => {

            //userid
            let userid = response.auth.uid;

            //create a new user using form values
            let newUser: User = {
              full_name: full_name,
              password: password,
              petname: petname,
              email: email,
              phone: phone,
              default_role: default_role,
              usercode: newusercode
            };

            //add new user to database table section
            this.af.database.object("/Users/" + userid).set(newUser).then(() => {

              //prepare userinfo for cache
              let userInfo = {
                uid: userid,
                petname: petname,
                default_role: default_role
              }
});
}

这篇关于使用 AngularFire 获取用户电子邮件地址列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

更多推荐

[db:关键词]

本文发布于:2023-04-22 11:23:59,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1023486.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:电子邮件地址   用户   列表   AngularFire

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!