bug fix on otp, rearranged MNO display order

This commit is contained in:
Kwesi Banson Jnr
2026-08-27 10:17:12 +00:00
parent ff66dbbabe
commit 27c2a8ac80
5 changed files with 19 additions and 10 deletions

View File

@@ -3,10 +3,14 @@
namespace App\Http\Controllers\Auth; namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller; use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use Illuminate\Foundation\Auth\AuthenticatesUsers; use Illuminate\Foundation\Auth\AuthenticatesUsers;
use App\Mail\LoginOtpMail; use App\Mail\LoginOtpMail;
use App\Models\StaffMember;
use Illuminate\Support\Facades\Hash; use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Facades\Mail; use Illuminate\Support\Facades\Mail;
use Illuminate\Support\Facades\Log;
class LoginController extends Controller class LoginController extends Controller
{ {
@@ -42,6 +46,7 @@ class LoginController extends Controller
} }
public function authenticate(Request $request) public function authenticate(Request $request)
{ {
// dd('The custom method is running!');
$request->validate([ $request->validate([
'email' => 'required|email', 'email' => 'required|email',
'password' => 'required', 'password' => 'required',
@@ -55,16 +60,14 @@ class LoginController extends Controller
// 2. Generate 6-digit OTP // 2. Generate 6-digit OTP
$otp = rand(100000, 999999); $otp = rand(100000, 999999);
// 3. Save to database with 10-minute expiration
$staff->update([ $staff->update([
'otp_code' => $otp, 'otp_code' => $otp,
'otp_expires_at' => now()->addMinutes(10) 'otp_expires_at' => now()->addMinutes(3)
]); ]);
\Log::info($otp);
// 4. Send Email
Mail::to($staff->email)->send(new LoginOtpMail($otp)); Mail::to($staff->email)->send(new LoginOtpMail($otp));
// 5. Store staff ID in session
session(['otp_staff_id' => $staff->id]); session(['otp_staff_id' => $staff->id]);
return redirect()->route('otp.verify'); return redirect()->route('otp.verify');

View File

@@ -13,7 +13,7 @@ use Illuminate\Support\Facades\Config;
use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Storage; use Illuminate\Support\Facades\Storage;
use Illuminate\Support\Str; use Illuminate\Support\Str;
use Barryvdh\DomPDF\Facade\Pdf; // Ensure you have dompdf installed if exporting PDFs use Barryvdh\DomPDF\Facade\Pdf;

View File

@@ -28,10 +28,12 @@ class NetworkOperatorsController extends Controller
$query->where('connection_status', 'like', "%{$request->input('connection_status')}%"); $query->where('connection_status', 'like', "%{$request->input('connection_status')}%");
} }
// Paginate instead of getting all records at once (e.g., 10 per page) // $operators = $query->latest('id')->paginate(10)->withQueryString();
$operators = $query->latest('id')->paginate(10)->withQueryString(); $operators = $query->orderBy('country', 'asc')
->orderBy('name', 'asc')
->paginate(10)
->withQueryString();
// dd($operators);
$totalActive = NetworkOperator::where('connection_status', 'Active')->count(); $totalActive = NetworkOperator::where('connection_status', 'Active')->count();
$totalSipLinks = NetworkOperator::where('connection_type', 'like', '%VPN%')->count(); $totalSipLinks = NetworkOperator::where('connection_type', 'like', '%VPN%')->count();

View File

@@ -78,8 +78,8 @@
<table class="table table-custom table-hover mb-0"> <table class="table table-custom table-hover mb-0">
<thead> <thead>
<tr> <tr>
<th>Operator</th>
<th>Country</th> <th>Country</th>
<th>Operator</th>
<th>Connection Type</th> <th>Connection Type</th>
<th>Services</th> <th>Services</th>
<th>Status</th> <th>Status</th>
@@ -89,6 +89,7 @@
<tbody> <tbody>
@forelse($operators as $operator) @forelse($operators as $operator)
<tr> <tr>
<td><span class="fw-semibold">{{ $operator->country }}</span></td>
<td> <td>
<div class="d-flex align-items-center"> <div class="d-flex align-items-center">
<div class="avatar-circle bg-primary bg-opacity-10 text-primary me-3"> <div class="avatar-circle bg-primary bg-opacity-10 text-primary me-3">
@@ -100,7 +101,7 @@
</div> </div>
</div> </div>
</td> </td>
<td><span class="fw-semibold">{{ $operator->country }}</span></td>
<td> <td>
<div class="text-dark fw-semibold" style="font-size: 0.85rem;"><i class="bi bi-shield-lock me-1 text-primary"></i> {{ $operator->connection_type ?? 'N/A' }}</div> <div class="text-dark fw-semibold" style="font-size: 0.85rem;"><i class="bi bi-shield-lock me-1 text-primary"></i> {{ $operator->connection_type ?? 'N/A' }}</div>
</td> </td>

View File

@@ -12,6 +12,9 @@ Route::get('test', function () {
Auth::routes([ Auth::routes([
'register' => false, 'register' => false,
]); ]);
// If your method is in LoginController
Route::post('/login', [App\Http\Controllers\Auth\LoginController::class, 'authenticate'])->name('login.post');
Route::get('/verify-otp', [App\Http\Controllers\OtpController::class, 'show'])->name('otp.verify'); Route::get('/verify-otp', [App\Http\Controllers\OtpController::class, 'show'])->name('otp.verify');
Route::post('/verify-otp', [App\Http\Controllers\OtpController::class, 'verify'])->name('otp.verify.post'); Route::post('/verify-otp', [App\Http\Controllers\OtpController::class, 'verify'])->name('otp.verify.post');
Route::post('/resend-otp', [App\Http\Controllers\OtpController::class, 'resend'])->name('otp.resend'); Route::post('/resend-otp', [App\Http\Controllers\OtpController::class, 'resend'])->name('otp.resend');