I used the sample code of http://www.web2py.com/examples/default/tools#authentication:
--------------------------- auth=Auth(globals(),db) # authentication/authorization auth.settings.hmac_key='sha512:e2976f55-309d-40fc-b69d-59fc032a6438' auth.messages.access_denied = 'Insufficient privileges' auth.messages.logged_in = 'Logged in' auth.messages.email_sent = 'Email sent' auth.messages.unable_to_send_email = 'Unable to send email' auth.messages.email_verified = 'Email verified' auth.messages.logged_out = 'Logged out' auth.messages.registration_successful = 'Registration successful' auth.messages.invalid_email = 'Invalid email' auth.messages.invalid_login = 'Invalid login' auth.messages.invalid_user = 'Invalid user' auth.messages.mismatched_password = "As senhas não conferem" #auth.messages.verify_email = 'Click on the link http://...verify_email/%(key)s to verify your email' auth.messages.verify_email_subject = 'Password verify' auth.messages.username_sent = 'Seu nome de usuário foi enviado para você' auth.messages.new_password_sent = 'Uma nova senha foi enviada para você' auth.messages.password_changed = 'Senha Alterada' auth.messages.retrieve_username = 'Seu nome de usuário é: %(username)s' auth.messages.retrieve_username_subject = 'Recupear nome de usuário' auth.messages.retrieve_password = 'Sua Senha: %(password)s' auth.messages.retrieve_password_subject = 'Recuperar senha' auth.messages.profile_updated = 'Perfil atualizado' auth.messages.new_password = 'Nova senha' auth.messages.old_password = 'Senha atual' auth.settings.table_user = db.define_table( auth.settings.table_user_name, Field('first_name', length=512,default=''), Field('last_name', length=512,default=''), Field('email', length=512,default='', requires = [IS_EMAIL(), IS_NOT_IN_DB(db,'%s.email'%auth.settings.table_user_name)]), Field('password', 'password', readable=False, label='Password', requires=CRYPT()), Field('registration_key', length=512, writable=False, readable=False,default='')) auth.define_tables() # creates all needed tables ------------------------------------ and I just get flash (from session.flash) responding: "invalid login" when trying to login. When I try to retrieve password, Is when I get: Traceback (most recent call last): File "gluon/restricted.py", line 173, in restricted exec ccode in environment File "/home/web2py/applications/convenios/controllers/default.py" <https://hipercenter.com/admin/default/edit/convenios/controllers/default.py>, line 354, in <module> File "gluon/globals.py", line 96, in <lambda> self._caller = lambda f: f() File "/home/web2py/applications/convenios/controllers/default.py" <https://hipercenter.com/admin/default/edit/convenios/controllers/default.py>, line 321, in user return dict(form=auth()) File "gluon/tools.py", line 729, in __call__ return self.retrieve_password() File "gluon/tools.py", line 1621, in retrieve_password return self.reset_password_deprecated(next,onvalidation,onaccept,log) File "gluon/tools.py", line 1460, in reset_password_deprecated d = {passfield: user[passfield].validate(password)[0], I'm using postgresql 8.3.8 and the field in postgresl is character varying(512) When I drops the code above, the auth works perfectly. 2010/2/8 mdipierro <mdipie...@cs.depaul.edu> > I am going to need your help here. from tools.py > > user = self.db(table_user.email == > form.vars.email).select().first() > .... > d = {passfield: user[passfield].validate(password)[0], > 'registration_key': ''} > > according to your error it says user[passfield] is a str. It cannot be > be. From the code above it is clearly a record. Can you add a print > statement as see what is going on? > > Can you also print your code for custom auth? > > Massimo > > > On Feb 8, 12:03 pm, Alexandre Andrade <alexandrema...@gmail.com> > wrote: > > Now, using the other example, get the error: > > > > Traceback (most recent call last): > > File "gluon/restricted.py", line 173, in restricted > > exec ccode in environment > > File "/home/web2py/applications/convenios/controllers/default.py" > > <https://hipercenter.com/admin/default/edit/convenios/controllers/defa.. > .>, > > line 354, in <module> > > File "gluon/globals.py", line 96, in <lambda> > > self._caller = lambda f: f() > > File "/home/web2py/applications/convenios/controllers/default.py" > > <https://hipercenter.com/admin/default/edit/convenios/controllers/defa.. > .>, > > line 321, in user > > return dict(form=auth()) > > File "gluon/tools.py", line 729, in __call__ > > return self.retrieve_password() > > File "gluon/tools.py", line 1621, in retrieve_password > > return self.reset_password_deprecated(next,onvalidation,onaccept,log) > > File "gluon/tools.py", line 1460, in reset_password_deprecated > > d = {passfield: user[passfield].validate(password)[0], > > AttributeError: 'str' object has no attribute 'validate' > > > > 2010/2/8 mdipierro <mdipie...@cs.depaul.edu> > > > > > > > > > Please use the example in here: > > >http://www.web2py.com/examples/default/tools#authentication > > > > > you probably have a too short password length, should be 512. > > > > > On Feb 8, 8:16 am, Alexandre Andrade <alexandrema...@gmail.com> wrote: > > > > I customize auth using the reference of page 245 (229 ) of the book, > but > > > > after the login's of existents users don't work. > > > > > > I tried with a new app, created a user, and works. Its not possible > alter > > > it > > > > after. > > > > > > How make it work with a existent auth_user table? > > > > > > -- > > > > Atenciosamente > > > > > > -- > > > > ========================= > > > > Alexandre Andrade > > > > Hipercenter.com > > > > > -- > > > You received this message because you are subscribed to the Google > Groups > > > "web2py-users" group. > > > To post to this group, send email to web...@googlegroups.com. > > > To unsubscribe from this group, send email to > > > web2py+unsubscr...@googlegroups.com<web2py%2bunsubscr...@googlegroups.com> > <web2py%2bunsubscr...@googlegroups.com<web2py%252bunsubscr...@googlegroups.com> > > > > > . > > > For more options, visit this group at > > >http://groups.google.com/group/web2py?hl=en. > > > > -- > > Atenciosamente > > > > -- > > ========================= > > Alexandre Andrade > > Hipercenter.com > > -- > You received this message because you are subscribed to the Google Groups > "web2py-users" group. > To post to this group, send email to web...@googlegroups.com. > To unsubscribe from this group, send email to > web2py+unsubscr...@googlegroups.com<web2py%2bunsubscr...@googlegroups.com> > . > For more options, visit this group at > http://groups.google.com/group/web2py?hl=en. > > -- Atenciosamente -- ========================= Alexandre Andrade Hipercenter.com -- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.