Coregdae service
This commit is contained in:
@@ -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_DATABASE') || define('EXIT_DATABASE', 8); // database error
|
||||||
defined('EXIT__AUTO_MIN') || define('EXIT__AUTO_MIN', 9); // lowest automatically-assigned error code
|
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
|
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;
|
||||||
@@ -43,7 +43,7 @@ $routes->get('/howitworks', 'Home::howitworks');
|
|||||||
$routes->get('/auth', 'Home::login');
|
$routes->get('/auth', 'Home::login');
|
||||||
$routes->get('/newuser', 'Home::newuser');
|
$routes->get('/newuser', 'Home::newuser');
|
||||||
$routes->get('/resetpass', 'Home::resetpass');
|
$routes->get('/resetpass', 'Home::resetpass');
|
||||||
|
$routes->post('/resetpass', 'Home::resetpass');
|
||||||
|
|
||||||
$routes->get('/tools', 'Tools::index');
|
$routes->get('/tools', 'Tools::index');
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace App\Controllers;
|
namespace App\Controllers;
|
||||||
use App\Services\WpContentsClient;
|
use App\Services\WpContentsClient;
|
||||||
|
use App\Services\CoreGradeClient;
|
||||||
|
|
||||||
class Home extends BaseController
|
class Home extends BaseController
|
||||||
{
|
{
|
||||||
@@ -48,8 +49,23 @@ class Home extends BaseController
|
|||||||
public function resetpass()
|
public function resetpass()
|
||||||
{
|
{
|
||||||
$data = array();
|
$data = array();
|
||||||
|
$out = [];
|
||||||
$data["next_page"] = 50;
|
$data["next_page"] = 50;
|
||||||
$data["error_message"] = "";
|
$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);
|
return view('home/resetpass', $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,20 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Services;
|
||||||
|
use GuzzleHttp\Client as HTTPClient;
|
||||||
|
|
||||||
|
class CoreGradeClient
|
||||||
|
{
|
||||||
|
public static function coreGradeWebApi($action, $inArr, $outArr)
|
||||||
|
{
|
||||||
|
/* $apiEndpointsUrl='';
|
||||||
|
$client = new HTTPClient();
|
||||||
|
$response = $client->request(
|
||||||
|
'GET',
|
||||||
|
"{$apiEndpointsUrl}/wordpress-data"
|
||||||
|
);
|
||||||
|
return json_decode($response->getBody());
|
||||||
|
*/
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,7 +1,6 @@
|
|||||||
<?= $this->extend('layouts/loginlayout') ?>
|
<?= $this->extend('layouts/loginlayout') ?>
|
||||||
|
|
||||||
<?= $this->section('content') ?>
|
<?= $this->section('content') ?>
|
||||||
|
|
||||||
<body class="vertical-layout vertical-menu-modern 1-column navbar-floating footer-static bg-full-screen-image blank-page blank-page" data-open="click" data-menu="vertical-menu-modern" data-col="1-column">
|
<body class="vertical-layout vertical-menu-modern 1-column navbar-floating footer-static bg-full-screen-image blank-page blank-page" data-open="click" data-menu="vertical-menu-modern" data-col="1-column">
|
||||||
<!-- BEGIN: Content-->
|
<!-- BEGIN: Content-->
|
||||||
<div class="app-content content">
|
<div class="app-content content">
|
||||||
@@ -28,11 +27,9 @@
|
|||||||
|
|
||||||
<div class="card-content">
|
<div class="card-content">
|
||||||
<div class="card-body pt-1">
|
<div class="card-body pt-1">
|
||||||
<?
|
|
||||||
if ($next_page == 50) {
|
|
||||||
?>
|
|
||||||
<p class="px-2">Please tell us your username.</p>
|
<p class="px-2">Please tell us your username.</p>
|
||||||
<form method="POST" action="/auth/resetpass">
|
<form method="POST" action="/resetpass">
|
||||||
<fieldset class="form-label-group">
|
<fieldset class="form-label-group">
|
||||||
<input type="text" class="form-control" id="user-email" placeholder="Email" name="username" required>
|
<input type="text" class="form-control" id="user-email" placeholder="Email" name="username" required>
|
||||||
<label for="user-email">Email</label>
|
<label for="user-email">Email</label>
|
||||||
@@ -55,98 +52,6 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
<?php
|
|
||||||
} else if ($next_page == 100) {
|
|
||||||
?>
|
|
||||||
<form method="POST" action="/">
|
|
||||||
<fieldset class="form-label-group">
|
|
||||||
Check your email <b><?= $username ?></b> for a link to continue this process.
|
|
||||||
|
|
||||||
</fieldset>
|
|
||||||
|
|
||||||
<fieldset class="form-label-group">
|
|
||||||
<span style="color:red;">The email will expire in a few minutes if you did not receive the password reset email, please contact us.</span>
|
|
||||||
</fieldset>
|
|
||||||
|
|
||||||
<fieldset class="form-label-group">
|
|
||||||
<?= $error_message ?>
|
|
||||||
</fieldset>
|
|
||||||
<div class="row pt-2">
|
|
||||||
<div class="col-12 col-md-6 mb-1">
|
|
||||||
</div>
|
|
||||||
<div class="col-12 col-md-6 mb-1">
|
|
||||||
<button type="submit" class="btn btn-primary btn-block px-0">Return Home</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
|
|
||||||
<?php
|
|
||||||
} else if ($next_page == 5500) {
|
|
||||||
?>
|
|
||||||
<form method="POST" action='/auth/completereset'>
|
|
||||||
<input type='hidden' name='reset_id' value='<?= $reset_id ?>'>
|
|
||||||
<input type='hidden' name='reset_key' value='<?= $reset_key ?>'>
|
|
||||||
<input type='hidden' name='username' value='<?= $username ?>'>
|
|
||||||
|
|
||||||
<fieldset class="form-label-group">
|
|
||||||
<input type="text" class="form-control" id="user-email" placeholder="Email" value="<?= $username ?>" readonly required>
|
|
||||||
<label for="user-email">Username</label>
|
|
||||||
</fieldset>
|
|
||||||
|
|
||||||
<fieldset class="form-label-group">
|
|
||||||
<input type="password" class="form-control" id="user-password" name='pass1' placeholder="Password" required>
|
|
||||||
<label for="user-password">Password</label>
|
|
||||||
</fieldset>
|
|
||||||
|
|
||||||
<fieldset class="form-label-group">
|
|
||||||
<input type="password" class="form-control" id="user-confirm-password" name='pass2' placeholder="Confirm Password" required>
|
|
||||||
<label for="user-confirm-password">Confirm Password</label>
|
|
||||||
</fieldset>
|
|
||||||
<fieldset class="form-label-group">
|
|
||||||
<span style='color:red;'><?= $error_message ?></span>
|
|
||||||
</fieldset>
|
|
||||||
<div class="row pt-2">
|
|
||||||
<div class="col-12 col-md-6 mb-1">
|
|
||||||
<a href="/auth" class="btn btn-outline-primary btn-block px-0">Go Back to Login</a>
|
|
||||||
</div>
|
|
||||||
<div class="col-12 col-md-6 mb-1">
|
|
||||||
<button type="submit" class="btn btn-primary btn-block px-0">Reset</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
<?php
|
|
||||||
} else {
|
|
||||||
?>
|
|
||||||
<form method="POST" action="/">
|
|
||||||
<fieldset class="form-label-group">
|
|
||||||
Something went wrong
|
|
||||||
|
|
||||||
</fieldset>
|
|
||||||
|
|
||||||
<fieldset class="form-label-group">
|
|
||||||
<span style="color:red;">We have an error, it is possible that the link expired before you attempted the reset. Simply start the process again or contact us..</span>
|
|
||||||
</fieldset>
|
|
||||||
|
|
||||||
<fieldset class="form-label-group">
|
|
||||||
<?= $error_message ?>
|
|
||||||
</fieldset>
|
|
||||||
<div class="row pt-2">
|
|
||||||
<div class="col-12 col-md-6 mb-1">
|
|
||||||
</div>
|
|
||||||
<div class="col-12 col-md-6 mb-1">
|
|
||||||
<button type="submit" class="btn btn-primary btn-block px-0">Return Home</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
<?php
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user