Why do you need to log in by email again? Structural design of modern login system

Why do you need to log in by email again? Structural design of modern login system

I remember that when I first learned to surf the Internet, I went to some forums and found that many of them require email login, which is very annoying. I don t even have an email address. At that time, it was troublesome to register the email, so I skipped and continued using the guest mode .

But nowadays, the account systems of communities everywhere need to have a mailbox, and you can't always be an anonymous bystander on the Internet. To speak up, you need to have a mailbox. So my mailbox was filled with spam.

When I started developing the web, I began to think about why this mailbox is so popular. After thinking about it, I found that many community forum account systems have problems. Designing a complete account login system is not a simple matter.

Let s start with the benefits of the mailbox

There are many unique global unique identifiers, such as UUID, such as mac address, but they are not as easy to remember as mailboxes.
Of course, you can also create a user name by yourself, which is usually combined with English numbers and underscores. As long as you don t name it casually, it is not difficult to remember, but there is a conflict problem, and it is the only one that has to pay a price.

2. It can be easily notified.
This is well understood, that is, if there is news from the community, I will notify you by email. What is the essence of the forum, but also need to disturb you regularly, so that you can be a repeat customer. Of course, the premise is that the user uses a commonly used mailbox to log in.

3. Reset the password.
What if the password is forgotten? If there is only one user name, then reset the password by manually contacting customer service. With the increase of forum users, it is inevitable that the customer service will be exhausted. With the mailbox, the system can send a link to reset the password to your mailbox. Only the owner of the mailbox can see this link and reset the password. This also prevents others from pretending to be you to deceive customer service in order to achieve the purpose of stealing the account.

Let me talk about the problem of email accounts

1. Avoid others using your email account to log in.
There are many websites that ask you to fill in an email address when registering, but you can use it to log in before you verify this email address, and the system will even give you such unverified ones. Email notifications, e-mails, etc. Convenience is convenient, simple is simple, and it is easy for users to receive notifications without verification.

But if I use someone else's mailbox to register, then this community website becomes a spammer of the mailbox.
The mailbox owner received a bunch of notifications that had nothing to do with him.

If one day, the owner of this mailbox will come to register for this community, and when registering, he always prompts: the mailbox is already occupied! I don't know what he thinks. He might think: Wow, I have registered for this website before. Well, if at this time this website also provides the function of using the email to reset the password, it is over. When the user resets the password and logs in to the website again, I am surprised to find a bunch of private bed photos in the album.

By the way, you should never upload this thing on the Internet, although the website will not let other users see your privacy, but the administrator of the website has the background permission to see it.

2. The service of the email account may be stopped.
For example, last year yahoo shut down its email service in China. If you want users to continue to be able to use the website s notification function and password modification function, this issue must be considered. How to solve it, just use the function of changing the email account.

3. Never expose the user's mailbox information.
Email is the user s privacy, so it s not as sensitive as going to bed photos. It s the same level of privacy as mobile phone numbers. If you accidentally expose the mailbox information, it will cause the website to lose the trust of users. Think about it if the size of the mailbox of Ji Shisan is accidentally made public, all kinds of advertisements, inquiries, and emails will be filled with emails, and this mailbox will eventually become a spam mailbox.
For the safety of your mailbox, users should never use their important mailboxes to register unreliable small sites. After observation, I feel that the service provider of this website is reliable. You can consider changing the mailbox and use the vest mailbox first.

Let s discuss the general structure of the login system of modern websites.

Login system structure

This picture is drawn with the chrome application processon. It feels very convenient. I recommend it to everyone here.

1. Third-party login account.
With the rise of OAuth, login systems using third-party accounts have become more and more popular because of convenience. It's like you have a master key that can open your own safe, room, car and other private property. When the Internet of Things emerges in the future, this will no longer be a metaphor.

