Minor internal fixes
This commit is contained in:
parent
a7ed6672e1
commit
f679bf9c06
@ -31,7 +31,7 @@ abstract class lnApp_Auth_ORM extends Kohana_Auth_ORM {
|
|||||||
* @param $token The token
|
* @param $token The token
|
||||||
* @return Model_Account|NULL The user that the token is valid for.
|
* @return Model_Account|NULL The user that the token is valid for.
|
||||||
*/
|
*/
|
||||||
private function _get_token_user($token) {
|
protected function _get_token_user($token) {
|
||||||
list($id,$key) = explode(':',$token,2);
|
list($id,$key) = explode(':',$token,2);
|
||||||
|
|
||||||
$uo = ORM::factory('Account',$id);
|
$uo = ORM::factory('Account',$id);
|
||||||
|
@ -24,7 +24,13 @@ class lnApp_Controller_Login extends Controller_TemplateDefault {
|
|||||||
if ($ao->activated())
|
if ($ao->activated())
|
||||||
HTTP::redirect('login');
|
HTTP::redirect('login');
|
||||||
|
|
||||||
elseif ($ao->activate_code() == $this->request->post('code')) {
|
elseif (! $ao->active) {
|
||||||
|
SystemMessage::factory()
|
||||||
|
->title(_('Account NOT Activated'))
|
||||||
|
->type('warning')
|
||||||
|
->body(_('Your account cannot been activated, please contact us.'));
|
||||||
|
|
||||||
|
} elseif ($ao->activate_code() == $this->request->post('code')) {
|
||||||
$ao->verified = TRUE;
|
$ao->verified = TRUE;
|
||||||
$ao->save();
|
$ao->save();
|
||||||
|
|
||||||
@ -32,10 +38,10 @@ class lnApp_Controller_Login extends Controller_TemplateDefault {
|
|||||||
->title(_('Account Activated'))
|
->title(_('Account Activated'))
|
||||||
->type('info')
|
->type('info')
|
||||||
->body(_('Your account has been activated.'));
|
->body(_('Your account has been activated.'));
|
||||||
|
}
|
||||||
|
|
||||||
HTTP::redirect('welcome');
|
HTTP::redirect('welcome');
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
} elseif (! $this->request->param('id'))
|
} elseif (! $this->request->param('id'))
|
||||||
HTTP::redirect('login/activate_resend');
|
HTTP::redirect('login/activate_resend');
|
||||||
@ -44,7 +50,7 @@ class lnApp_Controller_Login extends Controller_TemplateDefault {
|
|||||||
->title('Activate account')
|
->title('Activate account')
|
||||||
->title_icon('fa-wrench')
|
->title_icon('fa-wrench')
|
||||||
->type('form-horizontal')
|
->type('form-horizontal')
|
||||||
->body(View::factory('login/activate')->set('o',Session::instance()->get_once('activate')));
|
->body(View::factory('login/activate')->set('o',Session::instance()->get_once('activate'))->set('email',$this->request->query('email')));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -80,7 +80,7 @@ abstract class lnApp_HTMLRender {
|
|||||||
public function render_all() {
|
public function render_all() {
|
||||||
$output = '';
|
$output = '';
|
||||||
|
|
||||||
for ($x=0; $x<static::$_c; $x++)
|
for ($x=0; $x<=static::$_c; $x++)
|
||||||
if (isset(static::$_data[$x])) {
|
if (isset(static::$_data[$x])) {
|
||||||
$output .= (string)$this->record($x);
|
$output .= (string)$this->record($x);
|
||||||
unset(static::$_data[$x]);
|
unset(static::$_data[$x]);
|
||||||
|
@ -51,12 +51,11 @@ abstract class lnApp_Site {
|
|||||||
$k = sprintf('%s_%s',strtolower($k),strtoupper($v));
|
$k = sprintf('%s_%s',strtolower($k),strtoupper($v));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($x=ORM::factory('Language',array('iso'=>$k)))
|
if ($x=ORM::factory('Language',array('iso'=>$k)) AND $x->loaded())
|
||||||
return $x;
|
return $x;
|
||||||
}
|
}
|
||||||
|
|
||||||
// @todo Return Default Language
|
return ORM::factory('Language',array('iso'=>Kohana::$config->load('config')->language));
|
||||||
return Kohana::$config->load('config')->language;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -22,7 +22,7 @@ abstract class lnApp_SystemMessage extends HTMLRender {
|
|||||||
|
|
||||||
// If we are a CLI session, then we have no session
|
// If we are a CLI session, then we have no session
|
||||||
if (PHP_SAPI !== 'cli')
|
if (PHP_SAPI !== 'cli')
|
||||||
Session::instance()->set('sessionmsgs',self::$_data);
|
Session::instance()->set('sessionmsgs',static::$_data);
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
@ -35,13 +35,13 @@ abstract class lnApp_SystemMessage extends HTMLRender {
|
|||||||
*/
|
*/
|
||||||
public static function add($msg,$prepend=FALSE) {
|
public static function add($msg,$prepend=FALSE) {
|
||||||
if ($msgs = Session::instance()->get_once('sessionmsgs'))
|
if ($msgs = Session::instance()->get_once('sessionmsgs'))
|
||||||
self::$_data = $msgs;
|
static::$_data = $msgs;
|
||||||
|
|
||||||
parent::add($msg);
|
parent::add($msg);
|
||||||
self::$_c = count(self::$_data);
|
static::$_c = count(static::$_data);
|
||||||
|
|
||||||
// Save our messages in our session, so that we get them for redirects
|
// Save our messages in our session, so that we get them for redirects
|
||||||
Session::instance()->set('sessionmsgs',self::$_data);
|
Session::instance()->set('sessionmsgs',static::$_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -50,7 +50,7 @@ abstract class lnApp_SystemMessage extends HTMLRender {
|
|||||||
* @see HTMLRender::render()
|
* @see HTMLRender::render()
|
||||||
*/
|
*/
|
||||||
protected function render() {
|
protected function render() {
|
||||||
$record = self::$_data[$this->_x];
|
$record = static::$_data[$this->_x];
|
||||||
|
|
||||||
$output = '';
|
$output = '';
|
||||||
|
|
||||||
@ -58,17 +58,17 @@ abstract class lnApp_SystemMessage extends HTMLRender {
|
|||||||
$output .= '<button type="button" class="close" data-dismiss="alert">×</button>';
|
$output .= '<button type="button" class="close" data-dismiss="alert">×</button>';
|
||||||
switch ($record['type']) {
|
switch ($record['type']) {
|
||||||
case 'error':
|
case 'error':
|
||||||
$output .= '<i class="icon-ban-circle"></i>';
|
$output .= '<i class="fa fa-exclamation-circle"></i>';
|
||||||
break;
|
break;
|
||||||
case 'success':
|
case 'success':
|
||||||
$output .= '<i class="icon-check"></i>';
|
$output .= '<i class="fa fa-check"></i>';
|
||||||
break;
|
break;
|
||||||
case 'warning':
|
case 'warning':
|
||||||
$output .= '<i class="icon-warning-sign"></i>';
|
$output .= '<i class="fa fa-warning"></i>';
|
||||||
break;
|
break;
|
||||||
case 'info':
|
case 'info':
|
||||||
default:
|
default:
|
||||||
$output .= '<i class="icon-info-sign"></i>';
|
$output .= '<i class="fa fa-info"></i>';
|
||||||
}
|
}
|
||||||
|
|
||||||
$output .= sprintf(' <strong>%s</strong>: %s',$record['title'],$record['body']);
|
$output .= sprintf(' <strong>%s</strong>: %s',$record['title'],$record['body']);
|
||||||
@ -83,9 +83,12 @@ abstract class lnApp_SystemMessage extends HTMLRender {
|
|||||||
public function render_all() {
|
public function render_all() {
|
||||||
// Reload our message from the session
|
// Reload our message from the session
|
||||||
if ($msgs = Session::instance()->get_once('sessionmsgs'))
|
if ($msgs = Session::instance()->get_once('sessionmsgs'))
|
||||||
self::$_data = $msgs;
|
static::$_data = $msgs;
|
||||||
|
|
||||||
return parent::render_all();
|
return parent::render_all();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function dump() {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
<fieldset>
|
<fieldset>
|
||||||
<legend>Account Details</legend>
|
<legend>Account Details</legend>
|
||||||
|
|
||||||
<?php echo Form::input('date_last',$o->date_last ? $o->display('date_last') : Site::date(time()),array('label'=>'Last Updated','class'=>'col-md-2','disabled')); ?>
|
|
||||||
|
|
||||||
<?php echo Form::input('email',$o->display('email'),array('label'=>'Email','class'=>'col-md-3','placeholder'=>'Email Address','type'=>'email','required','data-error'=>'Invalid EMAIL address')); ?>
|
<?php echo Form::input('email',$o->display('email'),array('label'=>'Email','class'=>'col-md-3','placeholder'=>'Email Address','type'=>'email','required','data-error'=>'Invalid EMAIL address')); ?>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
<?php else : ?>
|
<?php else : ?>
|
||||||
<div class="input-group col-md-3">
|
<div class="input-group col-md-3">
|
||||||
<span class="input-group-addon"><i class="fa fa-envelope fa-fw"></i></span>
|
<span class="input-group-addon"><i class="fa fa-envelope fa-fw"></i></span>
|
||||||
<input type="email" id="email" name="email" value="" placeholder="Email" class="form-control" required />
|
<input type="email" id="email" name="email" value="<?php echo $email; ?>" placeholder="Email" class="form-control" required />
|
||||||
</div>
|
</div>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
|
|
||||||
|
@ -44,6 +44,16 @@
|
|||||||
</div> <!-- /nav -->
|
</div> <!-- /nav -->
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
|
|
||||||
|
<div class="error-container">
|
||||||
|
<div class="error_details">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-8 col-md-offset-2">
|
||||||
|
<?php echo SystemMessage::factory()->render_all(); ?>
|
||||||
|
</div>
|
||||||
|
</div> <!-- /row -->
|
||||||
|
</div> <!-- /error_details -->
|
||||||
|
</div> <!-- /error_container -->
|
||||||
|
|
||||||
<div id="content">
|
<div id="content">
|
||||||
<?php echo $content; ?>
|
<?php echo $content; ?>
|
||||||
</div> <!-- /content -->
|
</div> <!-- /content -->
|
||||||
|
Reference in New Issue
Block a user