librelist archives

« back to archive

[Flask Login] How do we authenticate the user?

[Flask Login] How do we authenticate the user?

From:
Mahesh Lal
Date:
2012-08-01 @ 05:54
Hi,

I was planning to use the flask-login plugin to manage user related
functions and was faced with one basic question - how do u validate whether
its a legitimate user?

I do see a @load_user callback - which will load a user given an id,
however, if a user is entering a mail_id (in this case it is the user id)
and a password where do I check whether the password entered is correct for
the said user?

Please advise.

-- 
*-- REGARDS*
*

MAHESH LAL*
*
*

Re: [flask] [Flask Login] How do we authenticate the user?

From:
Darren Worrall
Date:
2012-08-01 @ 07:10
On 1 August 2012 06:54, Mahesh Lal <mahesh.2910@gmail.com> wrote:

> Hi,
>
> I was planning to use the flask-login plugin to manage user related
> functions and was faced with one basic question - how do u validate whether
> its a legitimate user?
>
> I do see a @load_user callback - which will load a user given an id,
> however, if a user is entering a mail_id (in this case it is the user id)
> and a password where do I check whether the password entered is correct for
> the said user?
>
> Please advise.
>
> --
> *-- REGARDS*
> *
>
> MAHESH LAL*
> *
> *
>
>
Hi Mahesh,

You login the user in the view which accepts the POST from your login form,
see the 'How it works' section in the documentation for an example:
http://packages.python.org/Flask-Login/