Hi,

I want to build a command line login, eg.

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.


Reply via email to