注册和登录系统的用户表结构与电子邮件

时间:2021-04-08 12:33:15

I want to know what is best table structure and indexes for users table (login by email and password) for best performance. I don't want to use usernames. I want to login with unique index (for better performance) with user email.

我想知道什么是最好的表结构和用户表索引(通过电子邮件和密码登录)以获得最佳性能。我不想使用用户名。我想用用户电子邮件登录唯一索引(以获得更好的性能)。

Maybe best performance will be unique index for email and password together.

也许最佳性能将是电子邮件和密码的唯一索引。

Problem is that I want to be email indexed as unique for faster login. But in this case bad user can prevent another user to register knowing his email.

问题是我希望将电子邮件编入索引,以便更快地登录。但在这种情况下,坏用户可以阻止其他用户注册知道他的电子邮件。

The only idea I could think of some sort of unique email and password hash in one unique column. But I want know how its done the best.

唯一的想法是我可以在一个独特的列中考虑某种独特的电子邮件和密码哈希。但我想知道它是如何做到最好的。

Part of my user table index structure (DB is MySQL)

我的用户表索引结构的一部分(DB是MySQL)

user_id   - PRIMARY
email     - UNIQUE
password
verified   (after verify email)

1 个解决方案

#1


0  

Simple solution:

Send verification email with link to cancel registration (I didnt register)

发送带有取消注册链接的验证邮件(我没有注册)

#1


0  

Simple solution:

Send verification email with link to cancel registration (I didnt register)

发送带有取消注册链接的验证邮件(我没有注册)