From e35ab97b7ecbd96e11883bc194bfe9fb5a72e7f2 Mon Sep 17 00:00:00 2001 From: Mario Date: Wed, 14 Apr 2021 19:40:51 +0000 Subject: register: provide a possibility to leave a message id registration is by approval --- Zotlabs/Module/Admin/Accounts.php | 13 +++++++++---- Zotlabs/Module/Regate.php | 1 - Zotlabs/Module/Register.php | 15 ++++++++++++--- include/account.php | 2 +- view/tpl/admin_accounts.tpl | 38 +++++++++++++++++++------------------- view/tpl/register.tpl | 12 +++--------- 6 files changed, 44 insertions(+), 37 deletions(-) diff --git a/Zotlabs/Module/Admin/Accounts.php b/Zotlabs/Module/Admin/Accounts.php index 9971fd213..0c0725bd2 100644 --- a/Zotlabs/Module/Admin/Accounts.php +++ b/Zotlabs/Module/Admin/Accounts.php @@ -218,10 +218,15 @@ class Accounts { $tao .= 'tao.zar.zarar = {'; foreach ($pending as $n => $v) { - $pending[$n]['status'] = t('Verified'); + $stuff = json_decode($v['reg_stuff'], true); + + if(isset($stuff['msg'])) { + $pending[$n]['msg'] = $stuff['msg']; + } if (array_key_exists($v['reg_atip'], $atipn)) { - $pending[$n]['reg_atip'] = $v['reg_atip'] . ' ◄' . $atipn[ $v['reg_atip'] ] . '×'; + $pending[$n]['reg_atip'] = $v['reg_atip']; + $pending[$n]['reg_atip_n'] = $atipn[$v['reg_atip']]; } // timezone adjust date_time for display @@ -293,8 +298,8 @@ class Accounts { '$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('Verification status'), t('Timeframe'), 'dId2', t('specified,atip') ), + '$h_pending' => t('Verified registrations waiting for approval'), + '$th_pending' => array(t('Request date'), 'dId2', t('Email'), 'IP', t('IP Count')), '$no_pending' => t('No verified registrations.'), '$approve' => t('Approve'), '$deny' => t('Deny'), diff --git a/Zotlabs/Module/Regate.php b/Zotlabs/Module/Regate.php index 99e20c719..372b65433 100644 --- a/Zotlabs/Module/Regate.php +++ b/Zotlabs/Module/Regate.php @@ -136,7 +136,6 @@ class Regate extends \Zotlabs\Web\Controller { ); if (($flags & ACCOUNT_PENDING ) == ACCOUNT_PENDING) { - $msg .= "\n".t('Last step will be by an instance admin to agree your account request'); $nextpage = 'regate/' . bin2hex($did2) . $didx; q("COMMIT"); } diff --git a/Zotlabs/Module/Register.php b/Zotlabs/Module/Register.php index 2c73f3d6d..1cbea663a 100644 --- a/Zotlabs/Module/Register.php +++ b/Zotlabs/Module/Register.php @@ -75,6 +75,8 @@ class Register extends Controller { $email = ((x($arr,'email')) ? notags(punify(trim($arr['email']))) : ''); $password = ((x($arr,'password')) ? trim($arr['password']) : ''); $password2 = ((x($arr,'password2')) ? trim($arr['password2']) : ''); + $register_msg = ((x($arr,'register_msg')) ? notags(trim($arr['register_msg'])) : ''); + $reonar = []; $auto_create = get_config('system','auto_channel_create', 1); @@ -182,7 +184,6 @@ class Register extends Controller { return; } - $policy = get_config('system','register_policy'); $invonly = get_config('system','invitation_only'); $invalso = get_config('system','invitation_also'); @@ -378,11 +379,15 @@ class Register extends Controller { } } - if ( $auto_create ) { + if ($auto_create) { $reonar['chan.name'] = $name; $reonar['chan.did1'] = $nick; } + if ($policy == REGISTER_APPROVE) { + $reonar['msg'] = $register_msg; + } + $reg = q("INSERT INTO register (" . "reg_flags,reg_didx,reg_did2,reg_hash,reg_created,reg_startup,reg_expires," . "reg_email,reg_pass,reg_lang,reg_atip,reg_stuff)" @@ -398,7 +403,7 @@ class Register extends Controller { dbesc($password), dbesc(substr(get_best_language(),0,2)), dbesc($ip), - dbesc(json_encode( $reonar )) + dbesc(json_encode($reonar)) ); if ($didx == 'a') { @@ -537,12 +542,15 @@ class Register extends Controller { $tos = array('tos', $label_tos, '', '', array(t('no'),t('yes'))); + $register_msg = ['register_msg', t('Why do you want to join this hub?')]; + require_once('include/bbcode.php'); $o = replace_macros(get_markup_template('register.tpl'), array( '$form_security_token' => get_form_security_token("register"), '$title' => t('Registration'), '$reg_is' => $registration_is, + '$register_msg' => $register_msg, '$registertext' => bbcode(get_config('system','register_text')), '$other_sites' => $other_sites, '$msg' => $opal['msg'], @@ -563,6 +571,7 @@ class Register extends Controller { '$pass1' => $password, '$pass2' => $password2, '$submit' => t('Register'), + )); return $o; diff --git a/include/account.php b/include/account.php index 939a4344e..991e799b5 100644 --- a/include/account.php +++ b/include/account.php @@ -1271,7 +1271,7 @@ function get_pending_accounts() { // better useability at the moment to tell all (ACCOUNT_PENDING >= 0) instead of (> 0 for those need approval) - $r = q("SELECT reg_did2, reg_created, reg_startup, reg_expires, reg_email, reg_atip, reg_hash, reg_id + $r = q("SELECT reg_did2, reg_created, reg_startup, reg_expires, reg_email, reg_atip, reg_hash, reg_id, reg_stuff FROM register WHERE reg_vital = 1 AND (reg_flags & %d) = 0 AND (reg_flags & %d) >= 0", intval(ACCOUNT_UNVERIFIED), intval(ACCOUNT_PENDING) diff --git a/view/tpl/admin_accounts.tpl b/view/tpl/admin_accounts.tpl index 9c78dbe54..70606010d 100644 --- a/view/tpl/admin_accounts.tpl +++ b/view/tpl/admin_accounts.tpl @@ -18,14 +18,11 @@ {{foreach $pending as $n => $u}} - {{$u.reg_created}}
{{$u.reg_n}} - - - {{$u.status}} - - {{$u.reg_startup}}
{{$u.reg_expires}} + {{$u.reg_created}} {{$u.reg_did2}} - {{$u.reg_email}}
{{$u.reg_atip}} + {{$u.reg_email}} + {{$u.reg_atip}} + {{$u.reg_atip_n}} @@ -33,6 +30,9 @@ + + {{$u.msg}} + {{/foreach}} @@ -43,8 +43,8 @@ *}}
{{$sel_tall}} - {{$sel_aprv}} - {{$sel_deny}} + {{$sel_aprv}} + {{$sel_deny}}
{{else}}

