This commit is contained in:
2020-04-12 16:33:08 -04:00
parent 24ea6b9ae7
commit 90309496e9
7 changed files with 145 additions and 34 deletions
+77 -1
View File
@@ -106,7 +106,7 @@ class Auth extends Start_Controller {
public function resetpass() {
$data = array();
$out = array();
$data["next_page"] = 0;
$data["next_page"] = 50;
$data["error_message"] = "";
if ($_POST) {
$data['username'] = trim($this->input->post('username'));
@@ -128,4 +128,80 @@ class Auth extends Start_Controller {
$this->index();
}
public function passreset() {
$data = array();
$out = array();
$data["next_page"] = 0;
$data["error_message"] = '';
if ($_GET) {
$data['reset_key'] = trim($this->input->get('rlink'));
$data["mode"] = RESET_CONFIRM;
if ($data['reset_key'] != '') {
$this->coregrade_webapi(COREGRADE_START_RESET_PASSWORD, $data, $out);
// print_r($out);
if (isset($out["reset_id"]) && isset($out["reset_id"]) > 0) {
$data["next_page"] = 5500;
$data["reset_id"] = $out["reset_id"];
$data["username"] = $out["username"];
}
} else {
$data["error_message"] = "Please enter a valis username to continue";
}
}
$this->load->view('auth/view_head');
$this->load->view('auth/view_reset_password', $data);
$this->load->view('auth/view_foot');
}
public function completereset() {
$data = array();
$out = array();
$data["next_page"] = 5500;
$data["error_message"] = '';
if ($_POST) {
$data['reset_key'] = trim($this->input->post('rlink'));
$data['reset_id'] = trim($this->input->post('reset_id'));
$data['username'] = trim($this->input->post('username'));
$data['pass1'] = trim($this->input->post('pass1'));
$data['pass2'] = trim($this->input->post('pass2'));
$allow_next = false;
if ( strlen($data['pass1']) >7 && $data['pass1'] == $data['pass2']){
$allow_next = true;
}
else{
$data["error_message"] = "Please enter a valis username to continue";
}
$data["mode"] = RESET_COMPLETE;
if ($data['reset_key'] != '' && isset($out["reset_id"]) && isset($out["reset_id"]) > 0 && $allow_next == true) {
$this->coregrade_webapi(COREGRADE_START_RESET_PASSWORD, $data, $out);
// print_r($out);
if (0) {
$data["next_page"] = 5500;
$data["reset_id"] = $out["reset_id"];
$data["username"] = $out["username"];
}
} else {
$data["error_message"] = "Please enter a valid username to continue";
}
}
$this->load->view('auth/view_head');
$this->load->view('auth/view_reset_password', $data);
$this->load->view('auth/view_foot');
}
}
@@ -1,5 +1,5 @@
<?php
$next_page = isset($next_page) ? $next_page : 0;
$next_page = isset($next_page) ? $next_page : 50;
?>
<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">
@@ -29,7 +29,7 @@ $next_page = isset($next_page) ? $next_page : 0;
<div class="card-content">
<div class="card-body pt-1">
<?
if ($next_page == 0) {
if ($next_page == 50) {
?>
<p class="px-2">Please tell us your username.</p>
<form method="POST" action="/auth/resetpass">
@@ -72,7 +72,8 @@ $next_page = isset($next_page) ? $next_page : 0;
<?= $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>
@@ -80,23 +81,30 @@ $next_page = isset($next_page) ? $next_page : 0;
</form>
<?php
} else {
} else if ($next_page == 5500) {
?>
<form>
<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" required>
<label for="user-email">Email</label>
<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" placeholder="Password" required>
<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" placeholder="Confirm Password" required>
<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>
@@ -107,6 +115,30 @@ $next_page = isset($next_page) ? $next_page : 0;
</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
}
?>
+5 -4
View File
@@ -81,7 +81,7 @@
<li><a href="#pricing" class="smoothscroll">PLANS</a></li>
<li><a href="#download" class="smoothscroll">APP</a></li>
<li><a href="#contact" class="smoothscroll">CONTACT</a></li>
<li style="background-color: #FC6443;" onclick="viewLogin(); return;"><a href="/auth" >START</a></li>
<li style="background-color: #7367f0;" onclick="viewLogin(); return;"><a href="/auth" >START</a></li>
</ul>
</div>
</div>
@@ -205,8 +205,9 @@
<li data-value="tutor"><span>Parents</span></li>
-->
</ul>
<p class="wow fadeIn">Thus much I thought proper to tell you in relation to yourself, and to the trust I reposed in you.</p>
<p class="fade-text wow fadeIn">Have a bigger team? <a href="#">Lets talk</a></p>
<p class="wow fadeIn">A Modern, intuitive, effective digital learning <p >experience that minimizes complexity and </p><p>enables personalized learning at a convenience.</p>
<p class="fade-text wow fadeIn">Let Us Be Your Companion <a href="#">Lets talk</a></p>
</div>
</div>
<div class="col-xs-12 col-md-7">
@@ -232,7 +233,7 @@
<li><p>Flexible Learning</p></li>
<li><p>Personal Assistant</p></li>
</ul>
<a href="/auth/newuser" class="btn btn-default btn-outline">Make me a Pro</a>
<a href="/auth/newuser" class="btn btn-default btn-outline">Upgrade</a>
</li>
<!--
<li id="tutor">