Hello,

for an intranet page with special login I need an additional "login_bare", 
firstly without password.

To test ist, I try in model:

from gluon.tools import Auth
class MC_Auth(Auth):
    def mc_login_bare(self, username, password):
        """
        logins user
        """
        request = current.request
        session = current.session
        table_user = self.settings.table_user
        if self.settings.login_userfield:
            userfield = self.settings.login_userfield
        elif 'username' in table_user.fields:
            userfield = 'username'
        else:
            userfield = 'email'
        passfield = self.settings.password_field
        user = self.db(table_user[userfield] == username).select().first()
        password = table_user[passfield].validate(password)[0]
        if user:
            if not user.registration_key and user[passfield] == password:
                user = Storage(table_user._filter_fields(user, id=True))
                session.auth = Storage(user=user, last_visit=request.now,
                                       expiration=self.settings.expiration,
                                       hmac_key = web2py_uuid())
                self.user = user
                return user
        return False
    pass

auth = MC_Auth(db_sched, secure=True)

mc_login_bare is a copy if login_bare to test it.

The page works normally, auth.login_bare with Username and password works. 
But with auth.mc_login_bare("Username", "password") I get

user = auth.mc_login_bare("Username", "password")

request = current.request
NameError: global name 'current' is not defined


This is my first try to ovveride an method...

I think there is a simple solution.

Can you get me an hint?

Thank you,
Mike

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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/d/optout.

Reply via email to