Fail login doesn't return an errorm msg

57 views
Skip to first unread message

Yannick

unread,
Dec 8, 2009, 11:35:11 PM12/8/09
to web2py-users
hello mate,
I wonder because I noticed that in auth, when the user fails to login
(enter a fake username and password) there is no error message
returned...

Here is a small code

######### Model
auth.settings.table_user = db.define_table(
db.Field('email', length=128,default=''),
db.Field('password', 'password', readable=False,label='Password',
requires=CRYPT()),
migrate=False)
db.auth_user.email.requires = [IS_EMAIL(), IS_NOT_IN_DB(db, '%s.email'
%
auth.settings.table_user._tablename)]

######### Controller
def login():
return dict(loginform = auth.login() )

######### View
<h2> {{if loginform.errors.email:}} Email {{=loginform.errors.email}}
{{pass}} </h2>
<h2> {{if loginform.errors.password:}} Password
{{=loginform.errors.password}}{{pass}} </h2>
<h2> {{if loginform.errors.error_message :}} Invalid {{pass}} </h2>

<br/>
<br/>
{{=loginform.custom.begin}}
<table>
<tr>
<td>Emailing:</td>
<td>{{=loginform.custom.widget.email}}</td>
</tr>
<tr>
<td>Password:</td>
<td>{{=loginform.custom.widget.password}}</td>
</tr>
<tr>
<td>{{=loginform.custom.submit}}</td>
<td></td>
</tr>
</table>
{{=loginform.custom.end}}



I when to capture the error message of the failure using
"form.error.XXX" not through session.flash...

Please let me know if you have any hints...

Yannick P.

mr.freeze

unread,
Dec 8, 2009, 11:59:25 PM12/8/09
to web2py-users
Usually when I see this it is because of a double redirect and the
response/session.flash is lost.

Wes James

unread,
Dec 9, 2009, 9:30:26 AM12/9/09
to web...@googlegroups.com
On Tue, Dec 8, 2009 at 9:35 PM, Yannick <ytcha...@gmail.com> wrote:
> hello mate,
> I wonder  because I noticed that in auth, when the user fails to login
> (enter a fake username and password) there is no error message
> returned...
>

Yannick,

I just tried it on one of my sites and I got "Invalid Login" flash message.

I had the same issue on one of my forms not showing field validation
errors. It was as mr.freeze indicated, a double redirect that was
causing this .

-wes

Yannick

unread,
Dec 9, 2009, 10:49:01 AM12/9/09
to web2py-users
Hmm interesting, thanks for the note... I don't think I'm doing a
double redirection in my code though... can you please let me know how
you resolved that issue when you had it >

Thanks,
Yannick P.

On Dec 9, 9:30 am, Wes James <compte...@gmail.com> wrote:

Wes James

unread,
Dec 9, 2009, 11:36:47 AM12/9/09
to web...@googlegroups.com
Sorry, I'm not sure exactly when/where I made this change in the last
week. You can use wingide and check what the repsponse.flash is
between function calls.

-wes
> --
>
> 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+un...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
>
>
>

Yannick

unread,
Dec 9, 2009, 10:12:51 PM12/9/09
to web2py-users
Is anyone already has this issue and where able to solve it... I don't
see any double redirect in my code...

Thanks for your help...

On Dec 9, 11:36 am, Wes James <compte...@gmail.com> wrote:
> Sorry,  I'm not sure exactly when/where I made this change in the last
> week.  You can use wingide and check what the repsponse.flash is
> between function calls.
>
> -wes
>

Wes James

unread,
Dec 9, 2009, 11:13:10 PM12/9/09
to web...@googlegroups.com
You mentioned you are not using session.flash - why not? have you
checked response.flash and session.flash in a debugger to see what
might be happening to the .flash between function calls?

-wes

mdipierro

unread,
Dec 9, 2009, 11:20:46 PM12/9/09
to web2py-users
Add a

print request.function

to your model and check if there is a double redirect.
The other possibility is that sessions are not working.

Yannick

unread,
Dec 10, 2009, 10:09:00 PM12/10/09
to web2py-users
Hello thanks for the note...

