Hi I am trying to create and add a custom authentication method and incorporate it into web2py. Here is my authentication method:
import win32security import pywintypes def auth_local(username, password): try: token = win32security.LogonUser(Username=username, Domain='ad.local.com', Password=password, LogonType=win32security.LOGON32_LOGON_NETWORK, LogonProvider=win32security.LOGON32_PROVIDER_DEFAULT) return True except pywintypes.error: return False I have adjusted db.py as follows: from gluon.contrib.login_methods.auth_local1 import auth_local auth.settings.login_methods.append(auth_local) ## create all tables needed by auth if not custom tables auth.define_tables(username=True, signature=False) When I try to log in I get the following traceback: Traceback (most recent call last): File "C:\web\web2py_new\gluon\restricted.py", line 220, in restricted exec ccode in environment File "C:/web/web2py_new/applications/CSS_Web/controllers/default.py" <http://127.0.0.1:8000/admin/default/edit/CSS_Web/controllers/default.py>, line 78, in <module> File "C:\web\web2py_new\gluon\globals.py", line 385, in <lambda> self._caller = lambda f: f() File "C:/web/web2py_new/applications/CSS_Web/controllers/default.py" <http://127.0.0.1:8000/admin/default/edit/CSS_Web/controllers/default.py>, line 40, in user return dict(form=auth()) File "C:\web\web2py_new\gluon\tools.py", line 1347, in __call__ return getattr(self, args[0])() File "C:\web\web2py_new\gluon\tools.py", line 2385, in login request.vars[passfield]): File "C:\web\web2py_new\gluon\contrib\login_methods\auth_local1.py", line 7, in auth_local token = win32security.LogonUser(Username=username, NameError: global name 'user' is not defined Any help or feedback on what I am doing wrong would be greatly appreciated. -- 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 web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.