alfonsodg / demo-web2py

Apache License 2.0
0 stars 0 forks source link

web2py user registration saves a space to mssql #56

Closed alfonsodg closed 10 years ago

alfonsodg commented 10 years ago

From bram4am...@gmail.com on October 14, 2009 10:03:07

There's a problem while registering a user when web2py is using mssql.

Here are the pertinent pieces to reproduce the problem:

Upon a successive logout and log back in, logging in still requires email verification. After some time troubleshooting, I found that web2py, although it's setting registration_key = '' (empty string) in verify_email() (line 1018 in v.1.67.2), is actually saving a space in mssql. Thus, when registration_key is being evaluated upon login (tools.py lines 771-781 in v.1.67.2), line 778 in tools.py:

                elif temp_user.registration_key

is evaluating space as something and therefore the if condition evaluates to true and causes: response.flash = \ self.messages.registration_verifying

to trigger in a situation that registration_key should be evaluating to false and thus, bypassing the "requires verification" and allowing the user to log back in.

For a temporary fix, I've changed line 778 to:

                elif temp_user.registration_key.strip()

which resolves this specific problem. But, I still have the wonder in my mind what other areas of the framework may be affected by this same problem.

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

alfonsodg commented 10 years ago

From bram4am...@gmail.com on October 14, 2009 08:26:44

One minor correction to this information, web2py is not saving an empty string as a space in mssql, but instead, it's reading an empty string stored in mssql as a space thus, causing the if test to evaluate to true.

alfonsodg commented 10 years ago

From massimod...@gmail.com on October 26, 2009 06:27:20

I implemented your workaround in trunk. Still why is MSSQL doing this? It does not look like a web2py issue as much as a mssql issue.

Status: Fixed