password="toto"
my_crypt = CRYPT(key=auth.settings.hmac_key)
crypt_pass = my_crypt(password)[0]
user =
db.auth_user.insert(Surnom="Surnom",email="email5@toto",username="titi",password=crypt_pass,)
from gluon.storage import Storage
session.auth =
Storage(user=user,expiration=auth.settings.expiration,hmac_key=str(uuid4()))
auth.user = Storage(auth.settings.table_user._filter_fields(user,
id=True))
auth.environment.session.auth = Storage(user=user,
last_visit=request.now,expiration=auth.settings.expiration)
redirect(URL('inscriptioninvit'))
On Monday, March 26, 2012 11:53:28 AM UTC+2, selecta wrote:
>
> did you see this slice
>
> http://www.web2pyslices.com/slice/show/1443/auto-login-when-you-come-from-localhost<http://www.web2pyslices.com/slice/show/1443/auto-login-when-you-come-from-localhost>
> it logs you in when you come from localhost, just exchange the if an there
> you go :D
>
> On Monday, March 26, 2012 2:11:29 AM UTC+2, bussiere adrien wrote:
>>
>> it's more a logical problem than your framework.
>>
>> I just want to know how to log a user.
>>
>> Bussiere
>>
>> Le lundi 26 mars 2012 01:35:04 UTC+2, Massimo Di Pierro a écrit :
>>>
>>> I have been on the road and hard to keep up up with posts. If this issue
>>> is still open please open a ticket so it can be tracked.
>>>
>>> On Sunday, 25 March 2012 11:57:20 UTC-5, bussiere adrien wrote:
>>>>
>>>> I want to create myself a user then log him.
>>>> This for an open source project :
>>>> https://github.com/bussiere/jackpoint<https://github.com/bussiere/jackpoint>
>>>>
>>>> I've been on it for 3 days now.
>>>>
>>>> I want to create a user then loggin him and auth him.
>>>> If you find it just give me your paypal in private buy you a drink.
>>>>
>>>> Here is my code :
>>>> def test():
>>>>
>>>> password="toto"
>>>> my_crypt = CRYPT(key=auth.settings.hmac_key)
>>>> crypt_pass = my_crypt(password)[0]
>>>> user = db.auth_user.insert(
>>>> Surnom="Surnom",
>>>> email="email5@toto",
>>>> username="titi",
>>>> password=crypt_pass,
>>>> )
>>>> db.commit()
>>>>
>>>> user = auth.login_bare("titi",password)
>>>> session.auth =
>>>> Storage(user=user,expiration=auth.settings.expiration,hmac_key=str(uuid4()))
>>>> redirect(URL('inscriptioninvit'))
>>>>
>>>> @auth.requires_login()
>>>> def inscriptioninvit():
>>>> return "hello"
>>>>
>>>>