diff options
-rw-r--r-- | Zotlabs/Module/Admin/Accounts.php | 25 | ||||
-rw-r--r-- | Zotlabs/Module/Regate.php | 30 | ||||
-rw-r--r-- | view/tpl/admin_accounts.tpl | 18 |
3 files changed, 40 insertions, 33 deletions
diff --git a/Zotlabs/Module/Admin/Accounts.php b/Zotlabs/Module/Admin/Accounts.php index a9d1c437f..7a698fb91 100644 --- a/Zotlabs/Module/Admin/Accounts.php +++ b/Zotlabs/Module/Admin/Accounts.php @@ -55,7 +55,7 @@ class Accounts { intval($_SESSION[self::MYP]['i'][$zarat]), dbesc($_SESSION[self::MYP]['h'][$zarat]) ); - $rc = '× ' . count($rd); + $rc = '×'; } elseif ($zarop == 'a') { // approval, REGISTER_DENIED by user 0x0040, REGISTER_AGREED by user 0x0020 @Regate @@ -195,6 +195,14 @@ class Accounts { $pending[$n]['reg_atip'] = $v['reg_atip'] . ' ◄' . $atipn[ $v['reg_atip'] ] . '×'; } + + $pending[$n]['status'] = t('Not yet verified'); + if($pending[$n]['reg_vfd']) + $pending[$n]['status'] = t('Verified'); + + if($pending[$n]['reg_expires'] < datetime_convert()) + $pending[$n]['status'] = t('Expired'); + // better secure $tao .= $n . ": '" . substr(bin2hex($v['reg_hash']),0,8) . "',"; $_SESSION[self::MYP]['h'][] = substr($v['reg_hash'],0,4); @@ -256,28 +264,30 @@ class Accounts { '$page' => t('Accounts'), '$submit' => t('Submit'), '$select_all' => t('select all'), - '$sel_tall' => t('SelectToggle'), - '$sel_deny' => t('× DenySelected'), - '$sel_aprv' => t('✔ ApproveSelected'), + '$sel_tall' => t('Select toggle'), + '$sel_deny' => t('Deny selected'), + '$sel_aprv' => t('Approve selected'), '$h_pending' => t('Registrations waiting for confirm'), - '$th_pending' => array( t('Request date'), t('Startup,Expires'), 'dId2', t('specified,atip') ), + '$th_pending' => array( t('Request date'), t('Status'), t('Startup,Expires'), 'dId2', t('specified,atip') ), '$no_pending' => t('No registrations.'), '$approve' => t('Approve'), '$deny' => t('Deny'), '$delete' => t('Delete'), '$block' => t('Block'), '$unblock' => t('Unblock'), + '$verified' => t('Verified'), + '$not_verified' => t('Not yet verified'), '$odir' => $odir, '$base' => $base, '$h_users' => t('Accounts'), '$th_users' => array( [ t('ID'), 'account_id' ], [ t('Email'), 'account_email' ], - [ t('All Channels'), 'channels' ], + [ t('All channels'), 'channels' ], [ t('Register date'), 'account_created' ], [ t('Last login'), 'account_lastlog' ], [ t('Expires'), 'account_expires' ], - [ t('Service Class'), 'account_service_class'] ), + [ t('Service class'), 'account_service_class'] ), '$confirm_delete_multi' => p2j(t('Selected accounts will be deleted!\n\nEverything these accounts had posted on this site will be permanently deleted!\n\nAre you sure?')), '$confirm_delete' => p2j(t('The account {0} will be deleted!\n\nEverything this account has posted on this site will be permanently deleted!\n\nAre you sure?')), @@ -285,7 +295,6 @@ class Accounts { '$form_security_token' => get_form_security_token("admin_accounts"), // values // - '$now' => date('Y-m-d H:i:s'), '$baseurl' => z_root(), '$tao' => $tao, '$pending' => $pending, diff --git a/Zotlabs/Module/Regate.php b/Zotlabs/Module/Regate.php index cf6b76bfa..b9b1c0d56 100644 --- a/Zotlabs/Module/Regate.php +++ b/Zotlabs/Module/Regate.php @@ -5,7 +5,7 @@ namespace Zotlabs\Module; require_once('include/security.php'); /** - * + * * @version 2.0.0 * @author hilmar runge * @since 2020-03-03 @@ -43,7 +43,7 @@ class Regate extends \Zotlabs\Web\Controller { $nextpage = ''; if ($did2) { - + $nowhhmm = date('Hi'); $day = date('N'); $now = date('Y-m-d H:i:s'); @@ -53,7 +53,7 @@ class Regate extends \Zotlabs\Web\Controller { if ($isduty['isduty'] !== false && $isduty['isduty'] != 1) { // normally, that should never happen here // log suitable for fail2ban also - $logmsg = 'ZAR1230S Unexpected registration verification request for ' + $logmsg = 'ZAR1230S Unexpected registration verification request for ' . get_config('system','sitename') . ' arrived from § ' . $ip . ' §'; zar_log($logmsg); goaway(z_root() . '/'); @@ -148,7 +148,7 @@ class Regate extends \Zotlabs\Web\Controller { set_aconfig($cra['account']['account_id'], 'register','channel_address',$reonar['chan.did1']); } - + authenticate_success($cra['account'],null,true,false,true); if($auto_create) { @@ -160,20 +160,20 @@ class Regate extends \Zotlabs\Web\Controller { change_channel($channel_id); $nextpage = 'profiles/' . $channel_id; $msg = 'ZAR1239I ' . t('Channel successfull created') . ' ' . $did2; - } + } else { $msg = 'ZAR1239E ' . t('Channel still not created') . ' ' . $did2; } zar_log($msg . ' ' . $reonar['chan.did1'] . ' (' . $reonar['chan.name'] . ')'); } unset($_SESSION['login_return_url']); - } + } else { q("ROLLBACK"); $msg = 'ZAR1238E ' . t('Account creation error'); zar_log($msg . ':' . print_r($cra, true)); } - } + } else { // new flags implemented and not recognized or sth like zar_log('ZAR1237D unexpected,' . $flags); @@ -187,17 +187,17 @@ class Regate extends \Zotlabs\Web\Controller { else { $msg = 'ZAR1235E' . ' ' . t('Token verification failed'); } - } + } else { $msg = 'ZAR1234W' . ' ' . t('Request not inside time frame'); //info($r[0]['reg_startup'] . EOL . $r[0]['reg_expire'] ); } - } + } else { $msg = 'ZAR1232E' . ' ' . t('Identity unknown'); zar_log($msg . ':' . $did2 . $didx); } - } + } else { $msg = 'ZAR1231E' . t('dId2 mistaken'); } @@ -241,7 +241,7 @@ class Regate extends \Zotlabs\Web\Controller { if ( ($didx == 'a' && substr( $did2 , -2) == substr( base_convert( md5( substr( $did2, 1, -2) ),16 ,10), -2)) || ($didx == 'e') ) { - $r = q("SELECT * FROM register WHERE reg_vital = 1 AND reg_didx = '%s' AND reg_did2 = '%s'", + $r = q("SELECT * FROM register WHERE reg_vital = 1 AND reg_didx = '%s' AND reg_did2 = '%s'", dbesc($didx), dbesc($did2) ); @@ -261,7 +261,7 @@ class Regate extends \Zotlabs\Web\Controller { . t('Only one instance admin has still to agree your account request.') . EOL . t('Please be patient') . EOL . EOL . 'ZAR1138I', ]); - } + } else { if ($deny) { @@ -279,7 +279,7 @@ class Regate extends \Zotlabs\Web\Controller { $reonar = json_decode( $r['reg_stuff'], true); $reonar['deny'] = $now . ',' . $ip . ' ' . $did2 . ' ' . $msg; - $flags = ( $r['reg_flags'] &= ( $r['reg_flags'] ^ ACCOUNT_UNVERIFIED) ) + $flags = ( $r['reg_flags'] &= ( $r['reg_flags'] ^ ACCOUNT_UNVERIFIED) ) | ( $r['reg_flags'] |= REGISTER_DENIED); $rd = q("UPDATE register SET reg_stuff='%s', reg_vital=0, reg_flags=%d WHERE reg_id = %d ", dbesc(json_encode($reonar)), @@ -291,7 +291,7 @@ class Regate extends \Zotlabs\Web\Controller { zar_log('ZAR1135E not awaited url parameter received'); goaway(z_root); } - } + } else { if ( $r['reg_startup'] <= $now && $r['reg_expires'] >= $now) { @@ -334,7 +334,7 @@ class Regate extends \Zotlabs\Web\Controller { ]); } - } + } else { $msg = 'ZAR1131E ' . t('dId2 mistaken'); // $log = ' from § ' . $ip . ' §' . ' (' . dbesc($did2) . ')'; diff --git a/view/tpl/admin_accounts.tpl b/view/tpl/admin_accounts.tpl index 444905fc7..9c78dbe54 100644 --- a/view/tpl/admin_accounts.tpl +++ b/view/tpl/admin_accounts.tpl @@ -19,9 +19,12 @@ {{foreach $pending as $n => $u}} <tr class="zebra zebra{{$u.reg_z}}"> <td class="created">{{$u.reg_created}}<br>{{$u.reg_n}} - {{if $u.reg_expires < $now}} ★EXPIRED★{{/if}}</td> + </td> + + <td class="status">{{$u.status}}</td> + <td class="created">{{$u.reg_startup}}<br>{{$u.reg_expires}}</td> - <td class="email">{{$u.reg_did2}}<br>{{if $u.reg_vfd}}verified{{else}}not yet verified{{/if}}</td> + <td class="email">{{$u.reg_did2}}</td> <td class="email">{{$u.reg_email}}<br>{{$u.reg_atip}}</td> <td class="checkbox_bulkedit"><input type="checkbox" class="pending_ckbx" id="id_pending_{{$n}}" name="pending[]" value="{{$n}}"></td> <td class="tools"> @@ -39,15 +42,10 @@ * *}} <div class="selectall"> - <a id="zar2aas" class="zar2xas btn btn-primary" href="javascript:;">{{$sel_aprv}}</a> ◄► - <a id="zar2das" class="zar2xas btn btn-primary" href="javascript:;">{{$sel_deny}}</a> ◄► - <a id="zar2sat" class="btn btn-primary" href="javascript:;">{{$sel_tall}}</a> - <br><br> + <a id="zar2sat" class="btn btn-sm btn-primary" href="javascript:;">{{$sel_tall}}</a> + <a id="zar2aas" class="zar2xas btn btn-sm btn-success" href="javascript:;"><i class="fa fa-check"></i> {{$sel_aprv}}</a> + <a id="zar2das" class="zar2xas btn btn-sm btn-danger" href="javascript:;"><i class="fa fa-close"></i> {{$sel_deny}}</a> </div> - <div class="submit"> - <input type="submit" name="page_accounts_deny" class="btn btn-primary" value="{{$deny}}" /> - <input type="submit" name="page_accounts_approve" class="btn btn-primary" value="{{$approve}}" /> - </div> {{else}} <p>{{$no_pending}}</p> {{/if}} |