mirror of
https://github.com/LinkStackOrg/LinkStack.git
synced 2025-01-10 09:14:36 +01:00
cf66be63cb
Fixed bug where if a user was edited on the Admin Panel under 'Admin>Users> Edit User' changes would not apply without every value being changed. This bug originates from LittleLink Admin (the fork of which this fork is based on). One part of this issue was that most fields were required to fill in. If only one would be left, empty, none would apply. The problem was if this requirement was removed, the password would always overwrite the current password, even when left empty. This meant you could only edit users if you knew their password, otherwise their passwords would be changed, probably preventing that user from login in ever again. After some experimenting, I implemented the easiest fix I could come up with. A simple if-else statement that checks if the password field is empty and if so only saves the other parameters without touching the password. If the password is changed, the changes will be applied normally. Also fixed the profile image size for the default placeholder image.
69 lines
3.2 KiB
PHP
Executable File
69 lines
3.2 KiB
PHP
Executable File
@extends('layouts.sidebar')
|
|
|
|
@section('content')
|
|
|
|
<h2 class="mb-4"><i class="bi bi-person"> Edit User</i></h2>
|
|
@foreach($user as $user)
|
|
<form action="{{ route('editUser', $user->id) }}" enctype="multipart/form-data" method="post">
|
|
@csrf
|
|
<div class="form-group col-lg-8">
|
|
<label>Name</label>
|
|
<input type="text" class="form-control" name="name" value="{{ $user->name }}">
|
|
</div>
|
|
<div class="form-group col-lg-8">
|
|
<label>Email</label>
|
|
<input type="email" class="form-control" name="email" value="{{ $user->email }}">
|
|
</div>
|
|
<div class="form-group col-lg-8">
|
|
<label>Password</label>
|
|
<input type="password" class="form-control" name="password" placeholder="Leave empty for no change">
|
|
</div>
|
|
|
|
<div class="form-group col-lg-8">
|
|
<label>Logo</label>
|
|
<input type="file" class="form-control-file" name="image">
|
|
</div>
|
|
|
|
<div class="form-group col-lg-8">
|
|
@if(file_exists(base_path("img/$user->littlelink_name" . ".png" )))
|
|
<img src="{{ asset("img/$user->littlelink_name" . ".png") }}" srcset="{{ asset("img/$user->littlelink_name" . "@2x.png 2x") }}" width="100px" height="100px">
|
|
@elseif(file_exists(base_path("littlelink/images/avatar.png" )))
|
|
<img class="rounded-avatar" src="{{ asset('littlelink/images/avatar.png') }}" srcset="{{ asset('littlelink/images/avatar@2x.png 2x') }}" width="100px" height="100px">
|
|
@else
|
|
<img src="{{ asset('littlelink/images/logo.svg') }}" srcset="{{ asset('littlelink/images/avatar@2x.png 2x') }}" width="100px" height="100px">
|
|
@endif
|
|
</div>
|
|
|
|
<!--<div class="form-group col-lg-8">
|
|
<label>Littlelink name </label>
|
|
<input type="text" class="form-control" name="littlelink_name" value="{{ $user->littlelink_name }}">
|
|
</div>-->
|
|
|
|
<div class="form-group col-lg-8">
|
|
<label>Page URL</label>
|
|
<div class="input-group">
|
|
<div class="input-group-prepend">
|
|
<div class="input-group-text">{{ url('') }}/@</div>
|
|
</div>
|
|
<input type="text" class="form-control" name="littlelink_name" value="{{ $user->littlelink_name }}">
|
|
</div>
|
|
</div>
|
|
|
|
<div class="form-group col-lg-8">
|
|
<label> Page description</label>
|
|
<textarea class="form-control" name="littlelink_description" rows="3">{{ $user->littlelink_description }}</textarea>
|
|
</div>
|
|
<div class="form-group col-lg-8">
|
|
<label for="exampleFormControlSelect1">Role</label>
|
|
<select class="form-control" name="role">
|
|
<option <?= ($user->role === strtolower('user')) ? 'selected' : '' ?>>user</option>
|
|
<option <?= ($user->role === strtolower('vip')) ? 'selected' : '' ?>>vip</option>
|
|
<option <?= ($user->role === strtolower('admin')) ? 'selected' : '' ?>>admin</option>
|
|
</select>
|
|
</div>
|
|
@endforeach
|
|
<button type="submit" class="mt-3 ml-3 btn btn-info">Submit</button>
|
|
</form>
|
|
|
|
@endsection
|