aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2021-04-14 19:40:51 +0000
committerMario <mario@mariovavti.com>2021-04-14 19:40:51 +0000
commite35ab97b7ecbd96e11883bc194bfe9fb5a72e7f2 (patch)
tree08e00e224e345feee95bb0a3f668aa5a4d1ef580
parentf9793e870f5c3c531fe48a2294782de0643a6c9b (diff)
downloadvolse-hubzilla-e35ab97b7ecbd96e11883bc194bfe9fb5a72e7f2.tar.gz
volse-hubzilla-e35ab97b7ecbd96e11883bc194bfe9fb5a72e7f2.tar.bz2
volse-hubzilla-e35ab97b7ecbd96e11883bc194bfe9fb5a72e7f2.zip
register: provide a possibility to leave a message id registration is by approval
-rw-r--r--Zotlabs/Module/Admin/Accounts.php13
-rw-r--r--Zotlabs/Module/Regate.php1
-rw-r--r--Zotlabs/Module/Register.php15
-rw-r--r--include/account.php2
-rw-r--r--view/tpl/admin_accounts.tpl38
-rw-r--r--view/tpl/register.tpl12
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 @@
<tbody>
{{foreach $pending as $n => $u}}
<tr class="zebra zebra{{$u.reg_z}}">
- <td class="created">{{$u.reg_created}}<br>{{$u.reg_n}}
- </td>
-
- <td class="status">{{$u.status}}</td>
-
- <td class="created">{{$u.reg_startup}}<br>{{$u.reg_expires}}</td>
+ <td class="created">{{$u.reg_created}}</td>
<td class="email">{{$u.reg_did2}}</td>
- <td class="email">{{$u.reg_email}}<br>{{$u.reg_atip}}</td>
+ <td class="email">{{$u.reg_email}}</td>
+ <td class="email">{{$u.reg_atip}}</td>
+ <td class="">{{$u.reg_atip_n}}</td>
<td class="checkbox_bulkedit"><input type="checkbox" class="pending_ckbx" id="id_pending_{{$n}}" name="pending[]" value="{{$n}}"></td>
<td class="tools">
<a id="zara_{{$n}}" {{* href="{{$baseurl}}/regmod/allow/{{$n}}" *}} class="zar2s zara btn btn-default btn-xs" title="{{$approve}}"><i class="fa fa-thumbs-o-up admin-icons"></i></a>
@@ -33,6 +30,9 @@
<span id="zarreax_{{$n}}" class="zarreax"></span>
</td>
</tr>
+ <tr>
+ <td colspan="7">{{$u.msg}}</td>
+ </tr>
{{/foreach}}
</tbody>
</table>
@@ -43,8 +43,8 @@
*}}
<div class="selectall">
<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>
+ <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>
{{else}}
<p>{{$no_pending}}</p>
@@ -84,13 +84,13 @@
{{/foreach}}
</tbody>
</table>
-
+
<div class="selectall"><a id="zarckbxtoggle" href="javascript:;">{{$select_all}}</a></div>
- {{*
+ {{*
<div class="selectall"><a href="#" onclick="return toggle_selectall('users_ckbx');">{{$select_all}}</a></div>
*}}
<div class="submit">
- <input type="submit" name="page_accounts_block" class="btn btn-primary" value="{{$block}}/{{$unblock}}" />
+ <input type="submit" name="page_accounts_block" class="btn btn-primary" value="{{$block}}/{{$unblock}}" />
<input type="submit" name="page_accounts_delete" class="btn btn-primary" onclick="return confirm_delete_multi()" value="{{$delete}}" />
</div>
{{else}}
@@ -98,7 +98,7 @@
{{/if}}
</form>
</div>
-{{*
+{{*
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]}}
</div>
{{/if}}
-
- <div>
-
{{include file="field_input.tpl" field=$email}}
- </div>
-
{{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}}
<input type="hidden" name="tos" value="1" />
{{/if}}
-
<button class="btn btn-primary" type="submit" name="submit" id="newchannel-submit-button" value="{{$submit}}" {{$atform}}>{{$submit}}</button>
<div id="register-submit-end" class="register-field-end"></div>
</form>