librelist archives

« back to archive

Super simple logins

Super simple logins

From:
George Trevill
Date:
2013-06-20 @ 16:36
Hello all,

I am building my first flask app and playing around with creating a
login system. I've tried to use flask-login and had no luck so far.

I'm wondering if I can use something simpler, as there will be a very
small amount of set users, with each user able to view their own pages
only.

Does anyone have any thoughts of how I could do this without
reinventing the wheel, or using something as complex as flask-login?
The app currently doesn't make use of a database at all and having one
just to store usernames and hashed passwords is making this more
complicated than I wanted.

Re: [flask] Super simple logins

From:
Joe Angell
Date:
2013-06-20 @ 16:56
I recommend flask-security (which uses flask-login), it's pretty easy to
get up and running and I think you can use a simple database like sqlite if
you don't need anything serious.  Pretty much any login system is going to
need a db afaik.


On Thu, Jun 20, 2013 at 10:36 AM, George Trevill <georgetrevill@gmail.com>wrote:

> Hello all,
>
> I am building my first flask app and playing around with creating a
> login system. I've tried to use flask-login and had no luck so far.
>
> I'm wondering if I can use something simpler, as there will be a very
> small amount of set users, with each user able to view their own pages
> only.
>
> Does anyone have any thoughts of how I could do this without
> reinventing the wheel, or using something as complex as flask-login?
> The app currently doesn't make use of a database at all and having one
> just to store usernames and hashed passwords is making this more
> complicated than I wanted.
>



-- 
---------------
Joe Angell
cell: (720) 260-2190

Re: [flask] Super simple logins

From:
George Trevill
Date:
2013-06-20 @ 18:52
Thankyou Paulo and Joe, I will have a look into flask-security and in the
meantime just use a csv whilst we are testing
On Jun 20, 2013 6:00 PM, "Joe Angell" <joe.d.angell@gmail.com> wrote:

> I recommend flask-security (which uses flask-login), it's pretty easy to
> get up and running and I think you can use a simple database like sqlite if
> you don't need anything serious.  Pretty much any login system is going to
> need a db afaik.
>
>
> On Thu, Jun 20, 2013 at 10:36 AM, George Trevill <georgetrevill@gmail.com>wrote:
>
>> Hello all,
>>
>> I am building my first flask app and playing around with creating a
>> login system. I've tried to use flask-login and had no luck so far.
>>
>> I'm wondering if I can use something simpler, as there will be a very
>> small amount of set users, with each user able to view their own pages
>> only.
>>
>> Does anyone have any thoughts of how I could do this without
>> reinventing the wheel, or using something as complex as flask-login?
>> The app currently doesn't make use of a database at all and having one
>> just to store usernames and hashed passwords is making this more
>> complicated than I wanted.
>>
>
>
>
> --
> ---------------
> Joe Angell
> cell: (720) 260-2190
>

Re: [flask] Super simple logins

From:
Raj Nathani
Date:
2013-06-20 @ 23:19
What you implement now need not be the final application. For now you 
could use a hard coded python dictionary for storing users and passwords.

users = {
    'Chuck': '12345',
    'Bob': 'bananas33',
    ...
}

Write a function to validate the user input against your database of users.

Later on when you feel that you are comfortable with flask and prepared to
take the next step of using a DBMS, simply rewrite the function which you 
wrote initially.

Web frameworks can be daunting to use at start, don't let that demotivate 
you in anyway.

Best of luck and if you need any help with flask related specifics then 
don't hesitate to ask.

Sent from my iPhone

> On Jun 20, 2013, at 2:54 PM, "George Trevill" <georgetrevill@gmail.com> wrote:
> 
> Thankyou Paulo and Joe, I will have a look into flask-security and in 
the meantime just use a csv whilst we are testing
> 
>> On Jun 20, 2013 6:00 PM, "Joe Angell" <joe.d.angell@gmail.com> wrote:
>> I recommend flask-security (which uses flask-login), it's pretty easy 
to get up and running and I think you can use a simple database like 
sqlite if you don't need anything serious.  Pretty much any login system 
is going to need a db afaik.
>> 
>> 
>>> On Thu, Jun 20, 2013 at 10:36 AM, George Trevill 
<georgetrevill@gmail.com> wrote:
>>> Hello all,
>>> 
>>> I am building my first flask app and playing around with creating a
>>> login system. I've tried to use flask-login and had no luck so far.
>>> 
>>> I'm wondering if I can use something simpler, as there will be a very
>>> small amount of set users, with each user able to view their own pages
>>> only.
>>> 
>>> Does anyone have any thoughts of how I could do this without
>>> reinventing the wheel, or using something as complex as flask-login?
>>> The app currently doesn't make use of a database at all and having one
>>> just to store usernames and hashed passwords is making this more
>>> complicated than I wanted.
>> 
>> 
>> 
>> -- 
>> ---------------
>> Joe Angell
>> cell: (720) 260-2190

