Form button class update, fixes to module_method_token, fixes to json
This commit is contained in:
parent
c55a8fe4cc
commit
52074d239b
@ -123,7 +123,7 @@ class Controller_Admin_Module_Method extends Controller_Admin_Module {
|
||||
}
|
||||
$output .= View::factory('module/admin/method_detail_foot');
|
||||
|
||||
$output .= '<div>'.Form::submit('submit',_('Update')).'</div>';
|
||||
$output .= '<div>'.Form::submit('submit',_('Update'),array('class'=>'form_button')).'</div>';
|
||||
$output .= Form::close();
|
||||
|
||||
Block::add(array(
|
||||
|
@ -119,6 +119,9 @@ class Controller_lnApp_Login extends Controller_TemplateDefault {
|
||||
* Enable user password reset
|
||||
*/
|
||||
public function action_reset() {
|
||||
// Minutes to keep our token
|
||||
$token_expire = 15;
|
||||
|
||||
// If user already signed-in
|
||||
if (Auth::instance()->logged_in()!= 0) {
|
||||
// Redirect to the user account
|
||||
@ -138,7 +141,7 @@ class Controller_lnApp_Login extends Controller_TemplateDefault {
|
||||
|
||||
// Check to see if there is already a token, if so, do nothing.
|
||||
if ($mt->where('account_id','=',$ao->id)->and_where('method_id','=',$mmo->id)->find()) {
|
||||
if ($mt->date_expire < time()) {
|
||||
if ($mt->loaded() AND ($mt->date_expire < time())) {
|
||||
$mt->delete();
|
||||
$mt->clear();
|
||||
}
|
||||
@ -147,18 +150,19 @@ class Controller_lnApp_Login extends Controller_TemplateDefault {
|
||||
if (! $mt->loaded()) {
|
||||
$mt->account_id = $ao->id;
|
||||
$mt->method_id = $mmo->id;
|
||||
$mt->date_expire = time() + 15*3600;
|
||||
$mt->date_expire = time() + $token_expire*60;
|
||||
$mt->token = md5(sprintf('%s:%s:%s',$mt->account_id,$mt->method_id,$mt->date_expire));
|
||||
$mt->save();
|
||||
|
||||
// Send our email with the token
|
||||
$et = Email_Template::instance('account_reset_password');
|
||||
$et->to = array($mt->account->email=>sprintf('%s %s',$mt->account->first_name,$mt->account->last_name));
|
||||
$et->to = array('account'=>array($mt->account_id));
|
||||
$et->variables = array(
|
||||
'SITE'=>URL::base(TRUE,TRUE),
|
||||
'SITE_ADMIN'=>Config::sitename(),
|
||||
'SITE_NAME'=>Config::sitename(),
|
||||
'TOKEN'=>$mt->token,
|
||||
'TOKEN_EXPIRE_MIN'=>$token_expire,
|
||||
'USER_NAME'=>sprintf('%s %s',$mt->account->first_name,$mt->account->last_name),
|
||||
);
|
||||
$et->send();
|
||||
|
@ -21,11 +21,12 @@ class Controller_Tree extends Controller_lnApp_Tree {
|
||||
*
|
||||
* @param id
|
||||
*/
|
||||
public function action_json($id=null,array $data=array()) {
|
||||
public function action_json($id=NULL,array $data=array()) {
|
||||
// Get the user details
|
||||
$id = (is_null($id) && isset($_REQUEST['id'])) ? substr($_REQUEST['id'],2) : $id;
|
||||
$id = (is_null($id) AND isset($_REQUEST['id'])) ? substr($_REQUEST['id'],2) : $id;
|
||||
$user = Auth::instance()->get_user();
|
||||
|
||||
if ($user) {
|
||||
if (! $id) {
|
||||
$modules = array();
|
||||
foreach ($user->groups() as $go)
|
||||
@ -66,6 +67,7 @@ class Controller_Tree extends Controller_lnApp_Tree {
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->output = array();
|
||||
|
||||
|
@ -4,9 +4,6 @@
|
||||
font-family: Verdana, Arial, Helvetica, sans-serif;
|
||||
font-size: 12px;
|
||||
color: #000000;
|
||||
background-color: #E1E1E3;
|
||||
border-color: #AAAACC;
|
||||
border-width: 1px;
|
||||
padding: 1px;
|
||||
}
|
||||
|
||||
|
@ -9,7 +9,7 @@
|
||||
<tr><td colspan="2"> </td></tr>
|
||||
<!-- @todo Password reset ability should be a config option (or auto detected) -->
|
||||
<tr><td colspan="2"><?echo HTML::anchor('login/reset',_('Forgot your password?')); ?></td></tr>
|
||||
<tr><td colspan="2" style="text-align: center;"><?php echo Form::submit('submit',_('Authenticate'));?></td></tr>
|
||||
<tr><td colspan="2" style="text-align: center;"><?php echo Form::submit('submit',_('Authenticate'),array('class'=>'form_button'));?></td></tr>
|
||||
</table>
|
||||
<?php echo Form::close(); ?>
|
||||
<!-- @todo The following focus() is not ajax/jscript friendly -->
|
||||
|
@ -7,7 +7,7 @@
|
||||
<table class="login">
|
||||
<tr><td><b>Email Address</b></td></tr>
|
||||
<tr><td><?php echo Form::input('email',null,array('id'=>'login-uid','size'=>40));?></td></tr>
|
||||
<tr><td colspan="2" style="text-align: center;"><?php echo Form::submit('submit',_('Reset'));?></td></tr>
|
||||
<tr><td colspan="2" style="text-align: center;"><?php echo Form::submit('submit',_('Reset'),array('class'=>'form_button'));?></td></tr>
|
||||
</table>
|
||||
<?php echo Form::close(); ?>
|
||||
<!-- @todo The following focus() is not ajax/jscript friendly -->
|
||||
|
@ -6,7 +6,7 @@
|
||||
<table class="login">
|
||||
<tr><td><b>Pass code</b></td></tr>
|
||||
<tr><td><?php echo Form::input('token',null,array('id'=>'login-pwd','size'=>40));?></td></tr>
|
||||
<tr><td colspan="2" style="text-align: center;"><?php echo Form::submit('submit',_('Reset'));?></td></tr>
|
||||
<tr><td colspan="2" style="text-align: center;"><?php echo Form::submit('submit',_('Reset'),array('class'=>'form_button'));?></td></tr>
|
||||
</table>
|
||||
<?php echo Form::close(); ?>
|
||||
<!-- @todo The following focus() is not ajax/jscript friendly -->
|
||||
|
@ -17,5 +17,5 @@
|
||||
<td><?php echo StaticList_YesNo::form('menu_display',0); ?></td>
|
||||
</tr>
|
||||
</table>
|
||||
<?php echo Form::submit('submit',_('Add')); ?>
|
||||
<?php echo Form::submit('submit',_('Add'),array('class'=>'form_button')); ?>
|
||||
<?php echo Form::close(); ?>
|
||||
|
@ -109,7 +109,6 @@ class Auth_OSB extends Auth_ORM {
|
||||
|
||||
// Check and see if we have a token to login and run the method
|
||||
} elseif ((! empty($_REQUEST['token']) AND $token = $_REQUEST['token']) OR $token=Session::instance()->get('token')) {
|
||||
|
||||
if ($user=$this->_get_token_user($token) AND $user !== FALSE)
|
||||
$status = TRUE;
|
||||
|
||||
@ -149,7 +148,6 @@ class Auth_OSB extends Auth_ORM {
|
||||
*/
|
||||
private function _get_token_user($token) {
|
||||
$mmto = ORM::factory('module_method_token',array('token'=>$token));
|
||||
$request = Request::current();
|
||||
$user = FALSE;
|
||||
|
||||
if ($mmto->loaded()) {
|
||||
@ -164,9 +162,9 @@ class Auth_OSB extends Auth_ORM {
|
||||
|
||||
} else {
|
||||
// Check that the token is for this URI
|
||||
$mo = ORM::factory('module',array('name'=>$request->controller));
|
||||
$mo = ORM::factory('module',array('name'=>Request::current()->controller()));
|
||||
$mmo = ORM::factory('module_method',
|
||||
array('name'=>$request->directory ? sprintf('%s_%s',$request->directory,$request->action) : $request->action));
|
||||
array('name'=>Request::current()->directory() ? sprintf('%s_%s',Request::current()->directory(),Request::current()->action()) : Request::current()->action()));
|
||||
|
||||
// Ignore the token if this is not the right method.
|
||||
if ($mmo->id == $mmto->method_id) {
|
||||
|
@ -1,4 +1,5 @@
|
||||
<!-- @todo NEEDS TO BE TRANSLATED -->
|
||||
<br/>
|
||||
<?php echo Form::open(); ?>
|
||||
<table class="box-center">
|
||||
<tr>
|
||||
@ -10,7 +11,7 @@
|
||||
<td><input type="password" name="password_confirm" value=""/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" style="text-align: center;"><?php echo Form::submit('update','Update'); ?></td>
|
||||
<td colspan="2" style="text-align: center;"><?php echo Form::submit('update','Update',array('class'=>'form_button')); ?></td>
|
||||
</tr>
|
||||
</table>
|
||||
<?php echo Form::close(); ?>
|
||||
|
@ -78,7 +78,7 @@
|
||||
</tr>
|
||||
<!-- @todo OTHER STATIC VARS -->
|
||||
<tr>
|
||||
<td colspan="2" style="text-align: center;"><?php echo Form::submit('update','Update'); ?></td>
|
||||
<td colspan="2" style="text-align: center;"><?php echo Form::submit('update','Update',array('class'=>'form_button')); ?></td>
|
||||
</tr>
|
||||
</table>
|
||||
<?php echo Form::close(); ?>
|
||||
|
@ -125,7 +125,7 @@
|
||||
<td><?php echo StaticList_YesNo::form('email_type',true); ?></td>
|
||||
</tr>
|
||||
<tr><td colspan="2"> </td></tr>
|
||||
<tr><td colspan="2" style="text-align: center;"><?php echo Form::submit('submit',_('Register'));?></td></tr>
|
||||
<tr><td colspan="2" style="text-align: center;"><?php echo Form::submit('submit',_('Register'),array('class'=>'form_button'));?></td></tr>
|
||||
</table>
|
||||
<?php echo Form::close(); ?>
|
||||
<!-- @todo The following focus() is not ajax/jscript friendly -->
|
||||
|
@ -88,7 +88,7 @@ class Controller_Admin_Email extends Controller_TemplateDefault_Admin {
|
||||
$output .= Form::open();
|
||||
$output .= View::factory('email/admin/template/add');
|
||||
$output .= View::factory('email/admin/template/translate/add');
|
||||
$output .= '<div>'.Form::submit('submit',_('Add')).'</div>';
|
||||
$output .= '<div>'.Form::submit('submit',_('Add'),array('class'=>'form_button')).'</div>';
|
||||
$output .= Form::close();
|
||||
|
||||
Editor::add();
|
||||
@ -139,7 +139,7 @@ class Controller_Admin_Email extends Controller_TemplateDefault_Admin {
|
||||
));
|
||||
}
|
||||
|
||||
$output .= '<div>'.Form::submit('submit',_('Update')).'</div>';
|
||||
$output .= '<div>'.Form::submit('submit',_('Update'),array('class'=>'form_button')).'</div>';
|
||||
$output .= Form::close();
|
||||
|
||||
Editor::add();
|
||||
|
@ -62,7 +62,7 @@ class Controller_Admin_Export extends Controller_TemplateDefault_Admin {
|
||||
}
|
||||
|
||||
$output .= '</table>';
|
||||
$output .= Form::submit('submit','export');
|
||||
$output .= Form::submit('submit','export',array('class'=>'form_button'));
|
||||
$output .= Form::close();
|
||||
|
||||
Style::add(array(
|
||||
|
@ -1,6 +1,6 @@
|
||||
<tr>
|
||||
<td colspan="3"><?php echo Form::select('plugin',$plugins); ?></td>
|
||||
<td colspan="2" style="text-align: right;"><?php echo Form::submit('submit','export'); ?></td>
|
||||
<td colspan="2" style="text-align: right;"><?php echo Form::submit('submit','export',array('class'=>'form_button')); ?></td>
|
||||
</tr>
|
||||
<!-- // @todo To translate -->
|
||||
<tr>
|
||||
|
@ -77,7 +77,7 @@ echo Form::open('cart/add');
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="text-align: center;"><?php echo Form::submit('submit','Add to Cart'); ?> | <?php echo Form::submit('submit','Add to Cart & Checkout',array('disabled'=>'disabled')); ?></td>
|
||||
<td style="text-align: center;"><?php echo Form::submit('submit','Add to Cart',array('class'=>'form_button')); ?> | <?php echo Form::submit('submit','Add to Cart & Checkout',array('disabled'=>'disabled'),array('class'=>'form_button')); ?></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
|
@ -380,7 +380,7 @@ GROUP BY DATE_FORMAT(DATE,"%%Y-%%m"),SID
|
||||
$output .= Form::open(NULL,array('enctype'=>'multipart/form-data'));
|
||||
$output .= '<div>';
|
||||
$output .= Form::file('csv');
|
||||
$output .= Form::submit('submit','upload');
|
||||
$output .= Form::submit('submit','upload',array('class'=>'form_button'));
|
||||
$output .= '</div>';
|
||||
$output .= Form::close();
|
||||
|
||||
|
@ -64,5 +64,5 @@
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<?php echo Form::submit('submit',_('Update')); ?>
|
||||
<?php echo Form::submit('submit',_('Update'),array('class'=>'form_button')); ?>
|
||||
<?php echo Form::close(); ?>
|
||||
|
@ -61,7 +61,7 @@
|
||||
<table>
|
||||
<tr>
|
||||
<td>View Daily Traffic for Month</td>
|
||||
<td><?php echo Form::open(); echo Form::select('month',array_merge(array(''),$so->get_traffic_months()),(isset($_POST['month']) ? $_POST['month'] : '')); echo Form::submit('submit',_('Show')); echo Form::close(); ?></td>
|
||||
<td><?php echo Form::open(); echo Form::select('month',array_merge(array(''),$so->get_traffic_months()),(isset($_POST['month']) ? $_POST['month'] : '')); echo Form::submit('submit',_('Show'),array('class'=>'form_button')); echo Form::close(); ?></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
|
Reference in New Issue
Block a user