From 4f2d900af7636e6744ae14aeeefdf2d6080ac50a Mon Sep 17 00:00:00 2001 From: George Halkiadakis Date: Thu, 30 Mar 2023 05:03:23 +0300 Subject: several mail options tested; mailhog (fake) mailer is working --- html/app/extends/Classroom_manager.php | 106 +++++++++++++++++++++++++++++++++ html/app/extends/Classroom_user.php | 105 ++++++++------------------------ 2 files changed, 131 insertions(+), 80 deletions(-) create mode 100644 html/app/extends/Classroom_manager.php (limited to 'html/app/extends') diff --git a/html/app/extends/Classroom_manager.php b/html/app/extends/Classroom_manager.php new file mode 100644 index 0000000..4d38ba3 --- /dev/null +++ b/html/app/extends/Classroom_manager.php @@ -0,0 +1,106 @@ +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 diff --git a/html/app/extends/Classroom_user.php b/html/app/extends/Classroom_user.php index b451114..fd1e573 100644 --- a/html/app/extends/Classroom_user.php +++ b/html/app/extends/Classroom_user.php @@ -1,107 +1,52 @@ POST + /** getPrivileges * + * @return privileges (array) */ - public function register_user() + public function getPrivileges(): array { - $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); - } - + return $this->privileges; } - - public function login_user() - { - - } - - - /** forgot password + /** setPrivileges() * - * send an otp - * (then verify) + * @param array $privileges * + * @return User */ - public function forgot_password() + public function setPrivileges(array $privileges): self { - - } - - - /** 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) - { - + $this->privileges = $privileges; + return $this; } -- cgit v1.2.3