Cookie Register Login

Code

 

Ideas:

User Registration

Fill in the front to determine whether the air to determine whether password confirmation

  If complete and correct, making a POST request

Background After obtaining the POST request, get the user's registration information, the determination

  After determination mail format, when the mail format error, a prompt response string background JSON format presented to the customers get a distal tips

  Determining whether the password confirmation, if there is no confirmation, it returns a 400 (distal simultaneous determination, and prompts the user)

If the mailbox password are confirmed success

  Background to determine whether the registration email has been occupied (at the moment whether this mailbox user registration database already exists)

  Ruoyi is occupied, the background returns prompted a string of JSON format, front-end to the customer to get the prompt after prompt

If the mailbox is not occupied

  Backstage pass the user registration information stored in the database

  At the same time the page jumps to the login page

 

User login

Analyzing distal mailbox password format, correct the POST request is issued

POST request to fetch the rear end, to get the user's login information, the determination

  Mailbox format is determined, the background error response string JSON format tips, distal tips to get the customer prompt

If the format is correct, the background reads the database to determine whether the user enters login information exists in the database

  If there is a response 400 (distal tips mailbox password do not match)

  If there is allowed to log response 200, jump Home

  (Login is successful moment, set a cookie, the browser records the user cookie)

 

Open the home page to display user information

  Background reads the user's cookie, read email

  Read the database, traversing the database for the cookie with the email matches the email and password

  If the judge found, the password is displayed on the home page

 

 

About Cookie

Features:

1. Set-Cookie response server through the Set-Cookie header

2. After the browser to get Cookie, Cookie should be put on every request

3. Cookie server reads the user's login information to know

 

note:

1. Chrome logged Cookie, visit with Safari, Safari will not bring Cookie

2.Cookie existence of a file in C drive

Security problems 3.Cookie, information can be false

4.Cookie valid default 20 minutes, backend can force set period

5.Cookie can bring your own domain name Cookie

 

Guess you like

Origin www.cnblogs.com/BUBU-Sourire/p/11333462.html