Skip to content

Commit

Permalink
Merge pull request #130 from kontenta/feature/login-autocomplete
Browse files Browse the repository at this point in the history
Login improvements
  • Loading branch information
erik-epineer authored Jun 28, 2019
2 parents 4c41e6e + 3f0c96d commit 3626ed5
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 8 deletions.
8 changes: 6 additions & 2 deletions resources/views/auth/login.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,16 @@

@extends($view_manager->layout())

<?php
$autofocusControlId = 'email';
?>

@section('kontourMain')
<header>{{ __('Login') }}</header>
<form method="POST" action="{{ route('kontour.login') }}">
@csrf
@include('kontour::forms.input', ['name' => 'email', 'type' => 'email', 'controlAttributes' => ['required']])
@include('kontour::forms.input', ['name' => 'password', 'type' => 'password', 'controlAttributes' => ['required']])
@include('kontour::forms.input', ['name' => 'email', 'type' => 'email', 'controlAttributes' => ['required', 'autocomplete' => 'email']])
@include('kontour::forms.input', ['name' => 'password', 'type' => 'password', 'controlAttributes' => ['required', 'autocomplete' => 'current-password']])
@include('kontour::forms.checkbox', ['name' => 'remember', 'label' => __('Remember Me')])
@component('kontour::buttons.generic')
{{ __('Login') }}
Expand Down
6 changes: 5 additions & 1 deletion resources/views/auth/passwords/email.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,18 @@

@extends($view_manager->layout())

<?php
$autofocusControlId = 'email';
?>

@section('kontourMain')
<header>{{ __('Reset Password') }}</header>

{{ $messageWidget }}

<form method="POST" action="{{ route('kontour.password.email') }}">
@csrf
@include('kontour::forms.input', ['name' => 'email', 'type' => 'email', 'controlAttributes' => ['required']])
@include('kontour::forms.input', ['name' => 'email', 'type' => 'email', 'controlAttributes' => ['required', 'autocomplete' => 'email']])
@component('kontour::buttons.generic')
{{ __('Send Password Reset Link') }}
@endcomponent
Expand Down
10 changes: 7 additions & 3 deletions resources/views/auth/passwords/reset.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,18 @@

@extends($view_manager->layout())

<?php
$autofocusControlId = array_merge(array_intersect(['email', 'password'], $errors->keys()), ['email'])[0];
?>

@section('kontourMain')
<header>{{ __('Reset Password') }}</header>
<form method="POST" action="{{ route('kontour.password.request') }}">
@csrf
<input type="hidden" name="token" value="{{ $token }}">
@include('kontour::forms.input', ['name' => 'email', 'type' => 'email', 'controlAttributes' => ['required']])
@include('kontour::forms.input', ['name' => 'password', 'type' => 'password', 'controlAttributes' => ['required']])
@include('kontour::forms.input', ['name' => 'password_confirmation', 'type' => 'password', 'controlAttributes' => ['required']])
@include('kontour::forms.input', ['name' => 'email', 'type' => 'email', 'controlAttributes' => ['required', 'autocomplete' => 'email']])
@include('kontour::forms.input', ['name' => 'password', 'type' => 'password', 'controlAttributes' => ['required', 'autocomplete' => 'new-password']])
@include('kontour::forms.input', ['name' => 'password_confirmation', 'type' => 'password', 'controlAttributes' => ['required', 'autocomplete' => 'new-password']])
@component('kontour::buttons.generic')
{{ __('Reset Password') }}
@endcomponent
Expand Down
2 changes: 1 addition & 1 deletion tests/Browser/AuthenticationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public function test_logout()
* @var $routeManager \Kontenta\Kontour\Contracts\AdminRouteManager
*/
$routeManager = $this->app->make(\Kontenta\Kontour\Contracts\AdminRouteManager::class);
$browser->loginAs($this->user)->visit($routeManager->indexUrl())
$browser->loginAs($this->user, 'admin')->visit($routeManager->indexUrl())
->press('Logout')
->assertUrlIs($routeManager->loginUrl());
});
Expand Down
2 changes: 1 addition & 1 deletion tests/Browser/SkipToContentTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public function test_skip_to_content()
* @var $routeManager \Kontenta\Kontour\Contracts\AdminRouteManager
*/
$routeManager = $this->app->make(\Kontenta\Kontour\Contracts\AdminRouteManager::class);
$browser->visit($routeManager->loginUrl());
$browser->loginAs($this->user, 'admin')->visit($routeManager->indexUrl());

$this->assertEquals('absolute', $browser->element($this->element)->getCSSValue('position'));

Expand Down

0 comments on commit 3626ed5

Please sign in to comment.