Python's user authentication component

Source: Internet
Author: User

Django comes with a user table: Auth_User

To create a user instance:

1.1 , Authenticate ()

Provide user authentication, that is, verify the user name and password is correct, generally need username password two keyword parameters

if certified The information is valid and returns an   user  object. Authenticate () sets a property on the user object to identify the authenticated backend that authenticated the subscriber, and that information is required during the subsequent logon process. When we try to login a user object that is taken directly from the database without authenticate () will error!!

1

user = Authenticate (username= ' someone ', password= ' Somepassword ')

Auth.login (Request,user) #全局变量 request. User= the current object (session).

As long as Auth.login (Request,user) This statement to write, it means that there is a login user, or an anonymous user, and anonymous user ID, name inside nothing

Python's user authentication component

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.