#125 ui for new features of security api
This commit is contained in:
parent
46e15a0358
commit
300a113251
@ -44,6 +44,60 @@ function init_saimod_sys_security_user() {
|
||||
}
|
||||
});
|
||||
});
|
||||
$('#btn_confirm_email').click(function(){
|
||||
$.get( './sai.php?call=account&action=requestemail&account='+$(this).attr('user'),function(data){
|
||||
if(data==1){
|
||||
alert('Email sent');
|
||||
} else {
|
||||
alert('fail');
|
||||
}
|
||||
});
|
||||
});
|
||||
$('#btn_change_password').click(function(){
|
||||
$.get( './sai.php?call=account&action=changepassword&account='+$(this).attr('user')+'&old_password_sha1='+'&new_password_sha1=',function(data){
|
||||
if(data==1){
|
||||
alert('Password Changed');
|
||||
} else {
|
||||
alert('fail');
|
||||
}
|
||||
});
|
||||
});
|
||||
$('#btn_reset_password').click(function(){
|
||||
$.get( './sai.php?call=account&action=resetpassword&account='+$(this).attr('user'),function(data){
|
||||
if(data==1){
|
||||
alert('Email sent');
|
||||
} else {
|
||||
alert('fail');
|
||||
}
|
||||
});
|
||||
});
|
||||
$('#btn_change_email').click(function(){
|
||||
$.get( './sai.php?call=account&action=changeemail&account='+$(this).attr('user')+'&new_email=',function(data){
|
||||
if(data==1){
|
||||
alert('Email sent');
|
||||
} else {
|
||||
alert('fail');
|
||||
}
|
||||
});
|
||||
});
|
||||
$('#btn_rename_account').click(function(){
|
||||
$.get( './sai.php?call=account&action=renameaccount&account='+$(this).attr('user')+'&new_account=',function(data){
|
||||
if(data==1){
|
||||
alert('Accountname changed');
|
||||
} else {
|
||||
alert('fail');
|
||||
}
|
||||
});
|
||||
});
|
||||
$('#btn_delete_account').click(function(){
|
||||
$.get( './sai.php?saimod...',function(data){
|
||||
if(data==1){
|
||||
alert('Account deleted');
|
||||
} else {
|
||||
alert('fail');
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function init_saimod_sys_security_rights() {
|
||||
|
||||
@ -3,10 +3,14 @@ namespace SYSTEM\SQL;
|
||||
class SYS_SAIMOD_SECURITY_USER extends \SYSTEM\DB\QP {
|
||||
public static function get_class(){return \get_class();}
|
||||
public static function pgsql(){return
|
||||
'SELECT id,username,email,joindate,locale, EXTRACT(EPOCH FROM last_active) as last_active ,account_flag FROM system.user WHERE username = $1 LIMIT 1;';
|
||||
'SELECT id,username,email,joindate,locale, EXTRACT(EPOCH FROM last_active) as last_active,email_confirmed'.
|
||||
' FROM system.user'.
|
||||
' WHERE username = $1 LIMIT 1;';
|
||||
}
|
||||
public static function mysql(){return
|
||||
'SELECT id,username,email,joindate,locale,last_active,account_flag FROM system_user WHERE username = ? LIMIT 1;';
|
||||
'SELECT id,username,email,joindate,locale,last_active,email_confirmed'.
|
||||
' FROM system_user'.
|
||||
' WHERE username = ? LIMIT 1;';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -108,6 +108,7 @@ class saimod_sys_security extends \SYSTEM\SAI\SaiModule {
|
||||
|
||||
public static function sai_mod__SYSTEM_SAI_saimod_sys_security_action_user($username){
|
||||
$vars = \SYSTEM\SQL\SYS_SAIMOD_SECURITY_USER::Q1(array($username));
|
||||
$vars['email_confirmed'] = $vars['email_confirmed'] == 1 ? 'Yes' : 'No';
|
||||
$vars['time_elapsed'] = \SYSTEM\time::time_ago_string(strtotime($vars['last_active']));
|
||||
$vars['user_rights'] = array_key_exists('id', $vars) ? self::user_rights($vars['id']) : '';
|
||||
$vars['user_actions'] = array_key_exists('id', $vars) ? self::user_actions($vars['id']) : '';
|
||||
@ -128,6 +129,7 @@ class saimod_sys_security extends \SYSTEM\SAI\SaiModule {
|
||||
$count_filtered = 0;
|
||||
$res->seek(100*$page);
|
||||
while(($r = $res->next()) && ($count_filtered < 100)){
|
||||
$r['email_confirmed'] = $r['email_confirmed'] == 1 ? 'Yes' : 'No';
|
||||
$r['class'] = self::tablerow_class($r['last_active']);
|
||||
$r['time_elapsed'] = \SYSTEM\time::time_ago_string($r['last_active']);
|
||||
$vars['table'] .= \SYSTEM\PAGE\replace::replaceFile((new \SYSTEM\PSAI('modules/saimod_sys_security/tpl/saimod_sys_security_user.tpl'))->SERVERPATH(),$r);
|
||||
|
||||
@ -5,7 +5,5 @@
|
||||
<td>${joindate}</td>
|
||||
<td>${locale}</td>
|
||||
<td>${time_elapsed}</td>
|
||||
<td>
|
||||
<button type="submit" class="btn-sm btn btn-success" value="reset_password" user="${id}" email="${email}"><span class="glyphicon glyphicon-envelope" aria-hidden="true"></span> ${basic_send_email}</button>
|
||||
</td>
|
||||
<td>${email_confirmed}</td>
|
||||
</tr>
|
||||
@ -28,8 +28,59 @@
|
||||
<td>${time_elapsed}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Flag(remove)</th>
|
||||
<td>${account_flag}</td>
|
||||
<th>Email Confirmed</th>
|
||||
<td>${email_confirmed}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>${table_action}</th>
|
||||
<td>
|
||||
<table style="width: 100%;">
|
||||
<tr>
|
||||
<td></td>
|
||||
<td>
|
||||
<button style="width: 100%;" type="submit" id="btn_confirm_email" class="btn-sm btn btn-success" user="${id}" email="${email}"><span class="glyphicon glyphicon-envelope" aria-hidden="true"></span> ${basic_confirm_email}</button>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<input class="input-medium" id="input_pw_old" type="text" placeholder="${basic_password_old}" size="20"/>
|
||||
<input class="input-medium" id="input_pw_new1" type="text" placeholder="${basic_password_new}" size="20"/>
|
||||
<input class="input-medium" id="input_pw_new2" type="text" placeholder="${basic_password_new}" size="20"/>
|
||||
</td>
|
||||
<td>
|
||||
<button style="width: 100%;" type="submit" id="btn_change_password" class="btn-sm btn btn-success" user="${id}" email="${email}"><span class="glyphicon glyphicon-pencil" aria-hidden="true"></span> ${basic_change_password}</button>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td>
|
||||
<button style="width: 100%;" type="submit" id="btn_reset_password" class="btn-sm btn btn-warning" user="${id}" email="${email}"><span class="glyphicon glyphicon-envelope" aria-hidden="true"></span> ${basic_reset_password}</button>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<input class="input-medium" id="input_new_email" type="text" placeholder="${basic_email_new}" size="20"/>
|
||||
</td>
|
||||
<td>
|
||||
<button style="width: 100%;" type="submit" id="btn_change_email" class="btn-sm btn btn-warning" user="${id}" email="${email}"><span class="glyphicon glyphicon-envelope" aria-hidden="true"></span> ${basic_change_email}</button>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<input class="input-medium" id="input_new_user" type="text" placeholder="${basic_username_new}" size="20"/>
|
||||
</td>
|
||||
<td>
|
||||
<button style="width: 100%;" type="submit" id="btn_rename_account" class="btn-sm btn btn-danger" user="${id}" email="${email}"><span class="glyphicon glyphicon-pencil" aria-hidden="true"></span> ${basic_rename}</button>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td>
|
||||
<button style="width: 100%;" type="submit" id="btn_delete_account" class="btn-sm btn btn-danger" user="${id}" email="${email}"><span class="glyphicon glyphicon-erase" aria-hidden="true"></span> ${basic_delete}</button>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</br>
|
||||
|
||||
@ -14,7 +14,7 @@
|
||||
<th>${table_join_date}</th>
|
||||
<th>${table_language}</th>
|
||||
<th>${table_last_active}</th>
|
||||
<th>${table_reset_password}</th>
|
||||
<th>${table_email_confirmed}</th>
|
||||
</tr>
|
||||
${table}
|
||||
</table>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user