Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Group setting inputs, so we don't save the CSRF token in settings #30

Merged
merged 1 commit into from
Nov 25, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions app/controllers/SetupController.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ public function showSetup() {
public function setupCachet() {
$postData = Input::get();
$v = Validator::make($postData, [
'app_name' => 'required',
'app_domain' => 'url|required',
'show_support' => 'boolean',
'settings.app_name' => 'required',
'settings.app_domain' => 'url|required',
'settings.show_support' => 'boolean',
'user.name'=> 'alpha_dash|required',
'user.email' => 'email|required',
'user.password' => 'required'
Expand All @@ -32,7 +32,7 @@ public function setupCachet() {
Auth::login($user);

// Create the settings, boi.
foreach ($postData as $settingName => $settingValue) {
foreach (array_get($postData, 'settings') as $settingName => $settingValue) {
$setting = new Setting;
$setting->name = $settingName;
$setting->value = $settingValue;
Expand Down
21 changes: 10 additions & 11 deletions app/views/setup.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,27 +11,27 @@
<div class='panel panel-default'>
<div class='panel-heading'>Service Details</div>
<div class='panel-body'>
<form name='SetupForm' class='form-vertical' role='form' method="POST">
{{ Form::open(['name' => 'SetupForm', 'class' => 'form-vertical', 'role' => 'form']) }}
<h3>Status Page Details</h3>
<div class='form-group'>
<label class='sr-only'>Site Name</label>
<input type='text' name='app_name' class='form-control' placeholder='Site Name' value='{{ Input::old('app_name', '') }}' required />
@if($errors->has('app_name'))
<span class='text-danger'>{{ $errors->first('app_name') }}</span>
<input type='text' name='settings[app_name]' class='form-control' placeholder='Site Name' value='{{ Input::old('settings.app_name', '') }}' required />
@if($errors->has('settings.app_name'))
<span class='text-danger'>{{ $errors->first('settings.app_name') }}</span>
@endif
</div>
<div class='form-group'>
<label class='sr-only'>Site Domain</label>
<input type='text' name='app_domain' class='form-control' placeholder='Site Domain' value='{{ Input::old('app_domain', '') }}' required />
@if($errors->has('app_domain'))
<span class='text-danger'>{{ $errors->first('app_domain') }}</span>
<input type='text' name='settings[app_domain]' class='form-control' placeholder='Site Domain' value='{{ Input::old('settings.app_domain', '') }}' required />
@if($errors->has('settings.app_domain'))
<span class='text-danger'>{{ $errors->first('settings.app_domain') }}</span>
@endif
</div>
<div class='form-group'>
<label>
<input type='checkbox' name='show_support' value='1' checked />
<input type='checkbox' name='settings[show_support]' value='1' checked />
Show support for Cachet?
</label>
Show support for Cachet?
</div>

<h3>Administrator Account</h3>
Expand Down Expand Up @@ -61,8 +61,7 @@
<div class='form-group'>
<button type='submit' class='btn btn-default'>Setup!</button>
</div>
{{ Form::token() }}
</form>
{{ Form::close() }}
</div>
</div>
</div>
Expand Down