2. Diversification of login methods.
If you have only one key in your room and you lose the key, you need to spend money to find a locksmith to solve it. The same is true for websites. The process of resetting your password may be cumbersome. If you have multiple keys and multiple login methods, you don t have to worry about this. For example, if you forget your Weibo, you can log in with Renren's account, and then use the unbinding and binding function of the third-party account to replace a Weibo. This is likened to a new key.

3. Support mobile phone number login.
As mentioned earlier, mailboxes are similar to mobile phone accounts. So what do they have in common?
It is the only one in the world, easy to remember, and can also be used as a notification. Of course, you should use the notification function with caution. If it is too frequent, it will be hacked. Users are much more sensitive to SMS messages than email messages.
Mobile phone numbers and email addresses are indeed very similar, but they are also different.
The phone number will be reused after a period of downtime, at which time the owner will change. Therefore, you must pay attention to the issue of timeliness when using your mobile phone number. If the last time you log in with your mobile phone is too long, you can no longer log in directly with your mobile phone number at this time. It is not advisable for any website to only provide a login method of mobile phone login.
Mobile phone numbers are very suitable for mobile applications. The convenience of notification (verification) is better than that of mailboxes, and the convenience of inputting pure numbers is also better than mailboxes. And many applications also have the function of capturing the content of mobile phone text messages. The verification code comes through the mobile phone text message and can be directly filled into the input box, which is very convenient.

4. The mobile phone/user name/email share a password to log in.
The username cannot be purely numeric, otherwise it will conflict with the mobile phone number. The user name must not contain the @ character, otherwise it will conflict with the mailbox.

5. The user's URL is very important.
weibo.com/jishisan is much easier to remember than weibo.com/u/164644616 ... Many users access other people's homepages instead of searching in their friends, or through the search function, they type the URL directly in the browser.
This URL short name is generally generated by the pinyin of the user's name information, and conflicts will be handled and a suffix will be added.
User-defined functions can also be provided, but it is necessary to prevent some key short names from being snatched by users, and to avoid frequent modification of short names by users, which will interfere with search engines.

Finally, talk about the precautions when designing the login system

1. The password cannot be stored in plain text, nor can it be transmitted in plain text. The problem with plaintext storage is that if the data is leaked, the password will be leaked, while the problem with plaintext transmission is that the channel is insecure, and the content transmitted on the network can be stolen. As for the encrypted transmission, that is another topic. Generally, https protocol or signature can be used.

2. Pay attention to the phishing problem when verifying the mailbox.
What does this mean? If a diaosi uses my email address to register, after the verification email is sent to the mailbox, I may not have a sense of security, and I just clicked the verification link. At this time, the system must consider that the premise of the mailbox being verified is that I am in the login state. If I am not in the login state, it will guide me to log in, and then jump back to the verification address for verification after the login is completed. Instead of passing the verification once the link is clicked, it is very insecure.
To put it in a mathematical way, what is verified at this moment is the relationship-the relationship between the account and the mailbox. Click the link to verify that the mailbox is mine, and the login verification is mine. The relationship can be established only after both verifications are successful.

3. It is not possible to log in with the mailbox before the mailbox is verified.
Generally, websites will provide the function of using email to reset password. If a certain diaosi uses my email address to log in, and then posts a photo of her own bed in the account, after I use the reset password function, I can get diaosi's account and get this bed photo.

4. It is necessary to ensure that the account has at least one reliable login method.
For example, a website only provides third-party accounts to log in to Weibo and Renren. If both third-party accounts are unbound, then this account becomes a black hole and no one can log in. The website cannot only provide mobile phone login, because the timeliness of mobile phone login is mentioned earlier.

5. Do not disclose the user's mailbox and mobile phone number in any way.

6. Remind users not to register with passwords such as Tianya CSDN.

I can't think of other things that need attention for the time being. If there are readers who can think of it, they can inform me in the form of comments.

Finally, I wish you all can implement your own set of robust account login system.