All,

I'm experimenting with login_bare as I want two authentication techniques 
in one form (AD and local).

The view is simple:
<form method="POST">
  <table>
      <tr><td>Username:</td><td><input name="username" 
type="text"></td></tr>
    <tr><td>Password:</td><td><input name="password" 
type="password"></td></tr>
      <tr><td><input name="login" type="submit" value="Login"></td></tr>
   </table>

</form>

The controller  not much harder, with some debugging statements:
    username = request.vars.get("username") or ""
    password = request.vars.get("password") or "" 
    if username and password:
        user = auth.login_bare(username,password)
        print user
        redirect(URL('default', 'index'))
    return dict()

On a side note: the page default/index requires login.

If I use local credentials, everything is working well.  The line "print 
user" returns a Row with username, first_name, last_name,... I get 
redirected to the index page as expected.
If I use AD credentials the redirection doesn't happen, and "print user" 
only returns a string with the username (as it's documented, and login 
seems to be fine as well).  If I comment out, I get following internal 
error:
File "/home/www-data/web2py/gluon/tools.py", line 1326, in navbar
    if self.user_id:
  File "/home/www-data/web2py/gluon/tools.py", line 1236, in _get_user_id
    return self.user and self.user.id or None
AttributeError: 'str' object has no attribute 'id'

I feel like I'm handling this completely wrongly.  Any suggestion is very 
welcome!

Cheers

-- 
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/groups/opt_out.

Reply via email to