Edit the mail config from the dashboard and provide testing button

This commit is contained in:
James Brooks
2016-11-29 18:31:37 +00:00
parent 72056e2ac5
commit 9dc80b4229
12 changed files with 439 additions and 0 deletions

View File

@@ -11,12 +11,15 @@
namespace CachetHQ\Cachet\Http\Controllers\Dashboard;
use CachetHQ\Cachet\Bus\Commands\System\Config\UpdateConfigCommand;
use CachetHQ\Cachet\Bus\Commands\System\Mail\TestMailCommand;
use CachetHQ\Cachet\Integrations\Contracts\Credits;
use CachetHQ\Cachet\Models\User;
use CachetHQ\Cachet\Settings\Repository;
use Exception;
use GrahamCampbell\Binput\Facades\Binput;
use Illuminate\Routing\Controller;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Config;
use Illuminate\Support\Facades\Lang;
use Illuminate\Support\Facades\Log;
@@ -96,6 +99,12 @@ class SettingsController extends Controller
'icon' => 'ion-ios-list',
'active' => false,
],
'mail' => [
'title' => trans('dashboard.settings.mail.mail'),
'url' => cachet_route('dashboard.settings.mail'),
'icon' => 'ion-paper-airplane',
'active' => false,
],
'about' => [
'title' => CACHET_VERSION,
'url' => 'javascript: void(0);',
@@ -266,6 +275,47 @@ class SettingsController extends Controller
return View::make('dashboard.settings.log')->withLog($logContents)->withSubMenu($this->subMenu);
}
/**
* Show the mail settings view.
*
* @return \Illuminate\View\View
*/
public function showMailView()
{
$this->subMenu['mail']['active'] = true;
return View::make('dashboard.settings.mail')->withConfig(Config::get('mail'));
}
/**
* Test the mail config.
*
* @return \Illuminate\Http\RedirectResponse
*/
public function testMail()
{
dispatch(new TestMailCommand(Auth::user()));
return cachet_redirect('dashboard.settings.mail')
->withSuccess(trans('dashboard.notifications.awesome'));;
}
/**
* Handle updating of the settings.
*
* @return \Illuminate\Http\RedirectResponse
*/
public function postMail()
{
$config = Binput::get('config');
dispatch(new UpdateConfigCommand($config));
return cachet_redirect('dashboard.settings.mail')
->withInput(Binput::all())
->withSuccess(trans('dashboard.notifications.awesome'));
}
/**
* Updates the status page settings.
*