{{$no_pending}}

@@ -84,13 +84,13 @@ {{/foreach}} - +
{{$select_all}}
- {{* + {{*
{{$select_all}}
*}}
- +
{{else}} @@ -98,7 +98,7 @@ {{/if}} -{{* +{{* COMMENTS for this template: hilmar, 2020.01 script placed at the end @@ -119,17 +119,17 @@ tao.zar = { vsn: '2.0.0', c2s: {}, t: {} }; {{$tao}} $('#adminpage').on( 'click', '#zar2sat', function() { - $('input.pending_ckbx:checkbox').each( function() { this.checked = ! this.checked; }); + $('input.pending_ckbx:checkbox').each( function() { this.checked = ! this.checked; }); }); $('#adminpage').on( 'click', '.zar2xas', function() { tao.zar.c2s.x = $(this).attr('id').substr(4,1); - $('input.pending_ckbx:checkbox:checked').each( function() { - //if (this.checked) + $('input.pending_ckbx:checkbox:checked').each( function() { + //if (this.checked) // take the underscore with to prevent numeric 0 headdage tao.zar.c2s.n = $(this).attr('id').substr(10); $('#zarreax'+tao.zar.c2s.n).html(tao.zar.zarax); zarCSC(); - }); + }); }); $('.zar2s').click( function() { tao.zar.c2s.ix=$(this).attr('id'); @@ -142,12 +142,12 @@ function zarCSC() { $.ajax({ - type: 'POST', url: 'admin/accounts', + type: 'POST', url: 'admin/accounts', data: { zarat: tao.zar.c2s.n, zardo: tao.zar.c2s.x, zarse: tao.zar.zarar[(tao.zar.c2s.n).substr(1)], - form_security_token: $("input[name='form_security_token']").val() + form_security_token: $("input[name='form_security_token']").val() } }).done( function(r) { tao.zar.r = JSON.parse(r); diff --git a/view/tpl/register.tpl b/view/tpl/register.tpl index 03cead08f..3dba25706 100644 --- a/view/tpl/register.tpl +++ b/view/tpl/register.tpl @@ -43,23 +43,17 @@ {{include file="field_input.tpl" field=[$nickname.0,$nickname.1,"","","",$atform]}} {{/if}} - -
- {{include file="field_input.tpl" field=$email}} -
- {{include file="field_password.tpl" field=$pass1}} - {{include file="field_password.tpl" field=$pass2}} - - + {{if $reg_is}} + {{include file="field_textarea.tpl" field=$register_msg}} + {{/if}} {{if $enable_tos}} {{include file="field_checkbox.tpl" field=[$tos.0,$tos.1,"","","",$atform]}} {{else}} {{/if}} -
-- cgit v1.2.3