开发者

No feedback to user on login failure with Rails 3 + Devise + Jquery Mobile

As it says in the subject, I'm just finishing up integrating Devise authentication into a Rails 3.1 app with Jquery Mobile. Most everything here is straight out of the box, no custom code, so there's not a lot I can paste in here to add to the description of the problem.

When a user fails the Sign Up process because of a pre-existing email address, password not long enough, etc., a开发者_运维百科 message is displayed to the user. It isn't pretty, but it at least works.

However when the user has an existing account and types the wrong password during sign in there is no feedback to the user and the console outputs the error:

POST http://localhost:3000/users/sign_in 401 (Unauthorized)

I've got a pretty strong suspicion that this is happening because Jquery's form submit does not expect or know how to handle a 401 error returning from the server, but I'm not certain where to resolve the issue.

If it matters, I have uncommented the following in the Devise initializer:

config.http_authenticatable_on_xhr = true

I'm also expecting that much of my problem here stems from my lack of understanding about how Rails flash notices are (or are not) integrated in JqueryMobile. Hopefully an answer here will take me that much further towards figuring it out.


jQuery Mobile 'takes over' your form submissions. However, you can simply override this behavior by adding your own form submit listener. If you do that, you should be able to add any custom logic you want.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