bug fix on otp, rearranged MNO display order
This commit is contained in:
@@ -3,10 +3,14 @@
|
||||
namespace App\Http\Controllers\Auth;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Foundation\Auth\AuthenticatesUsers;
|
||||
use App\Mail\LoginOtpMail;
|
||||
use App\Models\StaffMember;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
|
||||
class LoginController extends Controller
|
||||
{
|
||||
@@ -42,6 +46,7 @@ class LoginController extends Controller
|
||||
}
|
||||
public function authenticate(Request $request)
|
||||
{
|
||||
// dd('The custom method is running!');
|
||||
$request->validate([
|
||||
'email' => 'required|email',
|
||||
'password' => 'required',
|
||||
@@ -55,16 +60,14 @@ class LoginController extends Controller
|
||||
// 2. Generate 6-digit OTP
|
||||
$otp = rand(100000, 999999);
|
||||
|
||||
// 3. Save to database with 10-minute expiration
|
||||
$staff->update([
|
||||
'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));
|
||||
|
||||
// 5. Store staff ID in session
|
||||
session(['otp_staff_id' => $staff->id]);
|
||||
|
||||
return redirect()->route('otp.verify');
|
||||
|
||||
@@ -13,7 +13,7 @@ use Illuminate\Support\Facades\Config;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Illuminate\Support\Str;
|
||||
use Barryvdh\DomPDF\Facade\Pdf; // Ensure you have dompdf installed if exporting PDFs
|
||||
use Barryvdh\DomPDF\Facade\Pdf;
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -28,10 +28,12 @@ class NetworkOperatorsController extends Controller
|
||||
$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();
|
||||
$totalSipLinks = NetworkOperator::where('connection_type', 'like', '%VPN%')->count();
|
||||
|
||||
Reference in New Issue
Block a user