Go nuclear on Safari's autocomplete.
This commit is contained in:
parent
b539f26dab
commit
c9c0e845b1
|
@ -141,20 +141,12 @@ class UserController extends Controller
|
|||
*/
|
||||
public function update(Request $request, $id)
|
||||
{
|
||||
// Rename variables because autofill cannot be disabled
|
||||
// in any logical manner, and editing users is impossible.
|
||||
$fixedData = array_filter(
|
||||
collect($request->all())->mapWithKeys(function ($item, $key) {
|
||||
return [str_replace('input_', '', $key) => $item];
|
||||
})->only([
|
||||
'email', 'password', 'name_first',
|
||||
'name_last', 'username', 'root_admin',
|
||||
])->toArray()
|
||||
);
|
||||
|
||||
try {
|
||||
$repo = new UserRepository;
|
||||
$user = $repo->update($id, $fixedData);
|
||||
$user = $repo->update($id, $request->intersect([
|
||||
'email', 'password', 'name_first',
|
||||
'name_last', 'username', 'root_admin',
|
||||
]));
|
||||
Alert::success('User account was successfully updated.')->flash();
|
||||
} catch (DisplayValidationException $ex) {
|
||||
return redirect()->route('admin.users.view', $id)->withErrors(json_decode($ex->getMessage()));
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
// Hacky fix for browsers ignoring autocomplete="off"
|
||||
$(document).ready(function() {
|
||||
$('.form-autocomplete-stop').on('click', function () {
|
||||
$(this).removeAttr('readonly').blur().focus();
|
||||
});
|
||||
});
|
|
@ -299,3 +299,8 @@ tr:hover + tr.server-description {
|
|||
bottom: 5px;
|
||||
right: 10px;
|
||||
}
|
||||
|
||||
input.form-autocomplete-stop[readonly] {
|
||||
background: inherit;
|
||||
cursor: text;
|
||||
}
|
||||
|
|
|
@ -44,25 +44,25 @@
|
|||
<div class="form-group">
|
||||
<label for="email" class="control-label">Email</label>
|
||||
<div>
|
||||
<input type="email" name="input_email" value="{{ $user->email }}" class="form-control">
|
||||
<input readonly type="email" name="email" value="{{ $user->email }}" class="form-control form-autocomplete-stop">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="registered" class="control-label">Username</label>
|
||||
<div>
|
||||
<input type="text" name="input_username" value="{{ $user->username }}" class="form-control">
|
||||
<input readonly type="text" name="username" value="{{ $user->username }}" class="form-control form-autocomplete-stop">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="registered" class="control-label">Client First Name</label>
|
||||
<div>
|
||||
<input type="text" name="name_first" value="{{ $user->name_first }}" class="form-control">
|
||||
<input readonly type="text" name="name_first" value="{{ $user->name_first }}" class="form-control form-autocomplete-stop">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="registered" class="control-label">Client Last Name</label>
|
||||
<div>
|
||||
<input type="text" name="name_last" value="{{ $user->name_last }}" class="form-control">
|
||||
<input readonly type="text" name="name_last" value="{{ $user->name_last }}" class="form-control form-autocomplete-stop">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -82,7 +82,7 @@
|
|||
<div class="form-group">
|
||||
<label for="password" class="control-label">Password</label>
|
||||
<div>
|
||||
<input type="password" id="password" name="input_password" class="form-control">
|
||||
<input readonly type="password" id="password" name="password" class="form-control form-autocomplete-stop">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -167,24 +167,3 @@
|
|||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@section('footer-scripts')
|
||||
@parent
|
||||
<script>$("#gen_pass_bttn").click(function (event) {
|
||||
event.preventDefault();
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: "/password-gen/12",
|
||||
headers: {
|
||||
'X-CSRF-TOKEN': '{{ csrf_token() }}'
|
||||
},
|
||||
success: function(data) {
|
||||
$("#gen_pass").html('You must click <em>Update Password</em> below for this password to be applied.<br /><br /><strong>Generated Password:</strong> ' + data).slideDown();
|
||||
$('input[name="password"], input[name="password_confirmation"]').val(data);
|
||||
return false;
|
||||
}
|
||||
});
|
||||
return false;
|
||||
});
|
||||
</script>
|
||||
@endsection
|
||||
|
|
|
@ -190,6 +190,7 @@
|
|||
{!! Theme::js('vendor/bootstrap-notify/bootstrap-notify.min.js') !!}
|
||||
{!! Theme::js('vendor/select2/select2.full.min.js') !!}
|
||||
{!! Theme::js('js/admin/functions.js') !!}
|
||||
{!! Theme::js('js/autocomplete.js') !!}
|
||||
@show
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -63,6 +63,7 @@
|
|||
</div>
|
||||
{!! Theme::js('vendor/jquery/jquery.min.js') !!}
|
||||
{!! Theme::js('vendor/bootstrap/bootstrap.min.js') !!}
|
||||
{!! Theme::js('js/autocomplete.js') !!}
|
||||
|
||||
@if(config('pterodactyl.lang.in_context')) {!! Theme::js('vendor/phraseapp/phraseapp.js') !!} @endif
|
||||
</body>
|
||||
|
|
|
@ -279,6 +279,7 @@
|
|||
{!! Theme::js('vendor/adminlte/app.min.js') !!}
|
||||
{!! Theme::js('vendor/socketio/socket.io.min.js') !!}
|
||||
{!! Theme::js('vendor/bootstrap-notify/bootstrap-notify.min.js') !!}
|
||||
{!! Theme::js('js/autocomplete.js') !!}
|
||||
@if(config('pterodactyl.lang.in_context'))
|
||||
{!! Theme::js('vendor/phraseapp/phraseapp.js') !!}
|
||||
@endif
|
||||
|
|
Loading…
Reference in New Issue