Javascript-what should I use for registration verification to the frontend and backend?

Source: Internet
Author: User
Example: 1. do not read the database validity verification (whether to fill in the verification, password length verification, mailbox validity verification) 2. verify the validity of the database (repeated user name verification) 3. repeated password verification (should this be the first type ?) 4. other unspecified... * The original segmentfault has... for example:
1. Do not read the database validity verification (whether to fill in the verification, password length verification, mailbox validity verification)
2. verify the validity of the database (repeated user name verification)
3. Duplicate password verification (should this be the first type ?)
4. other unspecified...

/* The original segmentfault hasNewbie Q &Section, so the question is no longer shy */

Reply content:

For example:
1. Do not read the database validity verification (whether to fill in the verification, password length verification, mailbox validity verification)
2. verify the validity of the database (repeated user name verification)
3. Duplicate password verification (should this be the first type ?)
4. other unspecified...

/* The original segmentfault hasNewbie Q &Section, so the question is no longer shy */

Generally, the content to be verified on the front end must also be verified on the backend, because JavaScript verification can be bypassed after the browser disables JavaScript verification.

Front-end verification is to improve the experience and reduce connection requests. For example, what you call password length verification and mailbox validity verification can be verified on the front end, and there is no need to submit it to the backend for verification, putting this part of processing to the client can relieve the pressure on the server (for highly concurrent websites, the effect is obvious ).

So what should we put in the backend for verification? Common problems are related to database operations, such as repeated user name verification and password verification. For better experience, ajax is usually used to initiate requests to the backend, without refreshing the new page for verification (which can also save traffic ). In addition to the possibility of putting database operations on the backend for verification, there are also some other situations that may also be put on the backend for verification. For example, an algorithm is required for checking a field, it is impossible to write the implementation of this algorithm to js.

In general, stick to the principle that all verifications should be put on the front-end for verification as much as possible, and the front-end for verification is verified again.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.