summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/Psecio/Gatekeeper/UserModel.php20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/Psecio/Gatekeeper/UserModel.php b/src/Psecio/Gatekeeper/UserModel.php
index 1705460..f294587 100644
--- a/src/Psecio/Gatekeeper/UserModel.php
+++ b/src/Psecio/Gatekeeper/UserModel.php
@@ -464,4 +464,24 @@ class UserModel extends \Psecio\Gatekeeper\Model\Mysql
}
return $return;
}
+
+ /**
+ * Add a new security question to the current user
+ *
+ * @param array $data Security question data
+ * @return boolean Result of save operation
+ */
+ public function addSecurityQuestion(array $data)
+ {
+ if (!isset($data['question']) || !isset($data['answer'])) {
+ throw new \InvalidArgumentException('Invalid question/answer data provided.');
+ }
+
+ $question = new SecurityQuestionModel($this->getDb(), array(
+ 'question' => $data['question'],
+ 'answer' => $data['answer'],
+ 'userId' => $this->id
+ ));
+ return $this->getDb()->save($question);
+ }
} \ No newline at end of file