Skip to content

Commit

Permalink
Edit option default for anon/auto API key generation; this does not b…
Browse files Browse the repository at this point in the history
…reak old configs
  • Loading branch information
cydrobolt committed May 13, 2016
1 parent ff1f726 commit 3dc4285
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
3 changes: 1 addition & 2 deletions app/Http/Controllers/Api/ApiController.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,8 @@ protected static function getApiUserInfo(Request $request) {

if (!$api_key) {
// no API key provided -- check whether anonymous API is on
// TODO: throttle requests from anonymous API

if (env('SETTING_ANON_API') == 'on') {
if (env('SETTING_ANON_API')) {
$username = 'ANONIP-' . $request->ip();
}
else {
Expand Down
3 changes: 2 additions & 1 deletion app/Http/Controllers/UserController.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,8 @@ public function performSignup(Request $request) {

$api_active = false;
$api_key = null;
if (env('SETTING_AUTO_API') == 'on') {

if (env('SETTING_AUTO_API')) {
// if automatic API key assignment is on
$api_active = 1;
$api_key = CryptoHelper::generateRandomHex(env('_API_KEY_LENGTH'));
Expand Down
8 changes: 4 additions & 4 deletions resources/views/setup.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,14 +113,14 @@

<p>Anonymous API:</p>
<select name='setting:anon_api' class='form-control'>
<option selected value='off'>Off -- only registered users can use API</option>
<option value='on'>On -- empty key API requests are allowed</option>
<option selected value='false'>Off -- only registered users can use API</option>
<option value='true'>On -- empty key API requests are allowed</option>
</select>

<p>Automatic API Assignment:</p>
<select name='setting:auto_api_key' class='form-control'>
<option selected value='off'>Off -- admins must manually enable API for each user</option>
<option value='on'>On -- each user receives an API key</option>
<option selected value='false'>Off -- admins must manually enable API for each user</option>
<option value='true'>On -- each user receives an API key</option>
</select>

<h4>Other Settings</h4>
Expand Down

0 comments on commit 3dc4285

Please sign in to comment.