I did add "print request.function"
and Yes there is a double redirection because the output print the
function login twice :
login
login

I wonder how to fix this double redirection here is one of the setting
I have in my controller:
auth.settings.login_next=URL(r=request, f='profile')

Do you have any idea... I'll keep debugging...

Yannick

unread,
Dec 11, 2009, 8:53:37 AM12/11/09
to web2py-users

Wes James

unread,
Dec 11, 2009, 9:33:22 AM12/11/09
to web...@googlegroups.com
On Thu, Dec 10, 2009 at 8:09 PM, Yannick <ytcha...@gmail.com> wrote:
> Hello thanks for the note...
>
> I did add "print request.function"
> and Yes there is a double redirection because the output print the
> function login twice :
> login
> login
>
> I wonder how to fix this double redirection here is one of the setting
> I have in my controller:
> auth.settings.login_next=URL(r=request, f='profile')

comment this out just to see what happens...

or use wingide and see where it goes.

Yannick

unread,
Dec 11, 2009, 9:47:33 AM12/11/09
to web2py-users

Yes I did comment this out "auth.settings.login_next=URL(r=request,
f='profile') "
but still same old, the double redirect is still there... I really
wonder what trigger that double redirection... there is nothing extra
I'm doing here, I fulling using Auth API... Hmmm...



On Dec 11, 9:33 am, Wes James <compte...@gmail.com> wrote:

mdipierro

unread,
Dec 11, 2009, 9:59:35 AM12/11/09
to web2py-users
For debugging purposes....

1) try replace everything in the view with {{=loginform}}

2) try print request.function, request.vars

what do you see?

Feel free to send me your code and I will take a look.

massimo

Yannick

unread,
Dec 12, 2009, 12:31:32 PM12/12/09
to web2py-users
Hello Massimo, thanks for the note...
i did follow your instructions which was :
1) I put this in the view {{=loginform}}
2) I print request.function and request.vars from the model
And here is what i see:
login
<Storage {'email': 'sdfs...@efsdf.cfd', '_formkey':
'440a019c-1479-4b0d-8e86-b27c0496dd7a', 'password': '12w12123',
'_formname': 'login', '_next': ''}>
login
<Storage {}>

It looks like there is a double redirect...

I did create a small brand new application just to test the login with
Auth using the web2py admin console ( Just to double check that is not
my code which cause this) and I have the same result...

I'll send you the code that I used to test it... I really don't know
why that happen, I think it use to work in the pass...

Thanks for your help...

Cheers,
Yannick P.

Yannick

unread,
Dec 14, 2009, 10:19:30 PM12/14/09
to web2py-users
Hello Massimo,
Thanks I just test the new release and realized that the double
redirect seem to be fixed on the Auth - Login.... I just wonder what
was the root of the issue I got in the previous release...

Thanks

