Enable user reseting password
This commit is contained in:
parent
527cc1d4ab
commit
6a41536d57
@ -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')
|
||||||
|
@ -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>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user