Skip to content

Commit

Permalink
Fixed issue #12012: Partcipant with invlaid email are silently deleted
Browse files Browse the repository at this point in the history
  • Loading branch information
olleharstedt committed Dec 20, 2016
1 parent ac78076 commit c98afd6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
8 changes: 6 additions & 2 deletions application/controllers/admin/tokens.php
Expand Up @@ -596,7 +596,7 @@ public function addnew($iSurveyId)
'validuntil' => $validuntil,
);

// add attributes
// Add attributes
$attrfieldnames = Survey::model()->findByPk($iSurveyId)->tokenAttributes;
$aTokenFieldNames=Yii::app()->db->getSchema()->getTable("{{tokens_$iSurveyId}}",true);
$aTokenFieldNames=array_keys($aTokenFieldNames->columns);
Expand All @@ -618,10 +618,14 @@ public function addnew($iSurveyId)
$token = Token::create($iSurveyId);
$token->setAttributes($aData, false);
$inresult = $token->save();
$aData['success'] = true;
$aData['success'] = $inresult;
$aData['errors'] = $token->getErrors();
}
else {
$aData['success'] = false;
$aData['errors'] = array(
'token' => array(gT("There is already an entry with that exact token in the table. The same token cannot be used in multiple entries."))

This comment has been minimized.

Copy link
@Shnoulle

Shnoulle Dec 20, 2016

Collaborator

It's not in model this ? I look and remove it if not needed

This comment has been minimized.

Copy link
@olleharstedt

olleharstedt Dec 20, 2016

Author Contributor

Hm, OK. Sounds good.

);
}

$aData['thissurvey'] = getSurveyInfo($iSurveyId);
Expand Down
4 changes: 3 additions & 1 deletion application/views/admin/token/addtokenpost.php
Expand Up @@ -29,7 +29,9 @@
<div class="jumbotron message-box message-box-error">
<h2 class="text-danger">Add token entry</h2>
<p class="lead text-danger"><?php eT("Failed"); ?></p>
<p><?php eT("There is already an entry with that exact token in the table. The same token cannot be used in multiple entries."); ?></p>
<?php foreach ($errors as $error): ?>
<p class='lead'><?php echo $error[0]; ?></p>

This comment has been minimized.

Copy link
@Shnoulle

Shnoulle Dec 20, 2016

Collaborator

There can have more than 1 error :) . http://www.yiiframework.com/doc/api/1.1/CHtml#errorSummary-detail can be used here. I don't bremind, but elsewhare we show all errors, question->save() ?

This comment has been minimized.

Copy link
@olleharstedt

olleharstedt Dec 20, 2016

Author Contributor

I tried errorSummary, but styling was %$#@!.

This comment has been minimized.

Copy link
@olleharstedt

olleharstedt Dec 20, 2016

Author Contributor

This shows more than one error, btw.

This comment has been minimized.

Copy link
@Shnoulle

Shnoulle Dec 20, 2016

Collaborator

Ah great then :). I'm sure we have something somewhere ;)

<?php endforeach; ?>
<div class="container">
<div class="col-md-12 col-lg-4 col-lg-offset-2">
<input type='button' class="btn btn-large btn-default" value='<?php eT("Browse survey participants"); ?>' onclick="window.open('<?php echo $this->createUrl("admin/tokens/sa/browse/surveyid/$surveyid"); ?>', '_top')" /><br />
Expand Down

0 comments on commit c98afd6

Please sign in to comment.