WIP: Road to 1.0.0 #1

Draft
miguel456 wants to merge 123 commits from develop into master
3 changed files with 60 additions and 29 deletions
Showing only changes of commit 5cf6b2b241 - Show all commits

View File

@ -46,7 +46,8 @@ class OptionsController extends Controller
'pwExpiry' => Options::getOption('password_expiry'),
'requiresPMC' => Options::getOption('requireGameLicense'),
'enforce2fa' => Options::getOption('force2fa')
]
],
'currentGame' => Options::getOption('currentGame')
]);
}
@ -89,4 +90,26 @@ class OptionsController extends Controller
return redirect()->back();
}
public function saveGameIntegration(Request $request)
{
$supportedGames = [
'RUST',
'MINECRAFT',
'SE',
'GMOD'
];
if (!is_null($request->gamePref) && in_array($request->gamePref, $supportedGames))
{
Options::changeOption('currentGame', $request->gamePref);
$request->session()->flash('success', 'Updated current game.');
return redirect()->back();
}
$request->session()->flash('error', 'Unsupported game ' . $request->gamePref . '.');
return redirect()->back();
}
}

View File

@ -208,18 +208,21 @@
<div class="card-body">
<form method="POST" id="gamePrefForm" action={{ route('saveGameIntegration') }}>
@csrf
@method('PATCH')
<div class="form-group mb-3">
<div class="row">
<div class="col">
<label>
<input type="radio" name="gamePref" value="MINECRAFT">
<input type="radio" name="gamePref" value="MINECRAFT" {{ ($currentGame == 'MINECRAFT') ? 'checked' : '' }}>
<img alt="Mojang Logo (Minecraft)" height="150px" width="150px" src="/img/mc.jpg">
</label>
</div>
<div class="col">
<label>
<input type="radio" name="gamePref" value="RUST">
<input type="radio" name="gamePref" value="RUST" {{ ($currentGame == 'RUST') ? 'checked' : '' }}>
<img alt="Rust Logo" height="150px" width="150px" src="/img/rust.png">
</label>
</div>
@ -227,24 +230,26 @@
<div class="col">
<label>
<input type="radio" name="gamePref" value="GMOD">
<input type="radio" name="gamePref" value="GMOD" {{ ($currentGame == 'GMOD') ? 'checked' : '' }}>
<img alt="Gmod Logo" height="150px" width="150px" src="/img/gmod.png">
</label>
</div>
<div class="col">
<label>
<input type="radio" name="gamePref" value="SE">
<input type="radio" name="gamePref" value="SE" {{ ($currentGame == 'SE') ? 'checked' : '' }}>
<img alt="Gmod Logo" height="150px" width="150px" src="/img/se.png">
</label>
</div>
</div>
</div>
</form>
</div>
<div class="card-footer">
<button type="button" class="btn btn-success"><i class="fas fa-save"></i> Save Changes</button>
<button onclick="$('#gamePrefForm').submit()" type="button" class="btn btn-success"><i class="fas fa-save"></i> Save Changes</button>
</div>
</div>
</div>

View File

@ -209,6 +209,9 @@ Route::group(['prefix' => LaravelLocalization::setLocale(), 'middleware' => ['lo
Route::post('settings/security/save', [SecuritySettingsController::class, 'save'])
->name('saveSecuritySettings');
Route::patch('settings/game/update', [OptionsController::class, 'saveGameIntegration'])
->name('saveGameIntegration');
Route::post('players/ban/{user}', [BanController::class, 'insert'])
->name('banUser');