The Web Weblogin class is a module in a module that buddies used to do, at the time, the project required authentication capabilities, and there were several similar projects behind it, and the guy was wondering if it was going to be a module, so it would be boring to do the same thing every time. Later think of the most important is people lazy bar, hehe.
Anyway
When a user logs in, we need him to fill in the login name and password, and then to the background database for comparison, if there is a value allows users to see the requested page, if not, then I'm sorry you are an illegal user, out!
At that time, I was looking at a colleague's software project, which explained the component and its component technology in detail. I just want to learn to sell now. Oh
We can think of a user as a separate individual, and the user's information can be viewed as an attribute of that individual. As an individual we need to query, modify and so on its information operation. Why can't we integrate this information into a class?
With these ideas, we can make plans for the class.
The following are the functional requirements for this class
? IsLogin Property: This property is used to reflect the user's successful landing. Attribute type is bool, read-only
? Name property: This property is used to reflect the name of the user who has successfully logged in. Property type is string, read-only
? Userpower Property: This property is used to reflect the permissions of the user who has successfully logged on. The property type is string and is read-only.
? PWD Property: This property is used to enter the password to log in to the user. The property type is string and writes only
? UID attribute: This property is used to enter the ID of the user to log on, the property type is string, write only
? Message property: This property is used to output internal error messages. Property type is string, read-only
The methods for this class are as follows:
? Weblogin method: This method has 2 parameters, the parameter type is string, the database connection string and the database table name that contains the user information respectively. The method does not have a return value.
? Start method: The method has no parameters, the return value is bool, and when True, the user has successfully logged in, and when returned false the user does not log on successfully. You can view the message properties to get relevant information.
? Databasecolumn method: The method has 4 parameters, the parameter type is string, and there is no return value. This method is used to enter the column name of the corresponding datasheet column in order of user ID, user password, user name, user right.
? Changepwd method: The method has 1 parameters, the parameter type is string, the return value is bool, and when True indicates that the user's password was successfully modified, and when returned false, the user's password was unsuccessful. For specific reasons, you can view the message property to get the relevant information.
? Userpower Property: This property is used to reflect the user's related permissions, read-only. The return value is "A" Super User, "P" Power User, "U" user.
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