No error warning when username or password wrong
Permalink Browser Info Environment
i have installed this package and work well
thank for a good stuff.
btw, when user login with wrong username/password, this will redirect to original concrete5 login form.
but there is no error warning? why
thank's
thank for a good stuff.
btw, when user login with wrong username/password, this will redirect to original concrete5 login form.
but there is no error warning? why
thank's
Type: | Discussion |
---|---|
Status: | New |
Does your login page use your theme? Does the error display if you do an invalid login directly from your login page?
the error not display when use an invalid login, i use my theme. this is my own theme, i think there is miss css style. thank you ryan.
Add this code to your theme's view.php where you want your errors to be displayed. This is the error display code from the /concrete/themes/core/concrete.php file.
<? if (isset($error) && $error != '') { ?> <? if ($error instanceof Exception) { $_error[] = $error->getMessage(); } else if ($error instanceof ValidationErrorHelper) { $_error = $error->getList(); } else if (is_array($error)) { $_error = $error; } else if (is_string($error)) { $_error[] = $error; } ?> <ul class="ccm-error"> <? foreach($_error as $e) { ?><li><?=$e?></li><? } ?> </ul>
Viewing 15 lines of 17 lines. View entire code block.
thanks ryan, for the code, one question extra,
if we add atribut to user, not checked 'view in profile',
but can we still access the atribut, even the atribut not shown in profile view?
if we add atribut to user, not checked 'view in profile',
but can we still access the atribut, even the atribut not shown in profile view?
Yes, if you set the attribute value as a registration value, but not a profile value you'd have access to it in your code and in the dashboard.
What if you want to put that code/invalid login, in the login code is self & not the theme's view.php?
Thank you Ryan, I tried using your code (cut and paste), but I am still being forwarded to the do_login file when I want the user to stay at the page they are at, with the error appearing just above the login code. what is it I'm missing?
@sschildbach you may have a different issue, check your permissions on that page and make sure that if the user is logged in successfully they would have access to the page.
I think you are correct Ryan, my issue may be different. To reiterate my problem: I have a fully functioning login block on every page. When the user enters a wrong un or pw, they get redirected to do_login. I want the user to stay on the page they are on and see an error note beside the login. In view.php I see:
$loginURL= $this->url('/login', 'do_login' );
Can I change 'do_login' to code that will be the equivalent of "same page"?
$loginURL= $this->url('/login', 'do_login' );
Can I change 'do_login' to code that will be the equivalent of "same page"?
Here's how it works: The login block is just a form that posts to the default login page, if you've set the block to redirect users back to the current page it will also pass the id of the current page along with the username and password.
On a valid login the /login page is never displayed an the user is logged in and redirected to the page they came from. On an invalid login attempt the login page displays it's normal errors and stops the login process.
Changing the do_login action in the link will just cause it to not work.
The login block could be changed to submit via ajax and work the way you're describing, but it'd be a major rewrite of it.
On a valid login the /login page is never displayed an the user is logged in and redirected to the page they came from. On an invalid login attempt the login page displays it's normal errors and stops the login process.
Changing the do_login action in the link will just cause it to not work.
The login block could be changed to submit via ajax and work the way you're describing, but it'd be a major rewrite of it.
I understand now Ryan. I wasn't aware that the login block was really a form. With the use of css and minimal php know how, can I at least redesign the do_login page (mostly color and a background image) so that it matches my theme?
Check out the "best" answer in this thread:
https://www.concrete5.org/community/forums/themes/customizing-login-...
And combine that with the error display code I posted earlier in this thread.
https://www.concrete5.org/community/forums/themes/customizing-login-...
And combine that with the error display code I posted earlier in this thread.
Thanks Ryan!