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

时间:2019-11-05 07:31:39

标签: java android firebase firebase-realtime-database

所以我知道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);
}

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

database example

有什么想法吗?

1 个答案:

答案 0 :(得分:0)

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