Skip to content
Snippets Groups Projects
Commit c9aad91e authored by Demian Katz's avatar Demian Katz
Browse files

Finished jquerymobile implementation.

parent de8d29b7
No related merge requests found
...@@ -110,8 +110,15 @@ class AbstractRecord extends AbstractBase ...@@ -110,8 +110,15 @@ class AbstractRecord extends AbstractBase
throw new ForbiddenException('Comments disabled'); throw new ForbiddenException('Comments disabled');
} }
$recaptchaActive = $this->recaptcha()->active('userComments');
// Force login: // Force login:
if (!($user = $this->getUser())) { if (!($user = $this->getUser())) {
// Validate CAPTCHA before redirecting to login:
if (!$this->formWasSubmitted('comment', $recaptchaActive)) {
return $this->redirectToRecord('', 'UserComments');
}
// Remember comment since POST data will be lost: // Remember comment since POST data will be lost:
return $this->forceLogin( return $this->forceLogin(
null, ['comment' => $this->params()->fromPost('comment')] null, ['comment' => $this->params()->fromPost('comment')]
...@@ -125,6 +132,11 @@ class AbstractRecord extends AbstractBase ...@@ -125,6 +132,11 @@ class AbstractRecord extends AbstractBase
$comment = $this->params()->fromPost('comment'); $comment = $this->params()->fromPost('comment');
if (empty($comment)) { if (empty($comment)) {
$comment = $this->followup()->retrieveAndClear('comment'); $comment = $this->followup()->retrieveAndClear('comment');
} else {
// Validate CAPTCHA now only if we're not coming back post-login:
if (!$this->formWasSubmitted('comment', $recaptchaActive)) {
return $this->redirectToRecord('', 'UserComments');
}
} }
// At this point, we should have a comment to save; if we do not, // At this point, we should have a comment to save; if we do not,
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
<label for="comments_form_comment"><?=$this->transEsc("Your Comment")?>:</label> <label for="comments_form_comment"><?=$this->transEsc("Your Comment")?>:</label>
<textarea id="comments_form_comment" name="comment"></textarea> <textarea id="comments_form_comment" name="comment"></textarea>
</div> </div>
<?=$this->recaptcha()->html($this->tab->isRecaptchaActive()) ?>
<div data-role="fieldcontain"> <div data-role="fieldcontain">
<input type="submit" value="<?=$this->transEsc("Add your comment")?>"/> <input type="submit" value="<?=$this->transEsc("Add your comment")?>"/>
</div> </div>
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment