Bug in register.php: Registration doesn't work

Permalink 2 users found helpful
Hi

Today is my C5 problem day ;) I have following problem - first, what have I done:

- copy the single page "register.php" from "concrete\single_pages" to "\single_pages"
- edited the singe page "register.php"
- I set in the Dashboard: "Registration is enabled, email must be validated." and "Solving a CAPTCHA is required to register."

the problem:

- The registration form doesn't work. I don't know why - the file /concrete/controllers/register.php will be called but no error appears...

You can test it here:
http://www.around.ch/index.php/register/...
http://www.around.ch/index.php/login/...

What have i tested:
- Without registration restrictions only "Registration is enabled"
- With the original single page file

My C5 Version is:
- 5.3.3.1 (First Version was 5.2)

Thanks for any help.

greetings

marius

marius
 
marius replied on at Permalink Reply
marius
I Think the problem is here:

if($success) { 
   switch($success) { 
      case "registered": 
         ?>
         <p><strong><?php echo $successMsg ?></strong><br/><br/>
         <a href="<?php echo $this->url('/')?>"><?php echo t('Return to Home')?></a>
         <?php  
      break;
      case "validate": 
         ?>
         <p><?php echo $successMsg[0] ?></p>
         <p><?php echo $successMsg[1] ?></p>
         <p><a href="<?php echo $this->url('/')?>"><?php echo t('Return to Home')?></a></p>
         <?php 
      break;


The variable $success will not be set.
marius replied on at Permalink Reply
marius
LoL ok now i have found the problem.

I open the \controller\register.php and look at the line 214.

There will be the var $registerData['errors'] with print_r ($registerData['errors']); i look in to the array. The errors in the array was:

Array ( [0] => Incorrect image validation code. Please check the image and re-enter the letters or numbers as necessary. 
[1] => A password must be between 5 and 64 characters )


Now with a longer PW it works. Now i must bring the errors on the registration page...
Leap replied on at Permalink Reply
By the look of your example pages in the first post you solved it?

How did you do it because I have the exact same problem...

Thank you in advance for your reply!
Remo replied on at Permalink Reply
Remo
yes, I think you'll have the same problem with /login if you enter an incorrect password..

You won't see the error unless you use the default theme.
Remo replied on at Permalink Reply
Remo
oh I forgot to post a solution (:

<? if (isset($error)) { ?>
      <? 
      if ($error instanceof Exception) {
         $_error[] = $error->getMessage();
      } else if ($error instanceof ValidationErrorHelper) {
         $_error = array();
         if ($error->has()) {
            $_error = $error->getList();
         }
      } else {
         $_error = $error;
      }
      if (count($_error) > 0) {
         ?>
         <div class="message error">


copied from concrete/themes/core/dashboard.php
marius replied on at Permalink Reply
marius
oh sorry forgot to post the solution too. Use the "same" like remo.

if (isset($error)) {   
      ?><span class="ccm-error">> Es sind folgende Fehler aufgetreten:</span><?php
    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"> 
        <?php  foreach($_error as $e) { ?><li><?php echo $e?></li><?php  } ?> 
        </ul>
Leap replied on at Permalink Reply
Thank you both for the replies!
It works like a charm now!
pakigreenl replied on at Permalink Reply
pakigreenl
I've had the same problem. Thanks for the code but where do I insert that? I'm building my first C5 site and am feeling my way through this. Thanks.
marius replied on at Permalink Reply
marius
Hi

Copy the register.php from \concrete\single_pages to \single_pages.

Copy befor line 6 (if($success) {)following code:

if (isset($error)) {   
      ?><span class="ccm-error">> Es sind folgende Fehler aufgetreten:</span><?php
    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"> 
        <?php  foreach($_error as $e) { ?><li><?php echo $e?></li><?php  } ?> 
        </ul>
pakigreenl replied on at Permalink Reply
pakigreenl
Thanks, I will try that.
pakigreenl replied on at Permalink Reply
pakigreenl
Thanks that worked but i've lost most of the german i've learned could you translate the "Es sind folgende Fehler aufgetreten:" please. Thanks for all your help.
pakigreenl replied on at Permalink Reply
pakigreenl
I believe it reads: "The following error has occurred:"
Please confirm.Thanks.
marius replied on at Permalink Reply
marius
Jeahh or "The following errors occurred when attempting to process your request"
LotosNile replied on at Permalink Reply
LotosNile
I'm having the same problem. For some reason the code you provided breaks my registration process. I followed these direction, but it still just breaks my code.