Merge pull request #14 from CachetHQ/2.4

Update from upstream repo CachetHQ/Cachet
This commit is contained in:
Davide Bellini 2016-10-09 12:13:16 +02:00 committed by GitHub
commit a9f06ae899
24 changed files with 177 additions and 124 deletions

View File

@ -85,5 +85,6 @@ class AppComposer
$view->withSiteTitle($this->config->get('setting.app_name'));
$view->withFontSubset($this->config->get('langs.'.$this->config->get('app.locale').'.subset', 'latin'));
$view->withOnlyDisruptedDays($this->config->get('setting.only_disrupted_days'));
$view->withDashboardLink($this->config->get('setting.dashboard_login_link'));
}
}

View File

@ -19,7 +19,6 @@ use GrahamCampbell\Binput\Facades\Binput;
use Illuminate\Routing\Controller;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Redirect;
use Illuminate\Support\Facades\Request;
use Illuminate\Support\Facades\Session;
use Illuminate\Support\Facades\View;
use PragmaRX\Google2FA\Vendor\Laravel\Facade as Google2FA;
@ -44,26 +43,25 @@ class AuthController extends Controller
*/
public function postLogin()
{
$loginData = Binput::only(['username', 'password']);
$loginData = Binput::only(['username', 'password', 'remember_me']);
// Login with username or email.
$loginKey = filter_var($loginData['username'], FILTER_VALIDATE_EMAIL) ? 'email' : 'username';
$loginData[$loginKey] = array_pull($loginData, 'username');
$rememberUser = array_pull($loginData, 'remember_me') === '1';
// Validate login credentials.
if (Auth::validate($loginData)) {
// Log the user in for one request.
Auth::once($loginData);
// Do we have Two Factor Auth enabled?
if (Auth::user()->hasTwoFactor) {
// Temporarily store the user.
Session::put('2fa_id', Auth::user()->id);
return Redirect::route('auth.two-factor');
}
// We probably want to add support for "Remember me" here.
Auth::attempt($loginData);
Auth::attempt($loginData, $rememberUser);
event(new UserLoggedInEvent(Auth::user()));

View File

@ -64,6 +64,20 @@ class SetupController extends Controller
'log' => 'Log (Testing)',
];
/**
* Array of queue drivers.
*
* @var string[]
*/
protected $queueDrivers = [
'null' => 'None',
'sync' => 'Synchronous',
'database' => 'Database',
'beanstalkd' => 'Beanstalk',
'sqs' => 'Amazon SQS',
'redis' => 'Redis',
];
/**
* Array of step1 rules.
*
@ -95,6 +109,7 @@ class SetupController extends Controller
$this->rulesStep1 = [
'env.cache_driver' => 'required|in:'.implode(',', array_keys($this->cacheDrivers)),
'env.session_driver' => 'required|in:'.implode(',', array_keys($this->cacheDrivers)),
'env.queue_driver' => 'required|in:'.implode(',', array_keys($this->queueDrivers)),
'env.mail_driver' => 'required|in:'.implode(',', array_keys($this->mailDrivers)),
];
@ -132,12 +147,38 @@ class SetupController extends Controller
}
}
// Since .env may already be configured, we should show that data!
$cacheConfig = [
'driver' => Config::get('cache.default'),
];
$sessionConfig = [
'driver' => Config::get('session.driver'),
];
$queueConfig = [
'driver' => Config::get('queue.default'),
];
$mailConfig = [
'driver' => Config::get('mail.driver'),
'host' => Config::get('mail.host'),
'from' => Config::get('mail.from'),
'username' => Config::get('mail.username'),
'password' => Config::get('mail.password'),
];
return View::make('setup.index')
->withPageTitle(trans('setup.setup'))
->withCacheDrivers($this->cacheDrivers)
->withQueueDrivers($this->queueDrivers)
->withMailDrivers($this->mailDrivers)
->withUserLanguage($userLanguage)
->withAppUrl(Request::root());
->withAppUrl(Request::root())
->withCacheConfig($cacheConfig)
->withSessionConfig($sessionConfig)
->withQueueConfig($queueConfig)
->withMailConfig($mailConfig);
}
/**

View File

@ -29,13 +29,13 @@ class FeedRoutes
*/
public function map(Registrar $router)
{
$router->group(['middleware' => ['web', 'ready']], function (Registrar $router) {
$router->group(['middleware' => ['web', 'ready'], 'as' => 'feed.'], function (Registrar $router) {
$router->get('/atom/{component_group?}', [
'as' => 'feed.atom',
'as' => 'atom',
'uses' => 'FeedController@atomAction',
]);
$router->get('/rss/{component_group?}', [
'as' => 'feed.rss',
'as' => 'rss',
'uses' => 'FeedController@rssAction',
]);
});

View File

@ -22,6 +22,7 @@ return [
'site_locale' => 'Select your language',
'enable_google2fa' => 'Enable Google Two Factor Authentication',
'cache_driver' => 'Cache Driver',
'queue_driver' => 'Queue Driver',
'session_driver' => 'Session Driver',
'mail_driver' => 'Mail Driver',
'mail_host' => 'Mail Host',
@ -40,6 +41,7 @@ return [
'invalid-token' => 'Invalid token',
'cookies' => 'You must enable cookies to login.',
'rate-limit' => 'Rate limit exceeded.',
'remember_me' => 'Remember me',
],
// Incidents form fields

View File

@ -27,6 +27,12 @@
<label class="sr-only">{{ trans('forms.login.password') }}</label>
<input autocomplete="off" class="form-control login-input" placeholder="{{ trans('forms.login.password') }}" required="required" name="password" type="password" value="">
</div>
<div class="checkbox">
<input type="hidden" name="remember_me" value="0">
<label>
<input name="remember_me" type="checkbox" value="1"> {{ trans('forms.login.remember_me') }}
</label>
</div>
<div class="form-group">
<div class="row">
<div class="col-xs-2">

File diff suppressed because one or more lines are too long

View File

@ -66,7 +66,7 @@
</fieldset>
<input type="hidden" name="component[user_id]" value="{{ $component->agent_id || $current_user->id }}">
<input type="hidden" name="component[order]" value="{{ $component->order or 0 }}">
<input type="hidden" name="component[order]" value="{{ $component->order || 0 }}">
<div class="btn-group">
<button type="submit" class="btn btn-success">{{ trans('forms.save') }}</button>

View File

@ -65,8 +65,8 @@
<div class="form-group">
<label for="incident-name">{{ trans('forms.incidents.stick_status') }}</label>
<select name="stickied" class="form-control">
<option value='1'>{{ trans('forms.incidents.stickied') }}</option>
<option value='0' selected>{{ trans('forms.incidents.not_stickied') }}</option>
<option value="1">{{ trans('forms.incidents.stickied') }}</option>
<option value="0" selected>{{ trans('forms.incidents.not_stickied') }}</option>
</select>
</div>
@if(!$components_in_groups->isEmpty() || !$components_out_groups->isEmpty())

View File

@ -49,7 +49,7 @@
</div>
</fieldset>
<input type="hidden" name="incident_id" value={{ $incident->id }}>
<input type="hidden" name="incident_id" value="{{ $incident->id }}">
<div class="form-group">
<div class="btn-group">

View File

@ -1,10 +1,10 @@
<div class="sidebar">
<div class="sidebar-inner">
<div class="profile">
<a href="{{ url('dashboard/user') }}">
<a href="{{ route('dashboard.user.user') }}">
<span class="avatar"><img src="{{ $current_user->gravatar }}"></span>
</a>
<a href="{{ url('dashboard/user') }}">
<a href="{{ route('dashboard.user.user') }}">
<h4 class="username">{{ $current_user->username }}</h4>
</a>
</div>

View File

@ -14,7 +14,7 @@
<div class="row">
<div class="col-md-12">
@include('dashboard.partials.errors')
<form class='form-vertical' name='ScheduleForm' role='form' method='POST' autocomplete="off">
<form class="form-vertical" name="ScheduleForm" role="form" method="POST" autocomplete="off">
<input type="hidden" name="_token" value="{{ csrf_token() }}">
<input type="hidden" name="visible" value="1">
<fieldset>
@ -35,7 +35,7 @@
</div>
<div class="form-group">
<label>{{ trans('forms.incidents.message') }}</label>
<div class='markdown-control'>
<div class="markdown-control">
<textarea name="message" class="form-control autosize" rows="5" required>{{ Binput::old('incident.message') }}</textarea>
</div>
</div>

View File

@ -14,7 +14,7 @@
<div class="row">
<div class="col-md-12">
@include('dashboard.partials.errors')
<form class='form-vertical' name='ScheduleForm' role='form' method='POST' autocomplete="off">
<form class="form-vertical" name="ScheduleForm" role="form" method='POST' autocomplete="off">
<input type="hidden" name="_token" value="{{ csrf_token() }}">
<input type="hidden" name="incident[visible]" value="1">
<fieldset>

View File

@ -24,7 +24,7 @@
</fieldset>
<div class="form-group">
<div class='btn-group'>
<div class="btn-group">
<button type="submit" class="btn btn-success">{{ trans('forms.add') }}</button>
<a class="btn btn-default" href="{{ route('dashboard.subscribers.index') }}">{{ trans('forms.cancel') }}</a>
</div>

View File

@ -36,7 +36,7 @@
<div class="col-xs-3">
@if($subscriber->subscriptions->count() > 0)
{!! $subscriber->subscriptions->map(function ($subscription) {
return '<span class="label label-primary">'.$subscription->component->name.'</span>';
return sprintf('<span class="label label-primary">%s</span>', $subscription->component->name);
})->implode(' ') !!}
@else
<p>{{ trans('dashboard.subscribers.no_subscriptions') }}</p>

View File

@ -41,7 +41,7 @@
</fieldset>
<div class="form-group">
<div class='btn-group'>
<div class="btn-group">
<button type="submit" class="btn btn-success">{{ trans('forms.add') }}</button>
<a class="btn btn-default" href="{{ route('dashboard.team.index') }}">{{ trans('forms.cancel') }}</a>
</div>

View File

@ -35,7 +35,7 @@
</fieldset>
<div class="form-group">
<div class='btn-group'>
<div class="btn-group">
<button type="submit" class="btn btn-success">{{ trans('forms.invite') }}</button>
<a class="btn btn-default" href="{{ route('dashboard.team.index') }}">{{ trans('forms.cancel') }}</a>
</div>

View File

@ -1,35 +1,35 @@
@if($enable_external_dependencies)
@if($app_analytics)
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
ga('create', '{{ $app_analytics }}', '{{ $_SERVER['SERVER_NAME'] or '' }}');
ga('send', 'pageview');
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
ga('create', '{{ $app_analytics }}', '{{ $_SERVER['SERVER_NAME'] or '' }}');
ga('send', 'pageview');
</script>
@endif
@if($app_analytics_go_squared)
<script>
!function(g,s,q,r,d){r=g[r]=g[r]||function(){(r.q=r.q||[]).push(
arguments)};d=s.createElement(q);q=s.getElementsByTagName(q)[0];
d.src='https://d1l6p2sc9645hc.cloudfront.net/tracker.js';q.parentNode.
insertBefore(d,q)}(window,document,'script','_gs');
_gs('{{ $app_analytics_go_squared }}');
!function(g,s,q,r,d){r=g[r]=g[r]||function(){(r.q=r.q||[]).push(
arguments)};d=s.createElement(q);q=s.getElementsByTagName(q)[0];
d.src='https://d1l6p2sc9645hc.cloudfront.net/tracker.js';q.parentNode.
insertBefore(d,q)}(window,document,'script','_gs');
_gs('{{ $app_analytics_go_squared }}');
</script>
@endif
@if($app_analytics_piwik_url)
<script type="text/javascript">
var _paq = _paq || [];
_paq.push(['trackPageView']);
_paq.push(['enableLinkTracking']);
(function() {
var u="https://{{ $app_analytics_piwik_url }}";
_paq.push(['setTrackerUrl', u+'/piwik.php']);
_paq.push(['setSiteId', {{ $app_analytics_piwik_site_id }}]);
var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
g.type='text/javascript'; g.async=true; g.defer=true; g.src=u+'/piwik.js'; s.parentNode.insertBefore(g,s);
})();
var _paq = _paq || [];
_paq.push(['trackPageView']);
_paq.push(['enableLinkTracking']);
(function() {
var u="https://{{ $app_analytics_piwik_url }}";
_paq.push(['setTrackerUrl', u+'/piwik.php']);
_paq.push(['setSiteId', {{ $app_analytics_piwik_site_id }}]);
var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
g.type='text/javascript'; g.async=true; g.defer=true; g.src=u+'/piwik.js'; s.parentNode.insertBefore(g,s);
})();
</script>
<noscript><p><img src="https://{{ $app_analytics_piwik_url }}/piwik.php?idsite={{ $app_analytics_piwik_site_id }}" style="border:0;" alt="" /></p></noscript>
@endif

View File

@ -9,9 +9,9 @@
checked="checked"
@endif />
{{ $component->name }}
</label>
</div>
@if($component->description)
</label>
</div>
@if($component->description)
<i class="ion ion-ios-help-outline help-icon" data-toggle="tooltip" data-title="{{ $component->description }}" data-container="body"></i>
@endif
@endif
</li>

View File

@ -23,9 +23,7 @@
@if($ungrouped_components->count() > 0)
<ul class="list-group components">
<li class="list-group-item group-name">
<strong>{{ trans('cachet.components.group.other') }}</strong>
</li>
<li class="list-group-item group-name"><strong>{{ trans('cachet.components.group.other') }}</strong></li>
@foreach($ungrouped_components as $component)
@include('partials.component', compact($component))
@endforeach

View File

@ -1,33 +1,33 @@
@if($component_groups->count() > 0)
@foreach($component_groups as $componentGroup)
<ul class="list-group components">
@if($componentGroup->enabled_components->count() > 0)
<li class="list-group-item group-name">
<i class="{{ $componentGroup->collapse_class_with_subscriptions($subscriptions) }} group-toggle"></i>
<strong>{{ $componentGroup->name }}</strong>
<div class="pull-right text-muted small">
<a href="#" class="select-group" id="select-all-{{$componentGroup->id}}">Select All</a>
&nbsp;|&nbsp;
<a href="#" class="deselect-group" id="deselect-all-{{$componentGroup->id}}">Deselect All</a>
</div>
</li>
<div class="form-group group-items {{ $componentGroup->has_subscriber($subscriptions) ? null : "hide" }}">
@foreach($componentGroup->enabled_components()->orderBy('order')->get() as $component)
@include('partials.component_input', compact($component))
@endforeach
</div>
@endif
</ul>
@endforeach
@foreach($component_groups as $componentGroup)
<ul class="list-group components">
@if($componentGroup->enabled_components->count() > 0)
<li class="list-group-item group-name">
<i class="{{ $componentGroup->collapse_class_with_subscriptions($subscriptions) }} group-toggle"></i>
<strong>{{ $componentGroup->name }}</strong>
<div class="pull-right text-muted small">
<a href="#" class="select-group" id="select-all-{{$componentGroup->id}}">Select All</a>
&nbsp;|&nbsp;
<a href="#" class="deselect-group" id="deselect-all-{{$componentGroup->id}}">Deselect All</a>
</div>
</li>
<div class="form-group group-items {{ $componentGroup->has_subscriber($subscriptions) ? null : "hide" }}">
@foreach($componentGroup->enabled_components()->orderBy('order')->get() as $component)
@include('partials.component_input', compact($component))
@endforeach
</div>
@endif
</ul>
@endforeach
@endif
@if($ungrouped_components->count() > 0)
<ul class="list-group components">
<li class="list-group-item group-name">
<strong>{{ trans('cachet.components.group.other') }}</strong>
</li>
@foreach($ungrouped_components as $component)
@include('partials.component_input', compact($component))
@endforeach
</ul>
<ul class="list-group components">
<li class="list-group-item group-name">
<strong>{{ trans('cachet.components.group.other') }}</strong>
</li>
@foreach($ungrouped_components as $component)
@include('partials.component_input', compact($component))
@endforeach
</ul>
@endif

View File

@ -16,14 +16,14 @@
</div>
<div class="col-sm-8">
<ul class="list-inline">
@if($current_user || Config::get('setting.dashboard_login_link'))
@if($current_user || $dashboard_link)
<li>
<a class="btn btn-link" href="/dashboard">{{ trans('dashboard.dashboard') }}</a>
</li>
@endif
@if($current_user)
<li>
<a class="btn btn-link" href="/auth/logout">{{ trans('dashboard.logout') }}</a>
<a class="btn btn-link" href="{{ route('auth.logout') }}">{{ trans('dashboard.logout') }}</a>
</li>
@endif
<li>

View File

@ -15,12 +15,12 @@
</a>
<ul class="dropdown-menu arrow">
<li><a href="{{ route('dashboard.incidents.add') }}">{{ trans('dashboard.incidents.add.title') }}</a></li>
<li><a href="/dashboard">{{ trans('dashboard.dashboard') }}</a></li>
<li><a href="{{ route('dashboard.index') }}">{{ trans('dashboard.dashboard') }}</a></li>
<li><a href="{{ route('auth.logout') }}">{{ trans('dashboard.logout') }}</a></li>
</ul>
</li>
@elseif(Config::get('setting.dashboard_login_link'))
<li><a href="/dashboard">{{ trans('dashboard.dashboard') }}</a></li>
@elseif($dashboard_link)
<li><a href="{{ route('dashboard.index') }}">{{ trans('dashboard.dashboard') }}</a></li>
@endif
</ul>
</div>

View File

@ -31,35 +31,52 @@
<div class="step block-1">
<fieldset>
<div class="form-group">
<label>{{ trans('forms.setup.cache_driver') }}</label>
<select name="env[cache_driver]" class="form-control" required>
<option disabled>{{ trans('forms.setup.cache_driver') }}</option>
@foreach($cache_drivers as $driver => $driverName)
<option value="{{ $driver }}" {{ Binput::old('env.cache_driver') == $driver || $driver === "file" ? "selected" : null }}>{{ $driverName }}</option>
@endforeach
</select>
@if($errors->has('env.cache_driver'))
<span class="text-danger">{{ $errors->first('env.cache_driver') }}</span>
@endif
</div>
<div class="form-group">
<label>{{ trans('forms.setup.session_driver') }}</label>
<select name="env[session_driver]" class="form-control" required>
<option disabled>{{ trans('forms.setup.session_driver') }}</option>
@foreach($cache_drivers as $driver => $driverName)
<option value="{{ $driver }}" {{ Binput::old('env.session_driver') == $driver || $driver === "file" ? "selected" : null }}>{{ $driverName }}</option>
@endforeach
</select>
@if($errors->has('env.session_driver'))
<span class="text-danger">{{ $errors->first('env.session_driver') }}</span>
@endif
<div class="row">
<div class="col-xs-4">
<label>{{ trans('forms.setup.cache_driver') }}</label>
<select name="env[cache_driver]" class="form-control" required>
<option disabled>{{ trans('forms.setup.cache_driver') }}</option>
@foreach($cache_drivers as $driver => $driverName)
<option value="{{ $driver }}" {{ Binput::old('env.cache_driver', $cache_config['driver']) == $driver ? "selected" : null }}>{{ $driverName }}</option>
@endforeach
</select>
@if($errors->has('env.cache_driver'))
<span class="text-danger">{{ $errors->first('env.cache_driver') }}</span>
@endif
</div>
<div class="col-xs-4">
<label>{{ trans('forms.setup.queue_driver') }}</label>
<select name="env[queue_driver]" class="form-control" required>
<option disabled>{{ trans('forms.setup.queue_driver') }}</option>
@foreach($queue_drivers as $driver => $driverName)
<option value="{{ $driver }}" {{ Binput::old('env.queue_driver', $queue_config['driver']) == $driver ? "selected" : null }}>{{ $driverName }}</option>
@endforeach
</select>
@if($errors->has('env.queue_driver'))
<span class="text-danger">{{ $errors->first('env.queue_driver') }}</span>
@endif
</div>
<div class="col-xs-4">
<label>{{ trans('forms.setup.session_driver') }}</label>
<select name="env[session_driver]" class="form-control" required>
<option disabled>{{ trans('forms.setup.session_driver') }}</option>
@foreach($cache_drivers as $driver => $driverName)
<option value="{{ $driver }}" {{ Binput::old('env.session_driver', $session_config['driver']) == $driver ? "selected" : null }}>{{ $driverName }}</option>
@endforeach
</select>
@if($errors->has('env.session_driver'))
<span class="text-danger">{{ $errors->first('env.session_driver') }}</span>
@endif
</div>
</div>
</div>
<hr>
<div class="form-group">
<label>{{ trans('forms.setup.mail_driver') }}</label>
<select name="env[mail_driver]" class="form-control" required>
<option disabled>{{ trans('forms.setup.mail_driver') }}</option>
@foreach($mail_drivers as $driver => $driverName)
<option value="{{ $driver }}" {{ Binput::old('env.mail_driver') == $driver || $driver === "log" ? "selected" : null }}>{{ $driverName }}</option>
<option value="{{ $driver }}" {{ Binput::old('env.mail_driver', $mail_config['driver']) == $driver ? "selected" : null }}>{{ $driverName }}</option>
@endforeach
</select>
@if($errors->has('env.mail_driver'))
@ -68,28 +85,28 @@
</div>
<div class="form-group">
<label>{{ trans('forms.setup.mail_host') }} (optional)</label>
<input type="text" class="form-control" name="env[mail_host]" value="{{ Binput::old('env.mail_host') }}">
<input type="text" class="form-control" name="env[mail_host]" value="{{ Binput::old('env.mail_host', $mail_config['host']) }}">
@if($errors->has('env.mail_host'))
<span class="text-danger">{{ $errors->first('env.mail_host') }}</span>
@endif
</div>
<div class="form-group">
<label>{{ trans('forms.setup.mail_address') }}</label>
<input type="text" class="form-control" name="env[mail_address]" value="{{ Binput::old('env.mail_address') }}" placeholder="notifications@alt-three.com">
<input type="text" class="form-control" name="env[mail_address]" value="{{ Binput::old('env.mail_address', $mail_config['from']['address']) }}" placeholder="notifications@alt-three.com">
@if($errors->has('env.mail_address'))
<span class="text-danger">{{ $errors->first('env.mail_address') }}</span>
@endif
</div>
<div class="form-group">
<label>{{ trans('forms.setup.mail_username') }}</label>
<input type="text" class="form-control" name="env[mail_username]" value="{{ Binput::old('env.mail_username') }}">
<input type="text" class="form-control" name="env[mail_username]" value="{{ Binput::old('env.mail_username', $mail_config['username']) }}">
@if($errors->has('env.mail_username'))
<span class="text-danger">{{ $errors->first('env.mail_username') }}</span>
@endif
</div>
<div class="form-group">
<label>{{ trans('forms.setup.mail_password') }}</label>
<input type="text" class="form-control" name="env[mail_password]" value="{{ Binput::old('env.mail_password') }}" autocomplete="off">
<input type="password" class="form-control" name="env[mail_password]" value="{{ Binput::old('env.mail_password', $mail_config['password']) }}" autocomplete="off">
@if($errors->has('env.mail_password'))
<span class="text-danger">{{ $errors->first('env.mail_password') }}</span>
@endif