简体   繁体   English

firebase - 限制用户登录 14 天

[英]firebase - restrict user from logging in for 14 days

I have an admin panel in my app and I want that if a user has been restricted from the admin panel, he/she must not be able to log into the account for 14 days.我的应用程序中有一个管理面板,我希望如果用户被管理面板限制,他/她必须在 14 天内无法登录该帐户。 I am using firebase with react native我正在使用 firebase 和本机反应

You could store the user id in your database (Firestore or Realtime), with a value such as isBlocked along with a date that the block was imposed, dateBlocked .您可以将用户 ID 存储在您的数据库(Firestore 或 Realtime)中,其中包含诸如isBlocked类的值以及实施阻止的日期dateBlocked

Then, when you want to block a user, you simply update the database with these values.然后,当您想要阻止用户时,只需使用这些值更新数据库即可。 When a user logs in, query your DB to see if the user isBlocked and that the dateBlocked is less than 14 days ago, and you can then decide what to do with your user.当用户登录时,查询您的数据库以查看该用户是否被isBlocked并且被dateBlocked小于 14 天前,然后您可以决定如何处理您的用户。

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

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