Many misc fixes

This commit is contained in:
Deon George
2012-02-22 19:15:46 +11:00
parent f0f6479ca2
commit d9c3394b0f
14 changed files with 47 additions and 18 deletions

View File

@@ -222,7 +222,7 @@ class Auth_OSB extends Auth_ORM {
// Load the user
$user = ORM::factory('account');
$user->where($user->unique_key($username), '=', $username)->find();
$user->where('username','=',$username)->find();
}
// If the passwords match, perform a login

View File

@@ -88,7 +88,7 @@ abstract class lnApp_Config extends Kohana_Config {
}
public static function login_uri() {
return ($ao = Auth::instance()->get_user()) ? HTML::anchor('user/account/edit',$ao->name()) : HTML::anchor('login',_('Login'));
return ($ao = Auth::instance()->get_user() AND is_object($ao)) ? HTML::anchor('user/account/edit',$ao->name()) : HTML::anchor('login',_('Login'));
}
/**

View File

@@ -130,8 +130,8 @@ class lnApp_Controller_Login extends Controller_TemplateDefault {
// If the user posted their details to reset their password
if ($_POST) {
// If the email address is correct, create a method token
if (! empty($_POST['email']) AND ($ao=ORM::factory('account',array('email'=>$_POST['email']))) AND $ao->loaded()) {
// If the username is correct, create a method token
if (! empty($_POST['username']) AND ($ao=ORM::factory('account',array('username'=>$_POST['username']))) AND $ao->loaded()) {
$mmto = ORM::factory('module_method_token')
->method(array('account','user_resetpassword'))
->account($ao)
@@ -164,7 +164,7 @@ class lnApp_Controller_Login extends Controller_TemplateDefault {
}
// Show our token screen even if the email was invalid.
if (isset($_POST['email']))
if (isset($_POST['username']))
Block::add(array(
'title'=>_('Reset your password'),
'body'=>View::factory('login_reset_sent'),

View File

@@ -82,6 +82,7 @@ class Model_Module_Method_Token extends ORMOSB {
return $this;
}
// @todo Login Reset: When called within a timelimit (so existing token already exists), is returning true but password reset emails have blanks where the tokens are
public function generate() {
if (! $this->account_id OR ! $this->method_id OR ! ($this->date_expire OR $this->uses))
return NULL;