Backport all fixes from the master to 1.1

This commit is contained in:
Graham Campbell 2015-08-03 14:23:46 +01:00
parent 5bdbc87bf2
commit 90baf18724
7 changed files with 109 additions and 24 deletions

View File

@ -31,25 +31,6 @@ class StatusPageRoutes
$router->get('/atom/{component_group?}', 'AtomController@feedAction');
$router->get('/rss/{component_group?}', 'RssController@feedAction');
$router->group(['middleware' => 'app.subscribers'], function ($router) {
$router->get('subscribe', [
'as' => 'subscribe-page',
'uses' => 'SubscribeController@showSubscribe',
]);
$router->post('subscribe', [
'as' => 'subscribe',
'uses' => 'SubscribeController@postSubscribe',
]);
$router->get('subscribe/verify/{code}', [
'as' => 'subscribe-verify',
'uses' => 'SubscribeController@getVerify',
]);
$router->get('unsubscribe/{code}', [
'as' => 'unsubscribe',
'uses' => 'SubscribeController@getUnsubscribe',
]);
});
});
}
}

View File

@ -0,0 +1,49 @@
<?php
/*
* This file is part of Cachet.
*
* (c) Alt Three Services Limited
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace CachetHQ\Cachet\Http\Routes;
use Illuminate\Contracts\Routing\Registrar;
class SubscribeRoutes
{
/**
* Define the subscribe routes.
*
* @param \Illuminate\Contracts\Routing\Registrar $router
*/
public function map(Registrar $router)
{
$router->group(['middleware' => 'app.hasSetting', 'setting' => 'app_name'], function ($router) {
$router->group(['middleware' => 'app.subscribers'], function ($router) {
$router->get('subscribe', [
'as' => 'subscribe-page',
'uses' => 'SubscribeController@showSubscribe',
]);
$router->post('subscribe', [
'as' => 'subscribe',
'uses' => 'SubscribeController@postSubscribe',
]);
$router->get('subscribe/verify/{code}', [
'as' => 'subscribe-verify',
'uses' => 'SubscribeController@getVerify',
]);
$router->get('unsubscribe/{code}', [
'as' => 'unsubscribe',
'uses' => 'SubscribeController@getUnsubscribe',
]);
});
});
}
}

View File

@ -13,13 +13,12 @@ namespace CachetHQ\Cachet\Models;
use CachetHQ\Cachet\Presenters\SubscriberPresenter;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use McCool\LaravelAutoPresenter\HasPresenter;
use Watson\Validating\ValidatingTrait;
class Subscriber extends Model implements HasPresenter
{
use SoftDeletes, ValidatingTrait;
use ValidatingTrait;
/**
* The validation rules.

View File

@ -25,8 +25,9 @@ class ComponentPresenter extends AbstractPresenter
public function toArray()
{
return array_merge($this->wrappedObject->toArray(), [
'created_at' => $this->created_at(),
'updated_at' => $this->updated_at(),
'created_at' => $this->created_at(),
'updated_at' => $this->updated_at(),
'status_name' => $this->wrappedObject->humanStatus,
]);
}
}

View File

@ -0,0 +1,41 @@
<?php
/*
* This file is part of Cachet.
*
* (c) Alt Three Services Limited
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AlterTableSubscribersRemoveDeletedAt extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('subscribers', function (Blueprint $table) {
$table->dropColumn('deleted_at');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('subscribers', function (Blueprint $table) {
$table->softDeletes();
});
}
}

View File

@ -127,7 +127,12 @@ return [
'password' => 'Password',
'api-token' => 'API Token',
'api-token-help' => 'Regenerating your API token will prevent existing applications from accessing Cachet.',
'2fa' => [
'user_level' => 'User Level',
'levels' => [
'admin' => 'Admin',
'user' => 'User',
],
'2fa' => [
'help' => 'Enabling two factor authentication increases security of your account. You will need to download <a href="https://support.google.com/accounts/answer/1066447?hl=en">Google Authenticator</a> or a similar app on to your mobile device. When you login you will be asked to provide a token generated by the app.',
],
],

View File

@ -28,6 +28,15 @@
<label>{{ trans('forms.user.password') }}</label>
<input type="password" class="form-control" name="password" value="">
</div>
@if($loggedUser->isAdmin)
<div class="form-group">
<label>{{ trans('forms.user.user_level') }}</label>
<select name="level" class="form-control">
<option value="2" selected>{{ trans('forms.user.levels.user') }}</option>
<option value="1">{{ trans('forms.user.levels.admin') }}</option>
</select>
</div>
@endif
</fieldset>
<div class="form-group">