Airport Guide Documentation

AuthenticationController extends BaseController
in package

Table of Contents

Methods

__construct()  : mixed
completeRegistration()  : void
This function is used to display Google 2FA password setup page for user registration.
forgotpassword()  : string
This function is used to display the forgot password page with authentication state management.
getContentBlank()  : stdClass
This function is used to generate metadata content using panel configuration constants.
getContentForgotPassword()  : stdClass
This function is used to generate metadata content for the forgot password page.
getContentLogin()  : stdClass
This function is used to generate metadata content for the login page.
getUser()  : User|string
This function is used to validate user credentials and return user object or error response.
loginCheck()  : bool|string
This function is used to validate user login credentials and handle two-factor authentication.
loginPage()  : string
This function is used to display the login page with authentication state management.
loginSubmit()  : RedirectResponse|string
This function is used to process user login authentication with reCAPTCHA validation.
newPassword()  : JsonResponse
This function is used to update user password with validation and token regeneration.
otpSumbit()  : JsonResponse
This function is used to validate OTP for password reset verification.
resetPasswordConfirmUser()  : RedirectResponse
This function is used to process password reset confirmation via activation link.
resetPasswordUser()  : JsonResponse
This function is used to process password reset request and send OTP via email.
scanGenerate()  : RedirectResponse
This function is used to process Google 2FA QR code verification and complete authentication setup.
setCookie()  : array<string|int, mixed>
This function is used to set authentication cookie for QR code-based two-factor authentication.
signOut()  : RedirectResponse
This function is used to logout user and clear all authentication data.

Methods

completeRegistration()

This function is used to display Google 2FA password setup page for user registration.

public completeRegistration(Request $request) : void

This method renders the Google 2FA password setup interface where users can complete their two-factor authentication registration. It passes the user's password, username, and authentication token to the view for the QR code generation process.

Parameters
$request : Request

The HTTP request instance

Tags
see
Request::get()

To retrieve user registration data

uses
view()

For rendering the Google 2FA password setup template

Return values
void

Renders the Google 2FA password setup view and terminates execution

forgotpassword()

This function is used to display the forgot password page with authentication state management.

public forgotpassword(Request $request) : string

This method handles the forgot password page display with comprehensive authentication checks similar to the login page. It validates existing sessions, checks remember-me cookies, processes authentication errors, retrieves global settings and menu data, and renders the forgot password page with appropriate content and styling.

Parameters
$request : Request

The HTTP request instance

Tags
uses
Store::all()

To retrieve session data

uses
Redirector::to()

To redirect authenticated users to dashboard

uses
Cookie::get()

To retrieve remember-me cookie data

uses
User

Model to validate remember-me tokens

uses
GlobalSetting

Model to retrieve global settings

uses
Menu

Model to retrieve navigation menu data

uses
view()

For rendering the forgot password template

Return values
string

The rendered HTML content for the forgot password page

getContentBlank()

This function is used to generate metadata content using panel configuration constants.

public getContentBlank() : stdClass

This method creates a standardized metadata object containing SEO-friendly information using the panel name from configuration constants. It retrieves the panel name from config and sets all metadata properties to this value for consistent branding across the application.

Tags
uses
config()

To retrieve the panel name from configuration constants

Return values
stdClass

Object containing panel metadata with properties: meta_description, page_title, meta_title, meta_keywords

getContentForgotPassword()

This function is used to generate metadata content for the forgot password page.

public getContentForgotPassword() : stdClass

This method creates a standardized metadata object containing SEO-friendly information for the forgot password page, including meta description, page title, meta title, and meta keywords. All values are set to 'Forgot Password' for consistency.

Return values
stdClass

Object containing forgot password page metadata with properties: meta_description, page_title, meta_title, meta_keywords

getContentLogin()

This function is used to generate metadata content for the login page.

public getContentLogin() : stdClass

This method creates a standardized metadata object containing SEO-friendly information for the login page, including meta description, page title, meta title, and meta keywords. All values are set to 'Login' for consistency.

Return values
stdClass

Object containing login page metadata with properties: meta_description, page_title, meta_title, meta_keywords

getUser()

This function is used to validate user credentials and return user object or error response.

public getUser(string $email, string $password, Request $request) : User|string

This method performs user authentication by checking email existence and password verification using Laravel's Hash facade. It returns the user object on successful authentication or redirects to login page with error messages for security purposes (not revealing which credential failed).

Parameters
$email : string

The user's email address

$password : string

The user's password

$request : Request

The HTTP request instance

Tags
uses
User

Model to query user by email

uses
Hash::check()

To verify password against hashed value

uses
loginPage()

To return to login page with error messages

Return values
User|string

Returns user object on success or login page on failure

loginCheck()

This function is used to validate user login credentials and handle two-factor authentication.

public loginCheck(Request $request, string $username, string $password) : bool|string

This method performs comprehensive user authentication including credential validation, two-factor authentication checks, session token management, and remember-me functionality. It handles various 2FA scenarios including Google Authenticator, force 2FA requirements, and cookie-based authentication.

Parameters
$request : Request

The HTTP request instance

$username : string

The user's email or username

$password : string

The user's password

Tags
uses
User

Model to query user credentials and 2FA settings

uses
getUser()

To validate user credentials

uses
updateCookie()

To handle remember-me functionality

uses
generateToken()

To create session tokens

uses
Cookie::get()

To retrieve authentication cookies

uses
createAdminLogs()

To log authentication attempts

uses
loginPage()

To return to login page with error messages

Return values
bool|string

Returns true on successful authentication or login page on failure

loginPage()

This function is used to display the login page with authentication state management.

public loginPage(Request $request) : string

This method handles the login page display with comprehensive authentication checks. It checks for existing user sessions, validates remember-me cookies, processes authentication errors and reCAPTCHA errors, retrieves global settings and menu data, and renders the login page with appropriate content and styling.

Parameters
$request : Request

The HTTP request instance

Tags
uses
Store::all()

To retrieve session data

uses
Redirector::to()

To redirect authenticated users to dashboard

uses
Cookie::get()

To retrieve remember-me cookie data

uses
User

Model to validate remember-me tokens

uses
GlobalSetting

Model to retrieve global settings

uses
Menu

Model to retrieve navigation menu data

uses
view()

For rendering the login template

Return values
string

The rendered HTML content for the login page

loginSubmit()

This function is used to process user login authentication with reCAPTCHA validation.

public loginSubmit(Request $request) : RedirectResponse|string

This method handles the login form submission with comprehensive validation. It validates reCAPTCHA response, processes login credentials, performs authentication checks, logs successful login activities, and redirects authenticated users to the dashboard or returns to login page with errors.

Parameters
$request : Request

The HTTP request instance

Tags
see
Request::get()

To retrieve reCAPTCHA response and login credentials

see
Request::validate()

To validate form input with custom rules

uses
Recaptcha

Rule to validate reCAPTCHA response

uses
loginCheck()

To verify user credentials

uses
createAdminLogs()

To log successful login activities

uses
Redirector::to()

To redirect authenticated users to dashboard

uses
loginPage()

To return to login page with error messages

Return values
RedirectResponse|string

Either redirects to dashboard or returns login page with errors

newPassword()

This function is used to update user password with validation and token regeneration.

public newPassword(Request $request) : JsonResponse

This method handles the final step of the password reset process by validating the new password and confirmation, hashing the password securely, updating the user record, and regenerating the session token for security purposes.

Parameters
$request : Request

The HTTP request instance

Tags
see
Request::validate()

To validate password and confirmation

uses
User

Model to retrieve and update user password

uses
Hash::make()

To securely hash the new password

uses
generateToken()

To create new session token

uses
Response::json()

To return JSON responses

Return values
JsonResponse

JSON response indicating password update success or failure

otpSumbit()

This function is used to validate OTP for password reset verification.

public otpSumbit(Request $request) : JsonResponse

This method verifies the one-time password (OTP) entered by the user during the password reset process. It validates the OTP against the stored verification records and returns appropriate success or error responses for the password reset flow.