On Dec 12, 12:31 pm, Yannick <ytchatch...@gmail.com> wrote:
> Hello Massimo, thanks for the note...
> i did follow your instructions which was :
> 1) I put this in the view {{=loginform}}
> 2) I print request.function and request.vars from the model
> And here is what i see:
> login
> <Storage {'email': 'sdfsdf...@efsdf.cfd', '_formkey':

mdipierro

unread,
Dec 14, 2009, 11:30:37 PM12/14/09
to web2py-users
I do not know. Glad it is fixed anyway.

Yannick

unread,
Dec 15, 2009, 7:28:28 PM12/15/09
to web2py-users, Massimo Di Pierro
Hmmm Think there is an issue with this release... Please take a look
to the ticket generated after a user tried to login using a fake
password:


####################################################################################

Traceback (most recent call last):
File "/Users/OnemeWs/App Server/web2py/gluon/restricted.py", line
173, in restricted
exec ccode in environment
File "/Users/OnemeWs/App Server/web2py/applications/BeUnickDemo/
controllers/default.py", line 171, in <module>

File "/Users/OnemeWs/App Server/web2py/gluon/globals.py", line 96,
in <lambda>
self._caller = lambda f: f()
File "/Users/OnemeWs/App Server/web2py/applications/BeUnickDemo/
controllers/default.py", line 134, in login
return dict(loginform = auth.login())
File "/Users/OnemeWs/App Server/web2py/gluon/tools.py", line 980, in
login
onvalidation=onvalidation):
File "/Users/OnemeWs/App Server/web2py/gluon/sqlhtml.py", line 771,
in accepts
onvalidation,
File "/Users/OnemeWs/App Server/web2py/gluon/html.py", line 1267, in
accepts
status = self._traverse(status)
File "/Users/OnemeWs/App Server/web2py/gluon/html.py", line 449, in
_traverse
newstatus = c._traverse(status) and newstatus
File "/Users/OnemeWs/App Server/web2py/gluon/html.py", line 449, in
_traverse
newstatus = c._traverse(status) and newstatus
File "/Users/OnemeWs/App Server/web2py/gluon/html.py", line 449, in
_traverse
newstatus = c._traverse(status) and newstatus
File "/Users/OnemeWs/App Server/web2py/gluon/html.py", line 449, in
_traverse
newstatus = c._traverse(status) and newstatus
File "/Users/OnemeWs/App Server/web2py/gluon/html.py", line 456, in
_traverse
newstatus = self._validate()
File "/Users/OnemeWs/App Server/web2py/gluon/html.py", line 1074, in
_validate
(value, errors) = validator(value)
File "/Users/OnemeWs/App Server/web2py/gluon/validators.py", line
728, in __call__
if (not self.banned or not self.banned.match(domain)) \
AttributeError: 'lazyT' object has no attribute 'match'


####################################################################################


Anyway idea ?

Yannick P.


mdipierro

unread,
Dec 15, 2009, 9:04:03 PM12/15/09
to web2py-users
fixing this tonight

mdipierro

unread,
Dec 15, 2009, 9:37:21 PM12/15/09
to web2py-users
I think this is now fixed in trunk. Can you confirm?

Yannick

unread,
Dec 16, 2009, 8:11:32 AM12/16/09
to web2py-users
Thanks for the note... I'll test and confirm it late this afternoon...
Tks

Yannick

unread,
Dec 16, 2009, 6:44:55 PM12/16/09
to web2py-users, Massimo Di Pierro
I just test it and the error I got in 1.74.1 has been fixed...
Thanks... However the double redirection issue is still pending...

I tried to print this in the model : request.function and
request.vars and here is the result when I submit the form:
login
<Storage {'email': 'asd...@blablaba.com', '_formkey':
'7c6c9864-567e-4aec-9339-86b554b031ce', 'password': 'aaaaaaaaa',


'_formname': 'login', '_next': ''}>
login
<Storage {}>

You can see there is a double redirect...

I put a break point in the login function inside tool.py and watch the
"session":
the session.flash looks to be empty like session.flash = u""
And at the end of the process (break point finish) the value of the
session said "error evaluating" like :
session = <error evaluating>

I'm really running out of idea about debugging this issue... It used
to work with early previous version of web2py... Is anybody has an
idea or already have this issue ?

Thanks for your help...
Yannick P.

Yannick

unread,
Dec 17, 2009, 8:30:17 PM12/17/09
to web2py-users
Hi Massimo,
I just sent you the application so that you can reproduce this
error...

Thanks again,
Yannick P.

> ...
>
> read more »

Yannick

unread,
Dec 21, 2009, 11:40:30 PM12/21/09
to web2py-users, Massimo Di Pierro
Hello Massimo,
Just wonder have you been able to reproduce the scenario ? If yes any
hints ?

Thanks for your help...
Yannick P.

> ...
>
> read more »

Yannick

unread,
Jan 4, 2010, 2:52:58 PM1/4/10
to web2py-users

I just test back this issue using the latest version of web2py and
still I have a double submission, I don't have any feedback message
coming from the session...

Here is my development environment:

OS : Mac OS X Version 10.6.2
Python : 2.5.4
DB: PostgreSQL 8.4
Web2py : 1.74.5
Wing IDE Professional 3.2


Do you please have any any hints that can help here ? I'm desperately
looking for a solution or hints...

Thanks a lot for your help...

Cheers,
Yannick P.

> ...
>
> read more »

Reply all
Reply to author
Forward
0 new messages