aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Module/Regate.php
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2021-04-28 13:17:45 +0200
committerMario <mario@mariovavti.com>2021-04-28 13:17:45 +0200
commit94f1c001f1fe2cefd17c5d535ec1fcd0e68c8df5 (patch)
tree74d98ca46111e066d9b42e06ff5416315a29f653 /Zotlabs/Module/Regate.php
parent531a03562dac2e8a5d0e3c76170e24c8e5d4b64b (diff)
downloadvolse-hubzilla-94f1c001f1fe2cefd17c5d535ec1fcd0e68c8df5.tar.gz
volse-hubzilla-94f1c001f1fe2cefd17c5d535ec1fcd0e68c8df5.tar.bz2
volse-hubzilla-94f1c001f1fe2cefd17c5d535ec1fcd0e68c8df5.zip
register: more testing and fixes
Diffstat (limited to 'Zotlabs/Module/Regate.php')
-rw-r--r--Zotlabs/Module/Regate.php59
1 files changed, 36 insertions, 23 deletions
diff --git a/Zotlabs/Module/Regate.php b/Zotlabs/Module/Regate.php
index 6c4aeec3e..155f818ef 100644
--- a/Zotlabs/Module/Regate.php
+++ b/Zotlabs/Module/Regate.php
@@ -151,41 +151,54 @@ class Regate extends \Zotlabs\Web\Controller {
zar_log('ZAR1238I ' . $msg . ' ' . $cra['account']['account_email']
. ' ' . $cra['account']['account_language']);
+ authenticate_success($cra['account'],null,true,false,true);
+
$nextpage = 'new_channel';
- $auto_create = get_config('system','auto_channel_create',1);
+ $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']);
- if($reonar['chan.did1'])
- set_aconfig($cra['account']['account_id'], 'register', 'channel_address', $reonar['chan.did1']);
+ $new_channel = ['success' => false];
- $permissions_role = get_config('system','default_permissions_role');
- if($permissions_role)
- set_aconfig($cra['account']['account_id'], 'register', 'permissions_role', $permissions_role);
- }
+ // We do not reserve a channel_address before the registration is verified
+ // and possibly approved by the admin.
+ // If the provided channel_address has been claimed meanwhile,
+ // we will proceed to /new_channel.
- authenticate_success($cra['account'],null,true,false,true);
+ if(isset($reonar['chan.did1']) && check_webbie([$reonar['chan.did1']])) {
- if($auto_create) {
- // create channel
- $new_channel = auto_channel_create($cra['account']['account_id']);
-
- if($new_channel['success']) {
- $channel_id = $new_channel['channel']['channel_id'];
- change_channel($channel_id);
- $nextpage = 'profiles/' . $channel_id;
- $msg_code = 'ZAR1239I';
- $msg = t('Channel successfull created') . ' ' . $did2;
+ // prepare channel creation
+ if($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']);
+
+ $permissions_role = get_config('system','default_permissions_role');
+ if($permissions_role)
+ set_aconfig($cra['account']['account_id'], 'register', 'permissions_role', $permissions_role);
+
+ // create channel
+ $new_channel = auto_channel_create($cra['account']['account_id']);
+
+ if($new_channel['success']) {
+ $channel_id = $new_channel['channel']['channel_id'];
+ change_channel($channel_id);
+ $nextpage = 'profiles/' . $channel_id;
+ $msg_code = 'ZAR1239I';
+ $msg = t('Channel successfull created') . ' ' . $did2;
+ }
}
- else {
+
+ if(!$new_channel['success']) {
$msg_code = 'ZAR1239E';
- $msg = t('Channel still not created') . ' ' . $did2;
+ $msg = t('Automatic channel creation failed. Please create a channel.') . ' ' . $did2;
+ $nextpage = 'new_channel?name=' . $reonar['chan.name'];
}
+
zar_log($msg_code . ' ' . $msg . ' ' . $reonar['chan.did1'] . ' (' . $reonar['chan.name'] . ')');
+
}
unset($_SESSION['login_return_url']);
}