繁体   English   中英

尝试将密码添加到 Firebase 实时数据库,但它没有显示?

[英]Trying to add password to Firebase RealTime Database, but it doesn't show up?

所以我知道 Firebase Auth 存在,但这是一个学校项目,我必须为密码实施我自己的 hash。

我正在将用户注册到实时数据库,它以正确的格式添加,但“密码”没有显示。 有没有办法让它显示出来?

这是一些示例代码

public void  registerUser (String name, String email, String password)
{
    Intent toWelcome = new Intent(this, Welcome.class);
    String id = mDatabase.push().getKey();
    if (type.equals("Admin")) {
        Person user = new Admin(id, email, password, name);
        mDatabase.child("Person").child("Admin").child(id).setValue(user);
        Toast.makeText(Register.this, "Admin account already created.", Toast.LENGTH_LONG).show();
    }
    else if (type.equals("Patient"))
    {
        Person user = new Patient(id, email, password, name);
        mDatabase.child("Person").child("Patient").child(id).setValue(user);
    }
    else if (type.equals("Employee"))
    {
        Person user = new Employee(id, email, password, name);
        mDatabase.child("Person").child("Employee").child(id).setValue(user);
    }

    toWelcome.putExtra("name", name);
    toWelcome.putExtra("role", type);
    startActivity(toWelcome);
}

这是我的数据库中显示的内容:

数据库示例

有任何想法吗?

当方法被调用时,您是否尝试过记录“密码”字符串的值? 可能是由于某种原因,您传入了一个空字符串,因此它不会被保存。

您确定它应该向您显示密码吗? 服务器通常非常不愿意向管理员显示此类内容。 它可能是一项安全功能。 作为管理员,您可以重置密码,但不一定能看到密码。 你确实提到它是一个实时数据库。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM