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

Type: Discussion
Status: New
fastcrash
View Replies: View Best Answer
ryan replied on at Permalink Reply
ryan
Does your login page use your theme? Does the error display if you do an invalid login directly from your login page?
fastcrash replied on at Permalink Reply
fastcrash
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.
ryan replied on at Permalink Reply
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>
fastcrash replied on at Permalink Best Answer Reply
fastcrash
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?
ryan replied on at Permalink Reply
ryan
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.
Zerofr3ak replied on at Permalink Reply
Zerofr3ak
What if you want to put that code/invalid login, in the login code is self & not the theme's view.php?
sschildbach replied on at Permalink Reply
sschildbach
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?
ryan replied on at Permalink Reply
ryan
@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.
sschildbach replied on at Permalink Reply
sschildbach
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"?
ryan replied on at Permalink Reply
ryan
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.
sschildbach replied on at Permalink Reply
sschildbach
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?
ryan replied on at Permalink Reply
ryan
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.
sschildbach replied on at Permalink Reply
sschildbach
Thanks Ryan!

concrete5 Environment Information

Browser User-Agent String

Hide Post Content

This will replace the post content with the message: "Content has been removed by an Administrator"

Hide Content

Request Refund

You have not specified a license for this support ticket. You must have a valid license assigned to a support ticket to request a refund.