Commit 68cf4667 authored by Richard Mansfield's avatar Richard Mansfield
Browse files

Allow for sesskey, deleted, suspended checks without a pieform object


Signed-off-by: default avatarRichard Mansfield <richardm@catalyst.net.nz>
parent c0d05132
...@@ -1451,12 +1451,12 @@ function pieform_configure() { ...@@ -1451,12 +1451,12 @@ function pieform_configure() {
); );
} }
function pieform_validate(Pieform $form, $values) { function form_validate($sesskey) {
global $USER; global $USER;
if (!isset($values['sesskey'])) { if (is_null($sesskey)) {
throw new UserException('No session key'); throw new UserException('No session key');
} }
if ($USER && $USER->is_logged_in() && $USER->get('sesskey') != $values['sesskey']) { if ($USER && $USER->is_logged_in() && $USER->get('sesskey') != $sesskey) {
throw new UserException('Invalid session key'); throw new UserException('Invalid session key');
} }
...@@ -1478,6 +1478,13 @@ function pieform_validate(Pieform $form, $values) { ...@@ -1478,6 +1478,13 @@ function pieform_validate(Pieform $form, $values) {
} }
} }
function pieform_validate(Pieform $form, $values) {
if (!isset($values['sesskey'])) {
throw new UserException('No session key');
}
form_validate($values['sesskey']);
}
function pieform_reply($code, $data) { function pieform_reply($code, $data) {
global $SESSION; global $SESSION;
if (isset($data['message'])) { if (isset($data['message'])) {
......
Supports Markdown
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