Home >Backend Development >PHP Tutorial >Interface writing problem

Interface writing problem

WBOY
WBOYOriginal
2016-10-10 11:56:121046browse

For example, the login interface has three parameters: username, password, and signature. If the username is empty, it will return "The username cannot be empty." If the password is empty, it will return "Please fill in the password." Or should we say that there is one of these three parameters? Empty, the parameters returned directly are incomplete!

Reply content:

For example, the login interface has three parameters: username, password, and signature. If the username is empty, it will return "The username cannot be empty." If the password is empty, it will return "Please fill in the password." Or should we say that there is one of these three parameters? Empty, the parameters returned directly are incomplete!

There is no absolutely correct answer to this, but you can learn from my approach!

I usually can give as complete a prompt as possible, so from an experience perspective there is basically no learning cost for users

But there is a security issue here that deserves our attention. If you provide detailed prompts such as username cannot be found, password is wrong, etc., it will provide convenience for people who brute force password crackers, so I usually give prompts in places where there are security issues. The blur leaves no hidden dangers, such as incorrect username or password, and generally does not cause too much interference to normal users

Non-standard answer, for reference only!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn