Modalise login

This commit is contained in:
Deon George 2013-05-16 21:50:30 +10:00
parent 684b46f585
commit c52e9b33d2
4 changed files with 25 additions and 9 deletions

View File

@ -10,6 +10,19 @@
* @license http://dev.osbill.net/license.html * @license http://dev.osbill.net/license.html
*/ */
class Auth_OSB extends Auth_ORM { class Auth_OSB extends Auth_ORM {
/**
* We need to override Kohana's __construct(), for tasks, which attempt to open a session
* and probably dont have access to PHP sessions path.
* Tasks dont need sessions anyway?
*/
public function __construct($config = array()) {
// Save the config in the object
$this->_config = $config;
if (PHP_SAPI !== 'cli')
parent::__construct($config);
}
/** /**
* Get the user that a token applies to * Get the user that a token applies to
* *
@ -181,6 +194,10 @@ class Auth_OSB extends Auth_ORM {
public function logged_in($role=NULL,$debug=NULL) { public function logged_in($role=NULL,$debug=NULL) {
$status = FALSE; $status = FALSE;
// If we are a CLI, we are not logged in
if (PHP_SAPI === 'cli')
return $status;
// Get the user from the session // Get the user from the session
$uo = $this->get_user(); $uo = $this->get_user();

View File

@ -72,21 +72,20 @@ class Controller_Login extends lnApp_Controller_Login {
// Show our token screen even if the email was invalid. // Show our token screen even if the email was invalid.
if (isset($_POST['username'])) if (isset($_POST['username']))
Block::factory() $output = View::factory('pages/login_reset_sent');
->body(View::factory('pages/login_reset_sent'));
else else
HTTP::redirect('login'); HTTP::redirect('login');
} else { } else {
Block::factory() $output = View::factory('pages/login_reset');
->body(View::factory('pages/login_reset'));
} }
Style::factory() Style::factory()
->type('file') ->type('file')
->data('media/theme/baseadmin/css/pages/login.css'); ->data('media/theme/baseadmin/css/pages/login.css');
$this->template->content = $output;
$this->template->shownavbar = FALSE; $this->template->shownavbar = FALSE;
} }
} }

View File

@ -1,15 +1,15 @@
<div class="account-container stacked"> <div class="account-container stacked">
<div class="content clearfix"> <div class="content clearfix">
<form method="post"> <form method="post" action="<?php echo URL::site('login/reset'); ?>">
<h1>Reset Password</h1> <h1>Reset Password</h1>
<p>If you have forgotten your password, we can issue you a temporary access code via email that will allow you to change your password.</p> <p>If you have forgotten your password, we can issue you a temporary access code via email that will allow you to change your password.</p>
<div class="login-fields"> <div class="login-fields">
<p>To start this process, please enter your email address.</p> <p>To start this process, please enter your Username. If you dont know your Username, please contact us.</p>
<div class="field"> <div class="field">
<label for="username">Username:</label> <label for="username">Username:</label>
<input type="text" id="username" name="username" value="" placeholder="Username" class="login username-field" /> <input type="text" id="username" name="username" value="" placeholder="Username" class="login username-field" required/>
</div> <!-- /field --> </div> <!-- /field -->
</div> <!-- /login-fields --> </div> <!-- /login-fields -->

View File

@ -1,13 +1,13 @@
<div class="account-container stacked"> <div class="account-container stacked">
<div class="content clearfix"> <div class="content clearfix">
<form method="post"> <form method="post" action="<?php echo URL::site('login/reset'); ?>">
<h1>Reset Password</h1> <h1>Reset Password</h1>
<div class="login-fields"> <div class="login-fields">
<p>You should have received an email with a pass code. Please enter that pass code here.</p> <p>You should have received an email with a pass code. Please enter that pass code here.</p>
<div class="field"> <div class="field">
<label for="token">Pass Code:</label> <label for="token">Pass Code:</label>
<input type="text" id="token" name="token" value="" placeholder="Token" class="login password-field" /> <input type="text" id="token" name="token" value="" placeholder="Token" class="login password-field" required/>
</div> <!-- /field --> </div> <!-- /field -->
</div> <!-- /login-fields --> </div> <!-- /login-fields -->