Commit 047bf4fa authored by Nicolas Widart's avatar Nicolas Widart

Merge commit '93831760'

* commit '93831760':
  Squashed 'Modules/User/' changes from 95673b5..440ce5c
parents 856b7e77 93831760
rules:
php.interface_has_no_interface_suffix:
enabled: false
language: php
php:
- 5.6
- 5.5
- 5.4
- hhvm
......@@ -6,8 +6,9 @@ class UpdateUserRequest extends FormRequest
{
public function rules()
{
$userId = $this->route()->getParameter('users');
return [
'email' => 'required|email',
'email' => "required|email|unique:users,email,{$userId}",
'first_name' => 'required',
'last_name' => 'required',
];
......
<?php
$router->group(['prefix' => LaravelLocalization::setLocale(), 'before' => 'LaravelLocalizationRedirectFilter|auth.admin|permissions'], function($router)
use Illuminate\Routing\Router;
$router->group(['prefix' => LaravelLocalization::setLocale(), 'before' => 'LaravelLocalizationRedirectFilter|auth.admin|permissions'], function(Router $router)
{
$router->group(['prefix' => Config::get('core::core.admin-prefix'), 'namespace' => 'Modules\User\Http\Controllers'], function($router)
$router->group(['prefix' => Config::get('core::core.admin-prefix'), 'namespace' => 'Modules\User\Http\Controllers'], function(Router $router)
{
$router->resource('users', 'Admin\UserController', ['except' => ['show'], 'names' => [
'index' => 'dashboard.user.index',
......@@ -23,7 +25,7 @@ $router->group(['prefix' => LaravelLocalization::setLocale(), 'before' => 'Larav
});
});
$router->group(['prefix' => 'auth', 'namespace' => 'Modules\User\Http\Controllers'], function($router)
$router->group(['prefix' => 'auth', 'namespace' => 'Modules\User\Http\Controllers'], function(Router $router)
{
# Login
$router->get('login', ['before' => 'auth.guest', 'as' => 'login', 'uses' => 'AuthController@getLogin']);
......
......@@ -25,9 +25,6 @@
<div class="tab-content">
<div class="tab-pane active" id="tab_1-1">
<div class="box-body">
<div class="row">
@include('flash::message')
</div>
<div class="row">
<div class="col-sm-6">
<div class="form-group{{ $errors->has('name') ? ' has-error' : '' }}">
......
......@@ -28,9 +28,6 @@
<div class="tab-content">
<div class="tab-pane active" id="tab_1-1">
<div class="box-body">
<div class="row">
@include('flash::message')
</div>
<div class="row">
<div class="col-sm-6">
<div class="form-group{{ $errors->has('name') ? ' has-error' : '' }}">
......
......@@ -14,7 +14,6 @@
<div class="row">
<div class="col-xs-12">
<div class="row">
@include('flash::message')
<div class="btn-group pull-right" style="margin: 0 15px 15px 0;">
<a href="{{ URL::route('dashboard.role.create') }}" class="btn btn-primary btn-flat" style="padding: 4px 10px;">
<i class="fa fa-pencil"></i> {{ trans('user::roles.button.new-role') }}
......
......@@ -28,9 +28,6 @@
<div class="tab-content">
<div class="tab-pane active" id="tab_1-1">
<div class="box-body">
<div class="row">
@include('flash::message')
</div>
<div class="row">
<div class="col-sm-4">
<div class="form-group{{ $errors->has('first_name') ? ' has-error' : '' }}">
......
......@@ -28,9 +28,6 @@
<div class="tab-content">
<div class="tab-pane active" id="tab_1-1">
<div class="box-body">
<div class="row">
@include('flash::message')
</div>
<div class="row">
<div class="col-sm-4">
<div class="form-group{{ $errors->has('first_name') ? ' has-error' : '' }}">
......
......@@ -14,7 +14,6 @@
<div class="row">
<div class="col-xs-12">
<div class="row">
@include('flash::message')
<div class="btn-group pull-right" style="margin: 0 15px 15px 0;">
<a href="{{ URL::route('dashboard.user.create') }}" class="btn btn-primary btn-flat" style="padding: 4px 10px;">
<i class="fa fa-pencil"></i> {{ trans('user::users.button.new-user') }}
......
<?php namespace Modules\User\Tests;
use Cartalyst\Sentinel\Laravel\Facades\Sentinel;
use Illuminate\Support\Facades\Config;
use Modules\Core\Tests\BaseTestCase;
class SessionUrlTest extends BaseTestCase
{
/** @test */
public function loginPageShouldBeAccessible()
{
$this->checkResponseIsOkAndContains(['GET', '/auth/login'], '.header:contains("Sign In")');
}
/** @test */
public function registerPageShouldBeAccessible()
{
$this->checkResponseIsOkAndContains(['GET', '/auth/register'], '.header:contains("Register New Membership")');
}
/** @test */
public function forgotPasswordShouldBeAccessible()
{
$this->checkResponseIsOkAndContains(['GET', '/auth/reset'], '.header:contains("Reset Password")');
}
/** @test */
public function dashboardShouldNotBePubliclyAccessible()
{
$this->app['router']->enableFilters();
Sentinel::logout();
$this->client->request('GET', '/' . Config::get('core::core.admin-prefix'));
$this->assertRedirectedTo('auth/login');
}
/** @test */
public function dashboardShouldBeAccessibleIfLoggedIn()
{
// $sentinelMock = Mockery::mock('Cartalyst\Sentinel\Laravel\Facades\Sentinel');
// $sentinelMock->shouldReceive('check')->andReturn(true);
$this->app['router']->enableFilters();
$user = Sentinel::findById(4);
Sentinel::login($user);
$this->checkResponseIsOkAndContains(['GET', '/' . Config::get('core::core.admin-prefix')], 'h1:contains("Dashboard")');
}
}
<?php namespace Modules\User\Tests;
use Cartalyst\Sentinel\Laravel\Facades\Sentinel;
use Illuminate\Support\Facades\Config;
use Modules\Core\Tests\BaseTestCase;
class UserUrlTest extends BaseTestCase
{
public function setUp()
{
parent::setUp();
$user = Sentinel::findById(4);
Sentinel::login($user);
}
/** @test */
public function userIndexShouldBeAccessible()
{
$uri = '/' . Config::get('core::core.admin-prefix') . '/users';
$this->checkResponseIsOkAndContains(['GET', $uri], 'h1:contains("Users")');
}
/** @test */
public function userEditShouldBeAccessible()
{
$uri = '/' . Config::get('core::core.admin-prefix') . '/users/4/edit';
$this->checkResponseIsOkAndContains(['GET', $uri], 'h1:contains("Edit User")');
}
/** @test */
public function userCreateShouldBeAccessible()
{
$uri = '/' . Config::get('core::core.admin-prefix') . '/users/create';
$this->checkResponseIsOkAndContains(['GET', $uri], 'h1:contains("New User")');
}
/** @test */
public function roleIndexShouldBeAccessible()
{
$uri = '/' . Config::get('core::core.admin-prefix') . '/roles';
$this->checkResponseIsOkAndContains(['GET', $uri], 'h1:contains("Roles")');
}
/** @test */
public function roleCreateShouldBeAccessible()
{
$uri = '/' . Config::get('core::core.admin-prefix') . '/roles/create';
$this->checkResponseIsOkAndContains(['GET', $uri], 'h1:contains("New Role")');
}
/** @test */
public function roleEditShouldBeAccessible()
{
$uri = '/' . Config::get('core::core.admin-prefix') . '/roles/6/edit';
$this->checkResponseIsOkAndContains(['GET', $uri], 'h1:contains("Updating Role")');
}
}
......@@ -2,6 +2,7 @@
[![SensioLabsInsight](https://insight.sensiolabs.com/projects/304d1d01-3347-4958-915f-b2daabfe5f5a/mini.png)](https://insight.sensiolabs.com/projects/304d1d01-3347-4958-915f-b2daabfe5f5a)
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/nWidart-Modules/User/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/nWidart-Modules/User/?branch=master)
[![Code Climate](https://codeclimate.com/github/nWidart-Modules/User/badges/gpa.svg)](https://codeclimate.com/github/nWidart-Modules/User)
This module is responsible for handling the users and roles.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment