我正在创建一个登录系统,其中数据库没有唯一的列,电子邮件可以复制。
用户表的数据库结构
1. 'id' => unique, auto_increment, and primary_key
2. 'email' => not null,
3. 'password' => not null,
4. 'subdomain' => not null例如,数据库中的=>示例记录可能是
1. id = 1
email = me@me.com
password = 12345
subdomain = first
2. id = 2
email = me@me.com
password = 12345
subdomain = second例如,让我们说,
subdomains.
。
注意:登录系统是使用php7.4,Laravel 7.* framework构建的。
我的问题是:这种方法将来会不会产生任何问题,对这种登录系统有什么期望,也欢迎您提出任何建议。
提前谢谢你
发布于 2021-03-24 10:30:40
因为问题是“有多可靠”。答案是:它可以非常可靠。
在Domain+email中仍然有一个统一性。您将需要对您的auth中间件进行重新工作,并将域作为与身份验证路由(会话、url或其他解决方案)的每一次交互的要求,并重新工作您的身份验证控制器。
关于结构,由你来决定是否应该:
- Have a pivot table between users and domains to link the user to each domain with the password in the pivot table (if you want different password per domain)
- Pros: You can have only one profile editing across all domains.
- Cons: manage a many to many relation.- Pros: none
- Cons:
- profile updating (password/image/statuses/...)
- redondancy and lack of integrity
- Relation between users and other models that are independant of the domain.https://stackoverflow.com/questions/66778573
复制相似问题