Joke Collection Website - Blessing messages - What's the difference between logging in with honey code on the Internet and logging in with writer's phone?

What's the difference between logging in with honey code on the Internet and logging in with writer's phone?

The difference between them is related to the mobile business hall where the mobile phone number is located. Nowadays, mobile phone number login is a popular way, and the original password login is inconvenient because it always forgets the password.

The quick login function of mobile phone is to log in by SMS verification code. Compared with the login mode of user name and password, this mode is a popular login mode at present. Users don't need to remember their passwords, just enter their mobile phone numbers and get the verification code.

In order to obtain the verification code button binding event, check the mobile phone number in the corresponding processing function of the event. If the mobile phone number is entered correctly, a 30-second countdown effect will be displayed and an ajax request will be sent, and a short message verification code will be sent.

Provide send4Login method in ValidateCodeController, call SMS service to send verification code and save it to redis.

View code

Submit login request #

Bind an event to the login button.

& ltdiv class="btn yes-btn " >& lta @ click = " log in()" href = " # " & gt; log in

View code

Background code #

Controller #

Create a MemberController in the health_mobile project and provide a login method for login checking. The processing logic is as follows:

1. Check whether the SMS verification code entered by the user is correct. If the verification code is wrong, the login fails.

2. If the verification code is correct, judge whether the current user is a member, and if not, automatically complete the member registration.

3. Write a Cookie to the client with the contents of the user's mobile phone number.

4. Save the member information to Redis, and use the mobile phone number as the key for 30 minutes.