alfonsodg / demo-web2py

Apache License 2.0
0 stars 0 forks source link

Issues with Auth in tools.py #26

Closed alfonsodg closed 10 years ago

alfonsodg commented 10 years ago

From francisb...@gmail.com on January 29, 2009 16:34:26

I'm working through migrating my app from T2 to tools.py. Starting with Auth & will then look at Crud once this is completed (& then finally the integration of the 2 :) )

When I 'Register' I get a message 'verification email sent' even when I've not yet set 'auth.settings.mailer=mail' This is because that is currently the string for self.messages.on_registration_flash I think we need 2 strings here - 1 for email verification & 1 for no-email verification.

If no email verification required then user should be automatically logged-in (as per nemik's Patch: http://groups.google.com/group/web2py/msg/175ceca92b19713b )

I can login with the just-registered user (no email actually sent).

When I 'Logout' then I get this traceback: File "C:\Bin\web2py\gluon\tools.py", line 385, in call elif args[0]=='logout': return self.logout() File "C:\Bin\web2py\gluon\tools.py", line 512, in logout redirect(next or self.settings.next) File "C:\Bin\web2py\gluon\http.py", line 77, in redirect location = location.replace('\r','%0D').replace('\n','%0A') AttributeError: 'NoneType' object has no attribute 'replace'

This is because the logout() function has no 'Next' when it is called: elif args[0]=='logout': return self.logout()

If I edit my Profile & submit it I get this traceback: File "C:\Bin\web2py\gluon\tools.py", line 391, in call elif args[0]=='profile': return self.profile() File "C:\Bin\web2py\gluon\tools.py", line 669, in profile self.log_event('user [%s] edited profile' % auth.user.id) NameError: global name 'auth' is not defined Should be self.user.id

Also the strings in the Auth & Crud classes should be localisable via T(). This can be done in the same way as T2 by adding T to the list of variables passed: class Auth(object): def init(self,environment,T,db=None):

Instantiate in Model via: auth=Auth(globals(),T,db)

I have provided a patch which rectifies some of these issues.

Attachment: tools.py.patch

Original issue: http://code.google.com/p/web2py/issues/detail?id=27

alfonsodg commented 10 years ago

From francisb...@gmail.com on January 29, 2009 13:55:04

Another typo causing issue - missing e in failed: self.settings.on_failed_authorization=lambda: self._HTTP(404)

alfonsodg commented 10 years ago

From massimod...@gmail.com on January 29, 2009 20:01:31

tools is experimental and the patch already does not apply. But thanks.

Status: Invalid