Thank you, I have tried it - works fine!
But it seems to me that this is a real login, not only a validation.

Martin


2013/8/13 Luca <[email protected]>

> The correct way to do this would be something like:
>
> def ulogin():
>     u = auth.login_bare(request.vars.user, request.vars.password)
>     if not u:
>          return ''
>     else:
>          return u
>
> Or something like that; I don't know.
> Now, the issue is that this validates a login, but it does not really log
> a person in.
> Meaning, the session cookie, etc, are not created.
>
> I have used this function with success to authenticate https requests e.g.
> from mobile clients and build REST APIs.
>
> Luca
>
> On Sunday, August 11, 2013 2:15:47 AM UTC-7, mweissen wrote:
>>
>> Hi,
>>
>> I want to build a command line login, eg.
>>
>> https://my.domain.com/app/**contr/mylogin?user=abc&pwd=**secret<https://my.domain.com/app/contr/mylogin?user=abc&pwd=secret>
>>
>> (Yes, this could be a security risk). At first I have tried to learn more
>> about auth.user_login. The function
>>
>> def ulogin():
>>     auth.login_user(1)
>>
>> returns the following ticket:
>>
>> Ticket ID
>>
>> 127.0.0.1.2013-08-11.10-58-17.**4854fae8-71bb-4b32-b4bb-**2fe044ad3ec3
>> <type 'exceptions.TypeError'> 'int' object is not iterable
>> Version
>>  web2py™ Version 2.5.1-stable+timestamp.2013.**06.06.15.39.19  Python Python
>> 2.7.3: D:\Python27\python.exe (prefix: D:\Python27)
>> Now I have tried to understand the source code:
>>
>>     def login_user(self, user):
>>         """
>>         login the user = db.auth_user(id)
>>         """
>>         from gluon.settings import global_settings
>>         if global_settings.web2py_**runtime_gae:
>>             user = Row(self.db.auth_user._filter_**fields(user, id=True))
>>             delattr(user,'password')
>>         else:
>>             user = Row(user)
>>             for key,value in user.items():
>>                 if callable(value) or key=='password':
>>                     delattr(user,key)
>>         current.session.auth = Storage(
>>             user = user,
>>             last_visit=current.request.**now,
>>             expiration=self.settings.**expiration,
>>             hmac_key=web2py_uuid())
>>         self.user = user
>>         self.update_groups()
>>
>> I think the Row function does some magic.
>> Who knows how to use login_user?
>>
>> Regards Martin
>>
>  --
>
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to