summaryrefslogtreecommitdiff
path: root/html/app/extends/Classroom_user.php
diff options
context:
space:
mode:
Diffstat (limited to 'html/app/extends/Classroom_user.php')
-rw-r--r--html/app/extends/Classroom_user.php108
1 files changed, 108 insertions, 0 deletions
diff --git a/html/app/extends/Classroom_user.php b/html/app/extends/Classroom_user.php
new file mode 100644
index 0000000..b451114
--- /dev/null
+++ b/html/app/extends/Classroom_user.php
@@ -0,0 +1,108 @@
+<?php
+namespace app\controllers;
+
+use UserManager;
+use Registry;
+use app\models\admin\User_model;
+
+
+
+/** ClassUserManager
+ *
+ * extends (anom's) UserManager
+ *
+ * this way it specializes the UserManagement
+ * according to this app's special rules
+ *
+ */
+class Classroom_user extends UserManager
+{
+
+ private $index_key = 'email'; // identifing user field (username, email, etc )
+
+ protected $user;
+
+ public function __construct()
+ {
+ parent::__construct();
+ }
+
+
+ /** register user
+ *
+ * register into database;
+ * send OTP for account confirmation
+ *
+ * @param (void) : user properties passed via REQUEST->POST
+ *
+ */
+ public function register_user()
+ {
+ $req = Registry::get('REQUEST');
+ $register = User_model::registerUser($req->POST);
+
+ if ($register['success']) {
+
+ //create OTP;
+ $otp = $this->create_OPT($register['id']);
+
+ // send for account confirmation
+
+
+ } else {
+ print_r($register);
+ }
+
+ }
+
+
+ public function login_user()
+ {
+
+ }
+
+
+ /** forgot password
+ *
+ * send an otp
+ * (then verify)
+ *
+ */
+ public function forgot_password()
+ {
+
+ }
+
+
+ /** create OTP
+ *
+ * create a random OTP
+ * keep it into User's database Table
+ *
+ * @param $id (int): user id
+ *
+ */
+ public function create_OTP($id)
+ {
+ $otp = rand(100000,999999);
+ User_model::set_OTP($id, $otp);
+
+ return true;
+ }
+
+
+ /** Verify Account
+ *
+ * check if posted OTP matched the one sent to the user
+ *
+ * @param $identity (array): pair of [index_key => identity_value]
+ * example: [ 'email' => 'geo@roptron.gr' ]
+ *
+ */
+ public function verify_otp($identity, $otp)
+ {
+
+ }
+
+
+} \ No newline at end of file