public function apipost() { $f3 = \Base::instance(); $this->_requireLogin(); $user = $f3->get('user'); $user_obj = $f3->get('user_obj'); $user_org = $f3->get('user_org'); $user_org_links = $f3->get('user_org_links'); $db = $f3->get('db.instance'); // Get organisation mapper $orgId = $f3->get('PARAMS.id'); if ($orgId == 'active') { $orgMap = \Helpers\User::getUserSelectedOrganisation(); } else { $orgMap = \Helpers\User::getUserSelectedOrganisation($orgId); } $f3->set('user_org_selected', $orgMap->cast()); if ($orgMap->ownerId != $user['id']) { $f3->set('target', 'dashboard/organisations/details/unauthorized.html'); } else { $key = $f3->get('POST.newKeyName'); $key = $f3->scrub($key); if (strlen($key) < 5) { $f3->set('error', 'The key name must be at least 5 characters long.'); $f3->set('target', 'dashboard/organisations/api.html'); } else { $keys = \Helpers\Api::createOrganisationKey($orgId, $key); $f3->set('publicKey', $keys['publicKey']); $f3->set('privateKey', $keys['privateKey']); $f3->set('target', 'account/api_showprivkey.html'); } } $this->_render('base.html'); }
public function apipost() { $f3 = \Base::instance(); $this->_requireLogin(); $user = $f3->get('user'); $user_obj = $f3->get('user_obj'); $user_org = $f3->get('user_org'); $user_org_links = $f3->get('user_org_links'); $db = $f3->get('db.instance'); $key = $f3->get('POST.newKeyName'); $key = $f3->scrub($key); if (strlen($key) < 4) { $f3->set('error', 'The key name must be at least 5 characters long.'); $f3->set('target', 'account/api.html'); } else { $keys = \Helpers\Api::createUserKey($user['id'], $key); $f3->set('publicKey', $keys['publicKey']); $f3->set('privateKey', $keys['privateKey']); $f3->set('target', 'account/api_showprivkey.html'); } $this->_render('base.html'); }