Password Changes from Admin User Edit (#33)
* Password Changes from Admin User Edit With this Commit Admins can change the user password from the admin user edit page * Admin Password Change: UI Changes
This commit is contained in:
parent
b0ab16ec3e
commit
5aba2c27bc
|
@ -13,6 +13,7 @@ use Illuminate\Http\RedirectResponse;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Http\Response;
|
use Illuminate\Http\Response;
|
||||||
use Illuminate\Support\Facades\Auth;
|
use Illuminate\Support\Facades\Auth;
|
||||||
|
use Illuminate\Support\Facades\Hash;
|
||||||
use Illuminate\Validation\Rule;
|
use Illuminate\Validation\Rule;
|
||||||
use Illuminate\Validation\ValidationException;
|
use Illuminate\Validation\ValidationException;
|
||||||
|
|
||||||
|
@ -101,6 +102,18 @@ class UserController extends Controller
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (!is_null($request->input('new_password'))) {
|
||||||
|
$request->validate([
|
||||||
|
'new_password' => 'required|string|min:8',
|
||||||
|
'new_password_confirmation' => 'required|same:new_password'
|
||||||
|
]);
|
||||||
|
|
||||||
|
$user->update([
|
||||||
|
'password' => Hash::make($request->input('new_password')),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
$user->update($request->all());
|
$user->update($request->all());
|
||||||
|
|
||||||
return redirect()->route('admin.users.index')->with('success', 'User updated!');
|
return redirect()->route('admin.users.index')->with('success', 'User updated!');
|
||||||
|
|
|
@ -12,7 +12,8 @@
|
||||||
<ol class="breadcrumb float-sm-right">
|
<ol class="breadcrumb float-sm-right">
|
||||||
<li class="breadcrumb-item"><a href="{{route('home')}}">Dashboard</a></li>
|
<li class="breadcrumb-item"><a href="{{route('home')}}">Dashboard</a></li>
|
||||||
<li class="breadcrumb-item"><a href="{{route('admin.users.index')}}">Users</a></li>
|
<li class="breadcrumb-item"><a href="{{route('admin.users.index')}}">Users</a></li>
|
||||||
<li class="breadcrumb-item"><a class="text-muted" href="{{route('admin.users.edit' , $user->id)}}">Edit</a></li>
|
<li class="breadcrumb-item"><a class="text-muted"
|
||||||
|
href="{{route('admin.users.edit' , $user->id)}}">Edit</a></li>
|
||||||
</ol>
|
</ol>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -44,7 +45,8 @@
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="email">Email</label>
|
<label for="email">Email</label>
|
||||||
<input value="{{$user->email}}" id="email" name="email" type="text"
|
<input value="{{$user->email}}" id="email" name="email" type="text"
|
||||||
class="form-control @error('email') is-invalid @enderror" required="required">
|
class="form-control @error('email') is-invalid @enderror"
|
||||||
|
required="required">
|
||||||
@error('email')
|
@error('email')
|
||||||
<div class="invalid-feedback">
|
<div class="invalid-feedback">
|
||||||
{{$message}}
|
{{$message}}
|
||||||
|
@ -53,8 +55,10 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="pterodactyl_id">Pterodactyl ID</label>
|
<label for="pterodactyl_id">Pterodactyl ID</label>
|
||||||
<input value="{{$user->pterodactyl_id}}" id="pterodactyl_id" name="pterodactyl_id" type="number"
|
<input value="{{$user->pterodactyl_id}}" id="pterodactyl_id" name="pterodactyl_id"
|
||||||
class="form-control @error('pterodactyl_id') is-invalid @enderror" required="required">
|
type="number"
|
||||||
|
class="form-control @error('pterodactyl_id') is-invalid @enderror"
|
||||||
|
required="required">
|
||||||
@error('pterodactyl_id')
|
@error('pterodactyl_id')
|
||||||
<div class="invalid-feedback">
|
<div class="invalid-feedback">
|
||||||
{{$message}}
|
{{$message}}
|
||||||
|
@ -67,8 +71,10 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="credits">Credits</label>
|
<label for="credits">Credits</label>
|
||||||
<input value="{{$user->credits}}" id="credits" name="credits" step="any" min="0" max="1000000"
|
<input value="{{$user->credits}}" id="credits" name="credits" step="any" min="0"
|
||||||
type="number" class="form-control @error('credits') is-invalid @enderror" required="required">
|
max="1000000"
|
||||||
|
type="number" class="form-control @error('credits') is-invalid @enderror"
|
||||||
|
required="required">
|
||||||
@error('credits')
|
@error('credits')
|
||||||
<div class="invalid-feedback">
|
<div class="invalid-feedback">
|
||||||
{{$message}}
|
{{$message}}
|
||||||
|
@ -77,8 +83,10 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="server_limit">Server Limit</label>
|
<label for="server_limit">Server Limit</label>
|
||||||
<input value="{{$user->server_limit}}" id="server_limit" name="server_limit" min="0" max="1000000"
|
<input value="{{$user->server_limit}}" id="server_limit" name="server_limit" min="0"
|
||||||
type="number" class="form-control @error('server_limit') is-invalid @enderror"
|
max="1000000"
|
||||||
|
type="number"
|
||||||
|
class="form-control @error('server_limit') is-invalid @enderror"
|
||||||
required="required">
|
required="required">
|
||||||
@error('server_limit')
|
@error('server_limit')
|
||||||
<div class="invalid-feedback">
|
<div class="invalid-feedback">
|
||||||
|
@ -89,15 +97,19 @@
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="role">Role</label>
|
<label for="role">Role</label>
|
||||||
<div>
|
<div>
|
||||||
<select id="role" name="role" class="custom-select @error('role') is-invalid @enderror"
|
<select id="role" name="role"
|
||||||
|
class="custom-select @error('role') is-invalid @enderror"
|
||||||
required="required">
|
required="required">
|
||||||
<option @if($user->role == 'admin') selected @endif class="text-danger" value="admin">
|
<option @if($user->role == 'admin') selected @endif class="text-danger"
|
||||||
|
value="admin">
|
||||||
Administrator
|
Administrator
|
||||||
</option>
|
</option>
|
||||||
<option @if($user->role == 'client') selected @endif class="text-success" value="client">
|
<option @if($user->role == 'client') selected @endif class="text-success"
|
||||||
|
value="client">
|
||||||
Client
|
Client
|
||||||
</option>
|
</option>
|
||||||
<option @if($user->role == 'member') selected @endif class="text-secondary" value="member">
|
<option @if($user->role == 'member') selected @endif class="text-secondary"
|
||||||
|
value="member">
|
||||||
Member
|
Member
|
||||||
</option>
|
</option>
|
||||||
</select>
|
</select>
|
||||||
|
@ -111,13 +123,46 @@
|
||||||
<div class="form-group text-right">
|
<div class="form-group text-right">
|
||||||
<button type="submit" class="btn btn-primary">Submit</button>
|
<button type="submit" class="btn btn-primary">Submit</button>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-6">
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-body">
|
||||||
|
<div class="col">
|
||||||
|
<div class="form-group"><label>New Password</label> <input
|
||||||
|
class="form-control @error('new_password') is-invalid @enderror"
|
||||||
|
name="new_password" type="password" placeholder="••••••">
|
||||||
|
|
||||||
|
@error('new_password')
|
||||||
|
<div class="invalid-feedback">
|
||||||
|
{{$message}}
|
||||||
|
</div>
|
||||||
|
@enderror
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col">
|
||||||
|
<div class="form-group"><label>Confirm Password</label>
|
||||||
|
<input
|
||||||
|
class="form-control @error('new_password_confirmation') is-invalid @enderror"
|
||||||
|
name="new_password_confirmation" type="password"
|
||||||
|
placeholder="••••••">
|
||||||
|
|
||||||
|
@error('new_password_confirmation')
|
||||||
|
<div class="invalid-feedback">
|
||||||
|
{{$message}}
|
||||||
|
</div>
|
||||||
|
@enderror
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
</section>
|
</section>
|
||||||
<!-- END CONTENT -->
|
<!-- END CONTENT -->
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue