Module Import alias ImportFrom alias ImportFrom alias FunctionDef arguments args NameParam NameParam NameParam defaults body Expr Str Expr Call AttributeLoad NameLoad attr BinOpMod Str NameLoad If CompareIsNot NameLoad NameLoad body Assign NameStore Call NameLoad NameLoad NameLoad Expr Call AttributeLoad NameLoad attr BinOpMod Str Call NameLoad NameLoad If NameLoad body Expr Call AttributeLoad Call NameLoad NameLoad attr NameLoad Return NameLoad orelse Return NameLoad orelse Return NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str Expr Call AttributeLoad Call NameLoad NameLoad attr Return NameLoad decorator_list
N/A N/A logging Mojo.Auth.SessionManager SessionManager Mojo.Auth.AuthManager authenticate login_assistant N/A N/A thisUser password request N/A N/A N/A 
    Shortcut function that will perform three things at once:

    #. Checks if the user exists
    #. Authenticates the user against a password using ``Auth.AuthManager.authenticate()``
    #. If authenticated, sets the appropriate session cookie (that is checked by ``get_current_user()`` and returns ``True``

    **Parameters**

    - ``thisUser`` - Mojo.Auth.models.User object
    - ``password`` - string password representation
    - ``request`` - RequestHandler object, does *not* require the Session Mixin to be used.

    **Usage:** ::

        from Mojo.Auth.Helpers import login_assitant

        thisUser = Users.find_one({'_id':ObjectId('504e0439a9ee2f04a0835a92'})

        if thisUser:
            is_authenticated = login_assistant(thisUser, password, self) #self in this case is a RequestHandler
            if is_authenticated:
                ...
            else:
                ...

     N/A N/A N/A logging debug N/A Found user: %s thisUser N/A N/A thisUser None N/A N/A is_authenticated N/A authenticate thisUser password N/A N/A N/A logging debug N/A Checking is user is authenticated: %s N/A str is_authenticated N/A is_authenticated N/A N/A N/A N/A N/A SessionManager request _login thisUser N/A True N/A N/A False N/A N/A False N/A logout_assistant N/A N/A request N/A N/A N/A 
    Shortcut function to log a user out. Uses ``Mojo.Auth.SessionManager`` to set the appropriate
    session cookie and returns ``True``.

    Once called, ``get_current_user()`` and ``curent_user`` will be returned as ``None`` in a RequestHandler.

     N/A N/A N/A N/A SessionManager request _logout N/A True N/A