Parameters
$request : Request

The HTTP request instance

Tags
see
Request::validate()

To validate OTP and email input

uses
EmailVerification

Model to verify OTP against stored records

uses
Response::json()

To return JSON responses

Return values
JsonResponse

JSON response indicating OTP validation success or failure

resetPasswordConfirmUser()

This function is used to process password reset confirmation via activation link.

public resetPasswordConfirmUser([string|null $activation_id = null ][, string|null $email = null ], Request $request) : RedirectResponse

This method handles password reset confirmation through activation links sent via email. It validates the activation ID and email parameters, processes the reset request, and manages the password reset flow with proper error handling and security measures.

Parameters
$activation_id : string|null = null

The unique activation identifier from reset link

$email : string|null = null

The user's email address from reset link

$request : Request

The HTTP request instance

Tags
uses
Store::all()

To manage session data and flash messages

uses
urldecode()

To decode URL-encoded email parameter

uses
PasswordReset

Model to validate activation data

uses
Redirector::to()

To redirect with appropriate messages

uses
config()

To retrieve application configuration

Return values
RedirectResponse

Redirects to appropriate page based on validation

resetPasswordUser()

This function is used to process password reset request and send OTP via email.

public resetPasswordUser(Request $request) : JsonResponse

This method handles the password reset process by validating the user's email, generating a secure OTP, creating password reset records, checking email verification limits, and sending the OTP via email with personalized content. It includes rate limiting to prevent abuse and comprehensive error handling.

Parameters
$request : Request

The HTTP request instance

Tags
see
Request::validate()

To validate email input

uses
User

Model to verify email existence

uses
PasswordReset

Model to create reset records

uses
EmailVerification

Model to track OTP attempts

uses
MailDetail

Model to retrieve email templates

uses
Mail::to()

To send password reset emails

uses
DemoMail

To format and send email content

uses
Response::json()

To return JSON responses

throws
Exception

When email sending fails

Return values
JsonResponse

JSON response indicating success or specific error

scanGenerate()

This function is used to process Google 2FA QR code verification and complete authentication setup.

public scanGenerate(Request $request) : RedirectResponse

This method handles the verification of one-time passwords from Google Authenticator during the two-factor authentication setup process. It validates the OTP against the user's secret key, sets authentication cookies, updates user records, and redirects to dashboard upon successful verification or back with errors on failure.

Parameters
$request : Request

The HTTP request instance

Tags
see
Request::get()

To retrieve OTP and authentication data

see
Redirector::back()

To redirect back with error messages

uses
Google2FA

To verify one-time passwords

uses
User

Model to retrieve and update user authentication data

uses
setCookie()

To set authentication cookies

uses
updateSession()

To establish user session

uses
Redirector::to()

To redirect to dashboard on success

Return values
RedirectResponse

Redirects to dashboard on success or back with errors

setCookie()

This function is used to set authentication cookie for QR code-based two-factor authentication.

public setCookie(string $user_password, Request $request) : array<string|int, mixed>

This method creates a secure authentication cookie for users during the QR code setup process for two-factor authentication. The cookie is set with a 7-hour expiration time and contains the user's authentication token.

Parameters
$user_password : string

The user's authentication token

$request : Request

The HTTP request instance

Tags
uses
Cookie::queue()

To set the authentication cookie with expiration

Return values
array<string|int, mixed>

Array containing the user cookie value for database storage

signOut()

This function is used to logout user and clear all authentication data.

public signOut(Request $request) : RedirectResponse

This method performs a comprehensive logout by invalidating the user's authentication session, regenerating session tokens for security, clearing remember-me cookies, and redirecting to the login page with a success message.

Parameters
$request : Request

The HTTP request instance

Tags
uses
Auth::logout()

To invalidate user authentication

uses
setcookie()

To clear remember-me cookie

uses
Redirect()

To redirect to login page with message

see
Store::invalidate()

To clear session data

see
Store::regenerateToken()

To regenerate CSRF token

Return values
RedirectResponse

Redirects to login page with success message


        
On this page

Search results