Added manual E-Mail verification

Admins are now able to verify users emails manually from the Admin Panel.
This commit is contained in:
Julian Prieber 2022-07-11 14:51:24 +02:00
parent a8b0893aae
commit ffcab1c8ec
3 changed files with 24 additions and 4 deletions

View File

@ -38,19 +38,19 @@ class AdminController extends Controller
switch($usersType){
case 'all':
$data['users'] = User::select('id', 'name', 'littlelink_name', 'role', 'block')->get();
$data['users'] = User::select('id', 'name', 'littlelink_name', 'role', 'block', 'email_verified_at')->get();
return view('panel/users', $data);
break;
case 'user':
$data['users'] = User::where('role', 'user')->select('id', 'name', 'littlelink_name', 'role', 'block')->get();
$data['users'] = User::where('role', 'user')->select('id', 'name', 'littlelink_name', 'role', 'block', 'email_verified_at')->get();
return view('panel/users', $data);
break;
case 'vip':
$data['users'] = User::where('role', 'vip')->select('id', 'name', 'littlelink_name', 'role', 'block')->get();
$data['users'] = User::where('role', 'vip')->select('id', 'name', 'littlelink_name', 'role', 'block', 'email_verified_at')->get();
return view('panel/users', $data);
break;
case 'admin':
$data['users'] = User::where('role', 'admin')->select('id', 'name', 'littlelink_name', 'role', 'block')->get();
$data['users'] = User::where('role', 'admin')->select('id', 'name', 'littlelink_name', 'role', 'block', 'email_verified_at')->get();
return view('panel/users', $data);
break;
}
@ -83,6 +83,23 @@ class AdminController extends Controller
return redirect('panel/users/all');
}
//Verify or un-verify users emails
public function verifyUser(request $request)
{
$id = $request->id;
$status = $request->verify;
if($status == '-'){
$verify = '0000-00-00 00:00:00';
}else{
$verify = NULL;
}
User::where('id', $id)->update(['email_verified_at' => $verify]);
return redirect('panel/users/all');
}
//Show user to edit
public function showUser(request $request)
{

View File

@ -25,6 +25,7 @@
<th scope="col">Role</th>
<th scope="col">Edit</th>
<th scope="col">Links</th>
@if(env('REGISTER_AUTH') !== 'auth')<th style="width:10%" scope="col">E-Mail Verified</th>@endif
<th scope="col">Block</th>
</tr>
</thead>
@ -36,6 +37,7 @@
<td>{{ $user->role }}</td>
<td><a href="{{ route('editUser', $user->id ) }}">Edit</a></td>
<td><a href="{{ route('showLinksUser', $user->id ) }}" class="text-primary">View</a></td>
@if(env('REGISTER_AUTH') !== 'auth')<td><a href="{{ route('verifyUser', ['verify' => '-' . $user->email_verified_at, 'id' => $user->id] ) }}" class="text-danger">@if($user->email_verified_at == '')<span>no</span>@else<span style="color:#228B22">yes</span>@endif</a></td>@endif
<td><a href="{{ route('blockUser', ['block' => $user->block, 'id' => $user->id] ) }}" class="text-danger">{{ $user->block }}</a></td>
</tr>
@endforeach

View File

@ -98,6 +98,7 @@ Route::post('/panel/users/{name?}', [AdminController::class, 'searchUser'])->nam
Route::get('/panel/links/{id}', [AdminController::class, 'showLinksUser'])->name('showLinksUser');
Route::get('/panel/deleteLink/{id}', [AdminController::class, 'deleteLinkUser'])->name('deleteLinkUser');
Route::get('/panel/users/block/{block}/{id}', [AdminController::class, 'blockUser'])->name('blockUser');
Route::get('/panel/users/verify/-{verify}/{id}', [AdminController::class, 'verifyUser'])->name('verifyUser');
Route::get('/panel/edit-user/{id}', [AdminController::class, 'showUser'])->name('showUser');
Route::post('/panel/edit-user/{id}', [AdminController::class, 'editUser'])->name('editUser');
Route::get('/panel/pages', [AdminController::class, 'showSitePage'])->name('showSitePage');