aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs
diff options
context:
space:
mode:
authorMax Kostikov <max@kostikov.co>2021-04-08 14:19:29 +0000
committerMax Kostikov <max@kostikov.co>2021-04-08 14:19:29 +0000
commitb5620cb79443fcbf1820341bce05fadbb0b124be (patch)
treef9842fdf61038c023bd6088576f40f893850256c /Zotlabs
parent0d10f5ba65d209c76f811424eb255d9e4228c6b8 (diff)
parentcf62e07bec8ffe6b9e5c92d56c13ee3cbe06b5bf (diff)
downloadvolse-hubzilla-b5620cb79443fcbf1820341bce05fadbb0b124be.tar.gz
volse-hubzilla-b5620cb79443fcbf1820341bce05fadbb0b124be.tar.bz2
volse-hubzilla-b5620cb79443fcbf1820341bce05fadbb0b124be.zip
Merge branch 'dev' into 'dev'
Dev sync See merge request kostikov/core!1
Diffstat (limited to 'Zotlabs')
-rw-r--r--Zotlabs/Module/Admin/Accounts.php38
-rw-r--r--Zotlabs/Module/Admin/Site.php12
-rw-r--r--Zotlabs/Module/Cloud.php3
-rw-r--r--Zotlabs/Module/Regate.php14
-rw-r--r--Zotlabs/Module/Register.php65
5 files changed, 79 insertions, 53 deletions
diff --git a/Zotlabs/Module/Admin/Accounts.php b/Zotlabs/Module/Admin/Accounts.php
index 856ff9155..ac46c43aa 100644
--- a/Zotlabs/Module/Admin/Accounts.php
+++ b/Zotlabs/Module/Admin/Accounts.php
@@ -70,18 +70,44 @@ class Accounts {
intval($_SESSION[self::MYP]['i'][$zarat])
);
if ($rs && ($rs[0]['reg_flags'] & ~ 48) == 0) {
-
// create account
- $rc='ok'.$rs[0]['reg_id'];
+ $rc = 'ok'.$rs[0]['reg_id'];
$ac = create_account_from_register($rs[0]);
- if ( $ac['success'] ) $rc .= '✔';
+ if ( $ac['success'] ) {
+ $rc .= '✔';
+
+ $auto_create = get_config('system','auto_channel_create',1);
+
+ if($auto_create) {
+ $reonar = json_decode($rs[0]['reg_stuff'], true);
+ // prepare channel creation
+ if($reonar['chan.name'])
+ set_aconfig($ac['account']['account_id'], 'register', 'channel_name', $reonar['chan.name']);
+
+ if($reonar['chan.did1'])
+ set_aconfig($ac['account']['account_id'], 'register', 'channel_address', $reonar['chan.did1']);
+
+ $permissions_role = get_config('system','default_permissions_role');
+ if($permissions_role)
+ set_aconfig($ac['account']['account_id'], 'register', 'permissions_role', $permissions_role);
+ // create channel
+ $new_channel = auto_channel_create($ac['account']['account_id']);
+
+ if($new_channel['success']) {
+ $rc .= ' c,ok' . $new_channel['channel']['channel_id'] . '✔';
+ }
+ else {
+ $rc .= ' c ×';
+ }
+ }
+
+
+ }
} else {
- $rc='oh×';
+ $rc='oh ×';
}
}
-
- //
echo json_encode(array('re' => $zarop, 'at' => '_' . $zarat, 'rc' => $rc));
}
killme();
diff --git a/Zotlabs/Module/Admin/Site.php b/Zotlabs/Module/Admin/Site.php
index bf47f8c62..73c24897f 100644
--- a/Zotlabs/Module/Admin/Site.php
+++ b/Zotlabs/Module/Admin/Site.php
@@ -491,7 +491,7 @@ class Site {
'$reg_expire'=>$reg_expire,
'$reg_autochannel' => array('auto_channel_create',
t("Auto channel create"),
- get_config('system','auto_channel_create'),
+ get_config('system','auto_channel_create', 1),
t("Auto create a channel when register a new account. When On, the register form will show additional fields for the channel-name and the nickname."),
"", "", 'ZAR0870C'),
@@ -512,11 +512,11 @@ class Site {
get_config('system','verify_email'),
t("Check to verify email addresses used in account registration (recommended)."),
"", "", 'ZAR0890C'),
- '$abandon_days' => array('abandon_days',
+ '$abandon_days' => array('abandon_days',
t('Accounts abandoned after x days'),
get_config('system','account_abandon_days'),
- t('Will not waste system resources polling external sites for abandonded accounts. Enter 0 for no time limit.'),
- 'appears not to be implemented (2010.01)'),
+ t('Will not waste system resources polling external sites for abandonded accounts. Enter 0 for no time limit.')
+ ),
// <-hilmar]
'$role' => $role,
@@ -553,13 +553,9 @@ class Site {
'$maxloadavg' => array('maxloadavg', t("Maximum Load Average"), ((intval(get_config('system','maxloadavg')) > 0)?get_config('system','maxloadavg'):50), t("Maximum system load before delivery and poll processes are deferred - default 50.")),
'$default_expire_days' => array('default_expire_days', t('Expiration period in days for imported (grid/network) content'), intval(get_config('system','default_expire_days')), t('0 for no expiration of imported content')),
'$active_expire_days' => array('active_expire_days', t('Do not expire any posts which have comments less than this many days ago'), intval(get_config('system','active_expire_days',7)), ''),
-
'$sellpage' => array('site_sellpage', t('Public servers: Optional landing (marketing) webpage for new registrants'), get_config('system','sellpage',''), sprintf( t('Create this page first. Default is %s/register'),z_root())),
'$first_page' => array('first_page', t('Page to display after creating a new channel'), get_config('system','workflow_channel_next','profiles'), t('Default: profiles')),
-
'$location' => array('site_location', t('Optional: site location'), get_config('system','site_location',''), t('Region or country')),
-
-
'$form_security_token' => get_form_security_token("admin_site"),
));
}
diff --git a/Zotlabs/Module/Cloud.php b/Zotlabs/Module/Cloud.php
index 3d1b97980..6ff95b5cf 100644
--- a/Zotlabs/Module/Cloud.php
+++ b/Zotlabs/Module/Cloud.php
@@ -123,7 +123,8 @@ class Cloud extends Controller {
notice( t('Permission denied') . EOL);
}
elseif($err instanceof \Sabre\DAV\Exception\NotImplemented) {
- notice( t('Please refresh page') . EOL);
+ // notice( t('Please refresh page') . EOL);
+ goaway(z_root() . '/' . \App::$query_string);
}
else {
notice( t('Unknown error') . EOL);
diff --git a/Zotlabs/Module/Regate.php b/Zotlabs/Module/Regate.php
index d51927de1..6d9d5dc28 100644
--- a/Zotlabs/Module/Regate.php
+++ b/Zotlabs/Module/Regate.php
@@ -139,18 +139,22 @@ class Regate extends \Zotlabs\Web\Controller {
// zar_log($msg . ':' . print_r($cra, true));
zar_log($msg . ' ' . $cra['account']['account_email']
. ' ' . $cra['account']['account_language']);
+
$nextpage = 'new_channel';
- $auto_create = (get_config('system','auto_channel_create') ? true : false);
+ $auto_create = get_config('system','auto_channel_create',1);
if($auto_create) {
// prepare channel creation
if($reonar['chan.name'])
- set_aconfig($cra['account']['account_id'],
- 'register','channel_name',$reonar['chan.name']);
+ set_aconfig($cra['account']['account_id'], 'register', 'channel_name', $reonar['chan.name']);
+
if($reonar['chan.did1'])
- set_aconfig($cra['account']['account_id'],
- 'register','channel_address',$reonar['chan.did1']);
+ set_aconfig($cra['account']['account_id'], 'register', 'channel_address', $reonar['chan.did1']);
+
+ $permissions_role = get_config('system','default_permissions_role');
+ if($permissions_role)
+ set_aconfig($cra['account']['account_id'], 'register', 'permissions_role', $permissions_role);
}
authenticate_success($cra['account'],null,true,false,true);
diff --git a/Zotlabs/Module/Register.php b/Zotlabs/Module/Register.php
index 95d9da3b7..d076d9ccf 100644
--- a/Zotlabs/Module/Register.php
+++ b/Zotlabs/Module/Register.php
@@ -171,11 +171,10 @@ class Register extends Controller {
}
- $policy = intval(get_config('system','register_policy'));
- $invonly = intval(get_config('system','invitation_only'));
- $invalso = intval(get_config('system','invitation_also'));
- $auto_create = (get_config('system','auto_channel_create') ? true : false);
- $auto_create = true;
+ $policy = get_config('system','register_policy');
+ $invonly = get_config('system','invitation_only');
+ $invalso = get_config('system','invitation_also');
+ $auto_create = get_config('system','auto_channel_create', 1);
switch($policy) {
@@ -244,8 +243,8 @@ class Register extends Controller {
intval($reg['reg_id'])
);
- $msg = 'ZAR0237I ' . t('Invitation code succesfully applied');
- zar_log($msg) . ', ' . $email;
+ $msg = t('Invitation code succesfully applied');
+ zar_log('ZAR0237I ' . $msg) . ', ' . $email;
// msg!
info($msg . EOL);
@@ -261,29 +260,29 @@ class Register extends Controller {
} else {
// msg!
- notice('ZAR0236E ' . t('Invitation not in time or too late') . EOL);
- goaway(z_root() . '/~');
+ notice(t('Invitation not in time or too late') . EOL);
+ return;
}
} else {
// no match email adr
- $msg = 'ZAR0235S ' . t('Invitation email failed');
- zar_log($msg);
+ $msg = t('Invitation email failed');
+ zar_log('ZAR0235S ' . $msg);
notice($msg . EOL);
- goaway(z_root() . '/~');
+ return;
}
} else {
// no match invitecode
- $msg = 'ZAR0234S ' . t('Invitation code failed') ;
- zar_log($msg);
+ $msg = t('Invitation code failed') ;
+ zar_log('ZAR0234S ' . $msg);
notice( $msg . EOL);
- goaway(z_root() . '/~');
+ return;
}
} else {
- notice('ZAR0232E ' . t('Invitations are not available') . EOL);
- goaway(z_root() . '/~');
+ notice(t('Invitations are not available') . EOL);
+ return;
}
@@ -309,20 +308,20 @@ class Register extends Controller {
} else {
- $msg = 'ZAR0237E ' . t('Email address already in use') . EOL;
+ $msg = t('Email address already in use') . EOL;
notice($msg);
// problem, the msg tells to anonymous about existant email addrs
// use another msg instead ? TODO ?
// on the other hand can play the fail2ban game
- zar_log($msg . ' (' . $email . ')');
- goaway(z_root());
+ zar_log('ZAR0237E ' . $msg . ' (' . $email . ')');
+ return;
}
} else {
- $msg = 'ZAR0233E ' . t('Registration on this hub is by invitation only') . EOL;
+ $msg = t('Registration on this hub is by invitation only') . EOL;
notice($msg);
- zar_log($msg);
- goaway(z_root());
+ zar_log('ZAR0233E ' . $msg);
+ return;
}
}
@@ -442,9 +441,9 @@ class Register extends Controller {
goaway(z_root() . '/regate/' . bin2hex('d' . $didnew) . 'a' );
}
else {
- $msg = 'ZAR0239D,' . t('Error creating dId A');
+ $msg = t('Error creating dId A');
notice( $msg );
- zar_log( $msg . ' ' . $did2);
+ zar_log( 'ZAR0239D,' . $msg . ' ' . $did2);
}
}
goaway(z_root() . '/regate/' . bin2hex($email) . $didx );
@@ -461,7 +460,7 @@ class Register extends Controller {
if(intval(get_config('system','register_policy')) === REGISTER_CLOSED) {
if(intval(get_config('system','directory_mode')) === DIRECTORY_MODE_STANDALONE) {
- notice( 'ZAR0130E ' . t('Registration on this hub is disabled.') . EOL);
+ notice(t('Registration on this hub is disabled.') . EOL);
return;
}
@@ -521,7 +520,7 @@ class Register extends Controller {
$enable_tos = 1 - intval(get_config('system','no_termsofservice'));
- $auto_create = (get_config('system','auto_channel_create') ? true : false);
+ $auto_create = get_config('system', 'auto_channel_create', 1);
$default_role = get_config('system','default_permissions_role');
$email_verify = get_config('system','verify_email');
@@ -540,7 +539,7 @@ class Register extends Controller {
$invite_code = array('invite_code', t('Please enter your invitation code'), ((x($_REQUEST,'invite_code')) ? strip_tags(trim($_REQUEST['invite_code'])) : ""));
//
- $name = array('name', t('Your Name'),
+ $name = array('name', t('Your name'),
((x($_REQUEST,'name')) ? $_REQUEST['name'] : ''), t('Real names are preferred.'));
$nickhub = '@' . str_replace(array('http://','https://','/'), '', get_config('system','baseurl'));
$nickname = array('nickname', t('Choose a short nickname'),
@@ -565,7 +564,7 @@ class Register extends Controller {
'$tao' => "typeof(window.tao) == 'undefined' ? window.tao = {} : '';\n"
. "tao.zar = { vsn: '2.0.0', form: {}, msg: {} };\n"
. "tao.zar.patano = /^d[0-9]{5,10}$/;\n"
- . "tao.zar.patema = /^[a-z0-9.-]{2,64}@[a-z0-9.-]{4,32}\.[a-z]{2,12}$/;\n"
+ . "tao.zar.patema = /^[a-z0-9.-]{1,64}@[a-z0-9.-]{2,32}\.[a-z]{2,12}$/;\n"
. "tao.zar.msg.ZAR0239E = '" . t('Email address not valid') . "';\n",
'$form_security_token' => get_form_security_token("register"),
@@ -573,7 +572,7 @@ class Register extends Controller {
'$reg_is' => $registration_is,
'$registertext' => bbcode(get_config('system','register_text')),
'$other_sites' => $other_sites,
- '$msg' => $opal['rn'] . ',' . $opal['an'],
+ '$msg' => $opal['msg'],
'$invitations' => $invitations,
'$invite_code' => $invite_code,
'$haveivc' => t('I have an invite code'),
@@ -593,7 +592,7 @@ class Register extends Controller {
'$pass1' => $password,
'$pass2' => $password2,
'$submit' => t('Register'),
- '$verify_note' => (($email_verify) ? t('This site requires verification. After completing this form, please check the notice or your email for further instructions.') : '')
+ //'$verify_note' => (($email_verify) ? t('This site requires verification. After completing this form, please check the notice or your email for further instructions.') : '')
));
return $o;
@@ -624,8 +623,8 @@ class Register extends Controller {
}
if ( $rear['is']) {
- $rear['msg'] = 'ZAR0333W ' . t('This site has exceeded the number of allowed daily account registrations');
- zar_log($msg);
+ $rear['msg'] = t('This site has exceeded the number of allowed daily account registrations.');
+ zar_log('ZAR0333W ' . $rear['msg']);
$rear['is'] = true;
}
}