Enable user reseting password
Some checks failed
Create Docker Image / Build Docker Image (x86_64) (push) Failing after 24s
Create Docker Image / Build Docker Image (arm64) (push) Failing after 54s
Create Docker Image / Final Docker Image Manifest (push) Has been skipped

This commit is contained in:
Deon George 2024-04-25 15:44:06 +10:00
parent 527cc1d4ab
commit 6a41536d57
2 changed files with 8 additions and 1 deletions

View File

@ -5,6 +5,7 @@ namespace App\Http\Controllers;
use Illuminate\Auth\Events\Registered; use Illuminate\Auth\Events\Registered;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Facades\Validator; use Illuminate\Support\Facades\Validator;
use App\Http\Requests\UserRequest; use App\Http\Requests\UserRequest;
@ -23,13 +24,17 @@ class UserController extends Controller
if (! $o->exists) if (! $o->exists)
$o->password = base64_encode(random_bytes(20)); $o->password = base64_encode(random_bytes(20));
elseif ($request->password)
$o->password = Hash::make($request->password);
$o->save(); $o->save();
if ($o->wasRecentlyCreated) if ($o->wasRecentlyCreated)
event(new Registered($o)); event(new Registered($o));
return redirect()->to('user'); return redirect()
->to('user/addedit/'.$o->id)
->with('success','User Updated');
} }
return view('user.addedit') return view('user.addedit')

View File

@ -11,6 +11,8 @@
<div class="row"> <div class="row">
<div class="col-12"> <div class="col-12">
@includeWhen(session()->has('success'),'widgets.success-row',['msg'=>session()->get('success')])
<div class="greyframe titledbox shadow0xb0"> <div class="greyframe titledbox shadow0xb0">
<h2 class="cap">@if($o->exists) Update @else Add @endif User</h2> <h2 class="cap">@if($o->exists) Update @else Add @endif User</h2>