Welcome Guest, Not a member yet? Register   Sign In
Show login errors in Community Auth
#1

(This post was last modified: 04-12-2017, 04:37 AM by annx10.)

Hi.

I have setup correctly community auth in my project, and all works fine.
However, I need help with some views that I am developing.

My problem is that I want show login errors individually in the login page.

In example controller, when isset($login_error_mesg) in the login view, it shows a hardcoded message.
That I want is that for example, if username is required, when that input is empty it shows a message like "User is required".
How can I get it?
I have used in other time CI library form validation, and when it was any error I showed with form_error() or with validation_errors(), but now I don't know how to do with Community Auth.

In the file login.php (config/form_validation/examples/login.php) they are stablished all custom rules, but when this rules broken, I don't know how I can show specific error in the view.

Thanks.
Reply
#2

Hi.

Please, anybody has had same need?

I know that it isn't some basic, but I like that user sees what was error.

thanks.
Reply
#3

(This post was last modified: 04-13-2017, 05:59 PM by skunkbad.)

In this particular case, your best option is just to use javascript to disallow form submission if the fields are empty. It is for your benefit that the login error is not specific. For instance:

1) It is generally accepted that a login error should not say "The username does not exist", or "The email does not exist", or "The username was good but the password was bad".

2) If you do a little client side validation through javascript, it'll handle anything that you want with ease. Javascript is super easy, especially if using jQuery, so I recommend to do that.

Lastly, in general I am the only one that answers questions about Community Auth, since I'm the one that made it. I do work 2 jobs, so be patient when you ask a question, because it can sometimes be a while before I can answer (but I always do).
Reply
#4

Hi, skunbad.

Firstly, sorry for write two post about my problem. I know that you are very busy and that you are the one that worked about Community Auth, but I think that other members could help me about this question.

Respectly your answer, I am agree about your recommendations. I just had worked about client side validation, but I was thinking if user deactivate javascript. However, like you said, I wasn't thought about validation could offers sensible information to bad users like attackers.

Thank you very much.
Reply
#5

(04-14-2017, 06:14 AM)annx10 Wrote: ...  but I was thinking if user deactivate javascript ...

That's very unlikely, given the popularity of JS. I always think that JS should offer convenience, but the server app always ensures everything is logical and safe.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB