From fa7303bc99ed56e6770928d59e16ee3306e26750 Mon Sep 17 00:00:00 2001 From: George Halkiadakis Date: Mon, 27 Mar 2023 03:19:43 +0300 Subject: several tests on user_manager extension --- core/classes/Request.php | 2 +- core/classes/authentication/Core/PasswordTrait.php | 6 +- core/classes/authentication/Core/UserManager.php | 10 ++-- .../authentication/Core/UserManagerInterface.php | 8 +-- core/classes/authentication/Token/UserToken.php | 6 +- .../authentication/Token/UserTokenInterface.php | 6 +- core/classes/authentication/User.php | 3 +- core/classes/authentication/UserInterface.php | 2 +- core/config/init.php | 1 - html/app/controllers/Classroom_user.php | 69 ++++++++++++++++++++++ html/app/extends/ClassUserMagager.php | 62 ------------------- html/app/models/admin/User_model.php | 5 +- html/app/routes/frontend.php | 9 ++- html/app/views/login.php | 4 +- tests/userman.php | 25 ++++++++ 15 files changed, 130 insertions(+), 88 deletions(-) create mode 100644 html/app/controllers/Classroom_user.php delete mode 100644 html/app/extends/ClassUserMagager.php create mode 100644 tests/userman.php diff --git a/core/classes/Request.php b/core/classes/Request.php index 6b82dc5..cedb8a1 100644 --- a/core/classes/Request.php +++ b/core/classes/Request.php @@ -87,7 +87,7 @@ class Request // TODO: // ... // if SCRF-token is not valideted, serve 403 - return $array; + return true; } diff --git a/core/classes/authentication/Core/PasswordTrait.php b/core/classes/authentication/Core/PasswordTrait.php index 2d3cbd2..40a7381 100644 --- a/core/classes/authentication/Core/PasswordTrait.php +++ b/core/classes/authentication/Core/PasswordTrait.php @@ -4,9 +4,9 @@ * @package DevCoder\Authentication\Core * */ -// namespace DevCoder\Authentication\Core; - -// use DevCoder\Authentication\UserInterface; +# namespace DevCoder\Authentication\Core; +# +# use DevCoder\Authentication\UserInterface; trait PasswordTrait { diff --git a/core/classes/authentication/Core/UserManager.php b/core/classes/authentication/Core/UserManager.php index 776cee9..a3c1cd5 100644 --- a/core/classes/authentication/Core/UserManager.php +++ b/core/classes/authentication/Core/UserManager.php @@ -4,11 +4,11 @@ * @package DevCoder\Authentication\Core * */ -// namespace DevCoder\Authentication\Core; - -// use DevCoder\Authentication\Token\UserToken; -// use DevCoder\Authentication\Token\UserTokenInterface; -// use DevCoder\Authentication\UserInterface; +# namespace DevCoder\Authentication\Core; +# +# use DevCoder\Authentication\Token\UserToken; +# use DevCoder\Authentication\Token\UserTokenInterface; +# use DevCoder\Authentication\UserInterface; class UserManager implements UserManagerInterface { diff --git a/core/classes/authentication/Core/UserManagerInterface.php b/core/classes/authentication/Core/UserManagerInterface.php index 4702992..05110fb 100644 --- a/core/classes/authentication/Core/UserManagerInterface.php +++ b/core/classes/authentication/Core/UserManagerInterface.php @@ -4,10 +4,10 @@ * @package DevCoder\Authentication\Core * */ -// namespace DevCoder\Authentication\Core; - -// use DevCoder\Authentication\Token\UserTokenInterface; -// use DevCoder\Authentication\UserInterface; +# namespace DevCoder\Authentication\Core; +# +# use DevCoder\Authentication\Token\UserTokenInterface; +# use DevCoder\Authentication\UserInterface; interface UserManagerInterface { diff --git a/core/classes/authentication/Token/UserToken.php b/core/classes/authentication/Token/UserToken.php index 520d4ad..b9bb024 100644 --- a/core/classes/authentication/Token/UserToken.php +++ b/core/classes/authentication/Token/UserToken.php @@ -4,9 +4,9 @@ * @package DevCoder\Authentication * */ -// namespace DevCoder\Authentication\Token; - -// use DevCoder\Authentication\UserInterface; +# namespace DevCoder\Authentication\Token; +# +# use DevCoder\Authentication\UserInterface; class UserToken implements UserTokenInterface { diff --git a/core/classes/authentication/Token/UserTokenInterface.php b/core/classes/authentication/Token/UserTokenInterface.php index f095a17..8e8b642 100644 --- a/core/classes/authentication/Token/UserTokenInterface.php +++ b/core/classes/authentication/Token/UserTokenInterface.php @@ -4,9 +4,9 @@ * @package DevCoder\Authentication\Token * */ -// namespace DevCoder\Authentication\Token; - -// use DevCoder\Authentication\UserInterface; +# namespace DevCoder\Authentication\Token; +# +# use DevCoder\Authentication\UserInterface; interface UserTokenInterface { diff --git a/core/classes/authentication/User.php b/core/classes/authentication/User.php index cc9d5e3..06f0ddb 100644 --- a/core/classes/authentication/User.php +++ b/core/classes/authentication/User.php @@ -6,7 +6,7 @@ * @package DevCoder\Authentication * */ -// namespace DevCoder\Authentication; +# namespace DevCoder\Authentication; class User implements UserInterface { @@ -27,6 +27,7 @@ class User implements UserInterface private $enabled = true; + /** GETs * ------------------------------------------------------------------------- */ diff --git a/core/classes/authentication/UserInterface.php b/core/classes/authentication/UserInterface.php index f81a9ee..b035215 100644 --- a/core/classes/authentication/UserInterface.php +++ b/core/classes/authentication/UserInterface.php @@ -5,7 +5,7 @@ * @package DevCoder\Authentication * */ -// namespace DevCoder\Authentication; +# namespace DevCoder\Authentication; interface UserInterface { diff --git a/core/config/init.php b/core/config/init.php index 2db2503..0dbaaf0 100644 --- a/core/config/init.php +++ b/core/config/init.php @@ -16,7 +16,6 @@ * anything else can be injected on-demand */ - // setup error-handliing // ----------------------------------------------------------------------------- require_once '../core/helpers/error_handling.php'; diff --git a/html/app/controllers/Classroom_user.php b/html/app/controllers/Classroom_user.php new file mode 100644 index 0000000..616ebf6 --- /dev/null +++ b/html/app/controllers/Classroom_user.php @@ -0,0 +1,69 @@ +user = new UserManager(); + + } + + + public function register_user() + { + $req = Registry::get('REQUEST'); + print_r($req->POST); die(); + + } + + + public function login_user() + { + + } + + + /** forgot password + * + * send an otp + * (then verify) + * + */ + public function forgot_password() + { + + } + + + /** Verify Account + * + * check if posted OTP matched the one sent to the user + * + */ + public function verify_otp() + { + + } + + +} \ No newline at end of file diff --git a/html/app/extends/ClassUserMagager.php b/html/app/extends/ClassUserMagager.php deleted file mode 100644 index c365670..0000000 --- a/html/app/extends/ClassUserMagager.php +++ /dev/null @@ -1,62 +0,0 @@ -register_user(); + }, + 'post' +); + // Resolve urls // --- -- -- - - - diff --git a/html/app/views/login.php b/html/app/views/login.php index 769b660..cc4556c 100644 --- a/html/app/views/login.php +++ b/html/app/views/login.php @@ -38,11 +38,11 @@
- +
- +
diff --git a/tests/userman.php b/tests/userman.php new file mode 100644 index 0000000..c08028c --- /dev/null +++ b/tests/userman.php @@ -0,0 +1,25 @@ +