首页 > 解决方案 > 尝试将密码添加到 Firebase 实时数据库,但没有显示?

问题描述

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

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

这是一些示例代码

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);
}

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

数据库示例

有任何想法吗?

标签: javaandroidfirebasefirebase-realtime-database

解决方案


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


推荐阅读