Re: [flask] Super simple logins

From:
George Trevill
Date:
2013-06-21 @ 14:26
Thankyou Raj, I think that is what I will do for now. I have a few other
placeholder functions so it makes sense to do it for user validation too so
things don't get too complicated too early
On Jun 21, 2013 12:21 AM, "Raj Nathani" <raj_n19@hotmail.com> wrote:

> What you implement now need not be the final application. For now you
> could use a hard coded python dictionary for storing users and passwords.
>
> users = {
>     'Chuck': '12345',
>     'Bob': 'bananas33',
>     ...
> }
>
> Write a function to validate the user input against your database of users.
>
> Later on when you feel that you are comfortable with flask and prepared to
> take the next step of using a DBMS, simply rewrite the function which you
> wrote initially.
>
> Web frameworks can be daunting to use at start, don't let that demotivate
> you in anyway.
>
> Best of luck and if you need any help with flask related specifics then
> don't hesitate to ask.
>
> Sent from my iPhone
>
> On Jun 20, 2013, at 2:54 PM, "George Trevill" <georgetrevill@gmail.com>
> wrote:
>
> Thankyou Paulo and Joe, I will have a look into flask-security and in the
> meantime just use a csv whilst we are testing
> On Jun 20, 2013 6:00 PM, "Joe Angell" <joe.d.angell@gmail.com> wrote:
>
>> I recommend flask-security (which uses flask-login), it's pretty easy to
>> get up and running and I think you can use a simple database like sqlite if
>> you don't need anything serious.  Pretty much any login system is going to
>> need a db afaik.
>>
>>
>> On Thu, Jun 20, 2013 at 10:36 AM, George Trevill <georgetrevill@gmail.com
>> > wrote:
>>
>>> Hello all,
>>>
>>> I am building my first flask app and playing around with creating a
>>> login system. I've tried to use flask-login and had no luck so far.
>>>
>>> I'm wondering if I can use something simpler, as there will be a very
>>> small amount of set users, with each user able to view their own pages
>>> only.
>>>
>>> Does anyone have any thoughts of how I could do this without
>>> reinventing the wheel, or using something as complex as flask-login?
>>> The app currently doesn't make use of a database at all and having one
>>> just to store usernames and hashed passwords is making this more
>>> complicated than I wanted.
>>>
>>
>>
>>
>> --
>> ---------------
>> Joe Angell
>> cell: (720) 260-2190
>>
>

Re: [flask] Super simple logins

From:
Paulo Sampaio
Date:
2013-06-20 @ 16:53
You can store on sqlite, which is pretty simple. Or as a csv file, even
more simple.

For the login, you can check if the username/pass is in the csv file, set a
cookie with his username and a timestamp. You shall use the cookie data to
show his own page.

That is pretty simple to me and doing from scratch turns out to be the best
option if something changes later.

This is not flask realated, sometimes is good code your own solution.

Atenciosamente,
__
*Paulo Sampaio**
*
*http://devio.us/~psampaio/*


2013/6/20 George Trevill <georgetrevill@gmail.com>

> Hello all,
>
> I am building my first flask app and playing around with creating a
> login system. I've tried to use flask-login and had no luck so far.
>
> I'm wondering if I can use something simpler, as there will be a very
> small amount of set users, with each user able to view their own pages
> only.
>
> Does anyone have any thoughts of how I could do this without
> reinventing the wheel, or using something as complex as flask-login?
> The app currently doesn't make use of a database at all and having one
> just to store usernames and hashed passwords is making this more
> complicated than I wanted.
>