Moved password visibility toggle to snipeit.js
This commit is contained in:
@@ -596,6 +596,18 @@ function htmlEntities(str) {
|
||||
|
||||
})(jQuery);
|
||||
|
||||
$(document).ready(function () {
|
||||
$(".toggle-password").click(function () {
|
||||
$(this).toggleClass("fa-eye fa-eye-slash");
|
||||
var input = $($(this).attr("data-toggle"));
|
||||
if (input.attr("type") === "password") {
|
||||
input.attr("type", "text");
|
||||
} else {
|
||||
input.attr("type", "password");
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -521,6 +521,7 @@ return [
|
||||
'pre_flight' => 'Pre-Flight',
|
||||
'skip_to_main_content' => 'Skip to main content',
|
||||
'toggle_navigation' => 'Toggle navigation',
|
||||
'toggle_password_visibility' => 'Toggle password visibility',
|
||||
'alerts' => 'Alerts',
|
||||
'tasks_view_all' => 'View all tasks',
|
||||
'true' => 'True',
|
||||
|
||||
@@ -76,7 +76,7 @@
|
||||
<input class="form-control" placeholder="{{ trans('admin/users/table.password') }}" name="password" type="password" id="password-field" autocomplete="{{ (config('auth.login_autocomplete') === true) ? 'on' : 'off' }}" autocorrect="off" autocapitalize="off" spellcheck="false">
|
||||
<span class="input-group-addon">
|
||||
<i data-toggle="#password-field" class="fa fa-fw fa-eye toggle-password" aria-hidden="true"></i>
|
||||
<span class="sr-only">Toggle password visibility</span>
|
||||
<span class="sr-only">{{ trans('general.toggle_password_visibility') }}</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -64,18 +64,6 @@
|
||||
{{-- Javascript files --}}
|
||||
<script src="{{ url(mix('js/dist/all.js')) }}" nonce="{{ csrf_token() }}"></script>
|
||||
|
||||
<script>
|
||||
$(".toggle-password").click(function () {
|
||||
$(this).toggleClass("fa-eye fa-eye-slash");
|
||||
var input = $($(this).attr("data-toggle"));
|
||||
if (input.attr("type") === "password") {
|
||||
input.attr("type", "text");
|
||||
}
|
||||
else {
|
||||
input.attr("type", "password");
|
||||
}
|
||||
});
|
||||
</script>
|
||||
@stack('js')
|
||||
</body>
|
||||
|
||||
|
||||
@@ -130,8 +130,13 @@
|
||||
|
||||
<div class="col-md-6">
|
||||
@if ($user->ldap_import!='1' || str_contains(Route::currentRouteName(), 'clone') )
|
||||
<input type="password" name="password" class="form-control{{ (!Gate::allows('canEditAuthFields', $user)) || ((!Gate::allows('editableOnDemo') && ($user->id))) ? ' form-control--disabled' : '' }}" id="password" value="" maxlength="500" autocomplete="off" onfocus="this.removeAttribute('readonly');" readonly {{ ((Helper::checkIfRequired($user, 'password')) && (!$user->id)) ? ' required' : '' }}{!! (!Gate::allows('canEditAuthFields', $user)) || ((!Gate::allows('editableOnDemo')) && ($user->id)) ? ' style="cursor: not-allowed" disabled ' : '' !!}>
|
||||
<span id="generated-password"></span>
|
||||
<div class="input-group">
|
||||
<input type="password" name="password" class="form-control{{ (!Gate::allows('canEditAuthFields', $user)) || ((!Gate::allows('editableOnDemo') && ($user->id))) ? ' form-control--disabled' : '' }}" id="password" value="" maxlength="500" autocomplete="off" onfocus="this.removeAttribute('readonly');" readonly {{ ((Helper::checkIfRequired($user, 'password')) && (!$user->id)) ? ' required' : '' }}{!! (!Gate::allows('canEditAuthFields', $user)) || ((!Gate::allows('editableOnDemo')) && ($user->id)) ? ' style="cursor: not-allowed" disabled ' : '' !!}>
|
||||
<span class="input-group-addon">
|
||||
<i data-toggle="#password" class="fa fa-fw fa-eye toggle-password" aria-hidden="true"></i>
|
||||
<span class="sr-only">{{ trans('general.toggle_password_visibility') }}</span>
|
||||
</span>
|
||||
</div>
|
||||
{!! $errors->first('password', '<span class="alert-msg" aria-hidden="true">:message</span>') !!}
|
||||
@else
|
||||
<p class="form-control-static">
|
||||
@@ -172,7 +177,13 @@
|
||||
{{ trans('admin/users/table.password_confirm') }}
|
||||
</label>
|
||||
<div class="col-md-6">
|
||||
<input type="password" name="password_confirmation" id="password_confirm" class="form-control" value="" maxlength="500" autocomplete="off" aria-label="password_confirmation" {{ (!$user->id) ? ' required' : '' }} onfocus="this.removeAttribute('readonly');" readonly {!! (!Gate::allows('canEditAuthFields', $user)) || ((!Gate::allows('editableOnDemo')) && ($user->id)) ? ' style="cursor: not-allowed" disabled ' : '' !!}>
|
||||
<div class="input-group">
|
||||
<input type="password" name="password_confirmation" id="password_confirm" class="form-control" value="" maxlength="500" autocomplete="off" aria-label="password_confirmation" {{ (!$user->id) ? ' required' : '' }} onfocus="this.removeAttribute('readonly');" readonly {!! (!Gate::allows('canEditAuthFields', $user)) || ((!Gate::allows('editableOnDemo')) && ($user->id)) ? ' style="cursor: not-allowed" disabled ' : '' !!}>
|
||||
<span class="input-group-addon">
|
||||
<i data-toggle="#password_confirm" class="fa fa-fw fa-eye toggle-password" aria-hidden="true"></i>
|
||||
<span class="sr-only">{{ trans('general.toggle_password_visibility') }}</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@cannot('canEditAuthFields', $user)
|
||||
<p class="help-block">
|
||||
@@ -734,7 +745,6 @@ $(document).ready(function() {
|
||||
$('#genPassword').pGenerator({
|
||||
'bind': 'click',
|
||||
'passwordElement': '#password',
|
||||
'displayElement': '#generated-password',
|
||||
'passwordLength': {{ ($settings->pwd_secure_min + 9) }},
|
||||
'uppercase': true,
|
||||
'lowercase': true,
|
||||
|
||||
Reference in New Issue
Block a user