Skip to content

Commit

Permalink
Merge pull request #51 from fergthh/enhancement-login-form
Browse files Browse the repository at this point in the history
Login Section: Added autofocus in email field and show/hide password field button
  • Loading branch information
austintoddj authored Jul 16, 2016
2 parents 8a2aa73 + d9e9be7 commit d9dfab5
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 6 deletions.
3 changes: 2 additions & 1 deletion resources/views/auth/login.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,5 @@

@section('unique-js')
{!! JsValidator::formRequest('App\Http\Requests\LoginRequest', '#login'); !!}
@stop
@include('backend.shared.components.show-password', ['inputs' => 'input[name="password"]'])
@stop
4 changes: 2 additions & 2 deletions resources/views/auth/partials/login-form.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{!! csrf_field() !!}
<div class="form-group fg-line">
<input type="email" class="form-control"
name="email" value="{{ old('email') }}" placeholder="Email">
name="email" value="{{ old('email') }}" placeholder="Email" autofocus>
</div>
<div class="form-group fg-line">
<input type="password" name="password" class="form-control"
Expand All @@ -20,4 +20,4 @@
</div>

<button type="submit" name="submit" class="btn btn-primary btn-block m-t-10">Sign in</button>
</form>
</form>
2 changes: 1 addition & 1 deletion resources/views/backend/layout.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@
@yield('unique-js')

</body>
</html>
</html>
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@
&nbsp;
<a href="{{url('admin/profile')}}"><button type="button" class="btn btn-link">Cancel</button></a>
</div>
</form>
</form>
3 changes: 2 additions & 1 deletion resources/views/backend/profile/privacy.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@

@section('unique-js')
{!! JsValidator::formRequest('App\Http\Requests\PasswordUpdateRequest', '#passwordUpdate'); !!}
@include('backend.shared.components.show-password', ['inputs' => 'input[name="password"], input[name="new_password"], input[name="new_password_confirmation"]'])

@if(Session::get('_passwordUpdate'))
@include('backend.profile.partials.notifications.update-password')
{{ \Session::forget('_passwordUpdate') }}
@endif
@stop
@stop
31 changes: 31 additions & 0 deletions resources/views/backend/shared/components/show-password.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<style type="text/css">
button.show-password{
background-color: #2196f3;
border: 1px solid #2196f3;
border-radius: 2px;
color: #fff;
font-size: 0.9em;
opacity: .5;
position: absolute;
right: 0;
top: 0;
}
button.show-password:hover{
opacity: 1;
transition: all .8s linear;
}
</style>

<script>
(function(){
$('{!! $inputs !!}').parent().append('<button class="show-password">Show content</button>');
$('.show-password').click(function (e) {
var password_field = $(this).siblings('input');
var new_type = (password_field.attr('type') === 'password') ? 'text' : 'password';
var new_text = ($(this).html() === 'Show content') ? 'Hide' : 'Show';
password_field.attr('type', new_type).focus();
$(this).html(new_text + ' content');
});
})();
</script>

0 comments on commit d9dfab5

Please sign in to comment.