繁体   English   中英

为管理员创建重置密码 firebase android

[英]Create reset password for admin firebase android

我有帐户管理员,另一个帐户想重置密码,过程如下,

用户 A 重置密码 > 将 email 发送给管理员 > 管理员重置密码 > 管理员将新密码发送给用户 A(使用电子邮件)> 用户 A 使用管理员的新密码登录。我可以这样做,告诉我示例源代码 java。 谢谢

resetPass.setOnClickListener(view -> {
    String userMail = resetEmail.getText().toString();
    if (TextUtils.isEmpty(userMail)) {
        Toast.makeText(ForgotPassActivity.this, "Please write your valid address first", Toast.LENGTH_SHORT).show();
    } 
    else {
        auth.sendPasswordResetEmail(userMail).addOnCompleteListener(new OnCompleteListener<Void>() {
            @Override
            public void onComplete(@NonNull Task<Void> task) {
                if (task.isSuccessful()) {
                    Toast.makeText(ForgotPassActivity.this, "Please check your email account", Toast.LENGTH_SHORT).show();

                    startActivity(new Intent(ForgotPassActivity.this, Log_inActivity.class));
                } else {
                    Toast.makeText(ForgotPassActivity.this, "Email not found, please try again.", Toast.LENGTH_SHORT).show();
                }
            }
        });
    }
});

Firebase 身份验证仅允许向当前登录的用户发送密码重置 email。 您不能将密码重置 email 发送给其他用户,因为这会使系统容易被滥用。

要实现您描述的流程,您需要实现自己的 email 发送和密码重置。 You can use the Firebase Admin SDK to handle the Firebase aspects of it ( get the user , update password ), but will need to find another system to send email, and implement your own verification code.

暂无
暂无

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

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