From 17dd1f2adde317aae0f87c60c9805af76a500cd0 Mon Sep 17 00:00:00 2001 From: Olu Amey Date: Sat, 25 Sep 2021 23:59:07 -0400 Subject: [PATCH] Coregdae service --- app/Config/Constants.php | 16 ++++++ app/Config/Routes.php | 2 +- app/Controllers/Home.php | 16 ++++++ app/Services/CoreGradeClient.php | 20 +++++++ app/Views/home/resetpass.php | 99 +------------------------------- 5 files changed, 55 insertions(+), 98 deletions(-) create mode 100644 app/Services/CoreGradeClient.php diff --git a/app/Config/Constants.php b/app/Config/Constants.php index 8f8498a..b159048 100644 --- a/app/Config/Constants.php +++ b/app/Config/Constants.php @@ -77,3 +77,19 @@ defined('EXIT_USER_INPUT') || define('EXIT_USER_INPUT', 7); // invalid user defined('EXIT_DATABASE') || define('EXIT_DATABASE', 8); // database error defined('EXIT__AUTO_MIN') || define('EXIT__AUTO_MIN', 9); // lowest automatically-assigned error code defined('EXIT__AUTO_MAX') || define('EXIT__AUTO_MAX', 125); // highest automatically-assigned error code + + +const COREGRADE_ACCOUNT_TESTEMAIL = 11001; +const COREGRADE_ACCOUNT_PENDING = 11010; +const COREGRADE_VERIFY_PENDING_LINK = 11015; + +const COREGRADE_START_RESET_PASSWORD = 11017; + +const COREGRADE_ACCOUNT_CREATEACC = 11020; +const COREGRADE_ACCOUNT_LOGIN = 11025; +const COREGRADE_ACCOUNT_ADDCARD = 11027; +const COREGRADE_ACCOUNT_ADDPAGECARD = 11029; + +const RESET_START = 100; +const RESET_CONFIRM = 200; +const RESET_COMPLETE = 300; \ No newline at end of file diff --git a/app/Config/Routes.php b/app/Config/Routes.php index 37cb709..8f9da52 100644 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -43,7 +43,7 @@ $routes->get('/howitworks', 'Home::howitworks'); $routes->get('/auth', 'Home::login'); $routes->get('/newuser', 'Home::newuser'); $routes->get('/resetpass', 'Home::resetpass'); - +$routes->post('/resetpass', 'Home::resetpass'); $routes->get('/tools', 'Tools::index'); diff --git a/app/Controllers/Home.php b/app/Controllers/Home.php index 16f8c4e..817fac2 100644 --- a/app/Controllers/Home.php +++ b/app/Controllers/Home.php @@ -2,6 +2,7 @@ namespace App\Controllers; use App\Services\WpContentsClient; +use App\Services\CoreGradeClient; class Home extends BaseController { @@ -48,8 +49,23 @@ class Home extends BaseController public function resetpass() { $data = array(); + $out = []; $data["next_page"] = 50; $data["error_message"] = ""; + $request = \Config\Services::request(); + + if ($_POST) { + $data['username'] = trim($request->getVar('username')); + $data["mode"] = RESET_START; + if ($data['username'] != '') { + // echo COREGRADE_START_RESET_PASSWORD; + $ret = CoreGradeClient::coreGradeWebApi(COREGRADE_START_RESET_PASSWORD, $data, $out); + $data["next_page"] = 100; + } else { + $data["error_message"] = "Please enter a valid username to continue"; + + } + } return view('home/resetpass', $data); } diff --git a/app/Services/CoreGradeClient.php b/app/Services/CoreGradeClient.php new file mode 100644 index 0000000..d59af89 --- /dev/null +++ b/app/Services/CoreGradeClient.php @@ -0,0 +1,20 @@ +request( + 'GET', + "{$apiEndpointsUrl}/wordpress-data" + ); + return json_decode($response->getBody()); + */ + return []; + } +} \ No newline at end of file diff --git a/app/Views/home/resetpass.php b/app/Views/home/resetpass.php index 1ae2e79..c5154ae 100644 --- a/app/Views/home/resetpass.php +++ b/app/Views/home/resetpass.php @@ -1,7 +1,6 @@ extend('layouts/loginlayout') ?> section('content') ?> -
@@ -28,11 +27,9 @@
- +

Please tell us your username.

-
+
@@ -55,98 +52,6 @@
- -
-
- Check your email for a link to continue this process. - -
- -
- The email will expire in a few minutes if you did not receive the password reset email, please contact us. -
- -
- -
-
-
-
-
- -
-
-
- - -
- - - - -
- - -
- -
- - -
- -
- - -
-
- -
-
- -
- -
-
-
- -
-
- Something went wrong - -
- -
- We have an error, it is possible that the link expired before you attempted the reset. Simply start the process again or contact us.. -
- -
- -
-
-
-
-
- -
-
-
- - - - - - -