diff --git a/classes/lnApp/Controller/Login.php b/classes/lnApp/Controller/Login.php
index ede570a..c498f31 100644
--- a/classes/lnApp/Controller/Login.php
+++ b/classes/lnApp/Controller/Login.php
@@ -13,6 +13,8 @@
abstract class lnApp_Controller_Login extends Controller_TemplateDefault {
protected $auth_required = FALSE;
+ protected $login_attribute = 'email';
+
/**
* Activate an account so that it can login and use the site
*/
@@ -208,12 +210,12 @@ abstract class lnApp_Controller_Login extends Controller_TemplateDefault {
*/
public function action_reset() {
// Minutes to keep our token
- $token_expire = 15*60;
+ $token_expire = 15;
// If the user posted their details to reset their password
if ($this->request->post()) {
// If the username is correct, create a method token
- if ($ao=ORM::factory('Account',array('email'=>$this->request->post('username'))) AND $ao->loaded()) {
+ if ($this->request->post('username') AND ($ao=ORM::factory('Account',array($this->login_attribute=>$this->request->post('username')))) AND $ao->loaded()) {
$token = $ao->token($token_expire,'account','user:resetpassword',2);
if ($token) {
diff --git a/classes/lnApp/Email.php b/classes/lnApp/Email.php
index ce4ca41..6332834 100644
--- a/classes/lnApp/Email.php
+++ b/classes/lnApp/Email.php
@@ -226,6 +226,9 @@ abstract class lnApp_Email extends Kohana_Email {
* Get email details
*/
private function email($key) {
+ if (! isset($this->_email[$key]))
+ return array();
+
if (is_array($this->_email[$key]) AND isset($this->_email[$key]['email']))
return $this->_email[$key]['email'];
else
diff --git a/classes/lnApp/Form.php b/classes/lnApp/Form.php
index 5f43cd0..70641d4 100644
--- a/classes/lnApp/Form.php
+++ b/classes/lnApp/Form.php
@@ -10,183 +10,17 @@
* @license http://dev.leenooks.net/license.html
*/
abstract class lnApp_Form extends Kohana_Form {
- /**
- * Render our control group form attributes
- *
- * @return array((string) control group wrapper,(array) attributes to exclude
- */
- private static function _controlgroup($name,array &$attributes=NULL) {
- // Bypass this rendering if nocg is set.
- if (isset($attributes['nocg'])) {
- unset($attributes['nocg']);
- return '%s';
- }
-
- if (! isset($attributes['class']))
- $attributes['class'] = 'form-control';
-
- $output = '';
-
- $output .= '
';
-
- // Only need col-md for horizonal forms?
- if (isset($attributes['label'])) {
- $output .= Form::label($name,$attributes['label'],array('class'=>'control-label'));
- unset($attributes['label']);
- }
-
- if (isset($attributes['help-block'])) {
- $help = $attributes['help-block'];
- unset($attributes['help-block']);
- }
-
- if (isset($attributes['add-on'])) {
- $addon = $attributes['add-on'];
- unset($attributes['add-on']);
- }
-
- $classdiv = FALSE;
- if (isset($attributes['divclass'])) {
- $output .= sprintf('