Change name to username
This commit is contained in:
parent
15755a3fd1
commit
6093119dde
11 changed files with 22 additions and 17 deletions
|
@ -43,6 +43,10 @@ class LoginController extends Controller
|
|||
$this->middleware('guest')->except('logout');
|
||||
}
|
||||
|
||||
public function username()
|
||||
{
|
||||
return 'username';
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle a login request to the application.
|
||||
|
@ -55,7 +59,7 @@ class LoginController extends Controller
|
|||
public function login(Request $request)
|
||||
{
|
||||
$current_user = User::currentUser();
|
||||
$request->merge(['email' => $current_user->email]);
|
||||
$request->merge(['username' => $current_user->username]);
|
||||
//die(print_r($request->all()));
|
||||
$this->validateLogin($request);
|
||||
|
||||
|
|
|
@ -53,14 +53,14 @@ class UserController extends Controller
|
|||
public function store(Request $request)
|
||||
{
|
||||
$validatedData = $request->validate([
|
||||
'name' => 'required|max:255|unique:users',
|
||||
'email' => 'required|email|unique:users',
|
||||
'username' => 'required|max:255|unique:users',
|
||||
'email' => 'required|email',
|
||||
'password' => 'nullable|confirmed',
|
||||
'password_confirmation' => 'nullable'
|
||||
|
||||
]);
|
||||
$user = new User;
|
||||
$user->name = $request->input('name');
|
||||
$user->username = $request->input('username');
|
||||
$user->email = $request->input('email');
|
||||
$user->public_front = $request->input('public_front');
|
||||
|
||||
|
@ -119,14 +119,14 @@ class UserController extends Controller
|
|||
public function update(Request $request, User $user)
|
||||
{
|
||||
$validatedData = $request->validate([
|
||||
'name' => 'required|max:255|unique:users,name,'.$user->id,
|
||||
'email' => 'required|email|unique:users,email,'.$user->id,
|
||||
'username' => 'required|max:255|unique:users,username,'.$user->id,
|
||||
'email' => 'required|email',
|
||||
'password' => 'nullable|confirmed',
|
||||
'password_confirmation' => 'nullable'
|
||||
]);
|
||||
//die(print_r($request->all()));
|
||||
|
||||
$user->name = $request->input('name');
|
||||
$user->username = $request->input('username');
|
||||
$user->email = $request->input('email');
|
||||
$user->public_front = $request->input('public_front');
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ class User extends Authenticatable
|
|||
* @var array
|
||||
*/
|
||||
protected $fillable = [
|
||||
'name', 'email', 'password',
|
||||
'username', 'email', 'password',
|
||||
];
|
||||
|
||||
/**
|
||||
|
|
|
@ -14,7 +14,7 @@ return [
|
|||
*/
|
||||
|
||||
'name' => env('APP_NAME', 'Heimdall'),
|
||||
'version' => '1.5.2',
|
||||
'version' => '1.5.5',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
|
@ -15,8 +15,8 @@ class CreateUsersTable extends Migration
|
|||
{
|
||||
Schema::create('users', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->string('name');
|
||||
$table->string('email')->unique();
|
||||
$table->string('username')->unique();
|
||||
$table->string('email');
|
||||
$table->string('avatar')->nullable();
|
||||
$table->string('password')->nullable();
|
||||
$table->string('autologin')->nullable()->index();
|
||||
|
|
|
@ -17,6 +17,7 @@ class UsersSeeder extends Seeder
|
|||
$user = new User;
|
||||
$user->id = 1;
|
||||
$user->name = 'Admin';
|
||||
$user->username = 'admin';
|
||||
$user->email = 'admin@test.com';
|
||||
$user->save();
|
||||
} else {
|
||||
|
|
|
@ -76,7 +76,7 @@ return [
|
|||
|
||||
'user.user_list' => 'Comercial',
|
||||
'user.add_user' => 'Adicionar usuários',
|
||||
'user.name' => 'Nome',
|
||||
'user.username' => 'Nome de usuário',
|
||||
'user.avatar' => 'Avatar',
|
||||
'user.email' => 'O email',
|
||||
'user.password_confirm' => 'Confirme a Senha',
|
||||
|
|
|
@ -76,7 +76,7 @@ return [
|
|||
|
||||
'user.user_list' => 'Users',
|
||||
'user.add_user' => 'Add user',
|
||||
'user.name' => 'Name',
|
||||
'user.username' => 'Username',
|
||||
'user.avatar' => 'Avatar',
|
||||
'user.email' => 'Email',
|
||||
'user.password_confirm' => 'Confirm Password',
|
||||
|
|
|
@ -14,7 +14,7 @@ $user = \App\User::currentUser();
|
|||
@else
|
||||
<img class="user-img" src="{{ asset('/img/heimdall-icon-small.png') }}" />
|
||||
@endif
|
||||
{{ $user->name }}
|
||||
{{ $user->username }}
|
||||
<input id="password" type="password" class="form-control" name="password" required>
|
||||
<button type="submit" class="btn btn-primary">Login</button>
|
||||
</div>
|
||||
|
|
|
@ -10,8 +10,8 @@
|
|||
{!! csrf_field() !!}
|
||||
|
||||
<div class="input">
|
||||
<label>{{ __('app.user.name') }} *</label>
|
||||
{!! Form::text('name', null, array('placeholder' => __('app.user.name'), 'id' => 'appname', 'class' => 'form-control')) !!}
|
||||
<label>{{ __('app.user.username') }} *</label>
|
||||
{!! Form::text('username', null, array('placeholder' => __('app.user.username'), 'id' => 'appname', 'class' => 'form-control')) !!}
|
||||
<hr />
|
||||
</div>
|
||||
<div class="input">
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
@else
|
||||
<img class="user-img" src="{{ asset('/img/heimdall-icon-small.png') }}" />
|
||||
@endif
|
||||
{{ $user->name }}
|
||||
{{ $user->username }}
|
||||
</a>
|
||||
@endforeach
|
||||
</div>
|
||||
|
|
Loading…
Reference in a new issue