Hagglehaul  1.0
Hagglehaul - book and bid on rides
Loading...
Searching...
No Matches
hagglehaul.Server.Controllers.AuthenticationController Class Reference

Controller for authentication, registration, and role management. More...

Inheritance diagram for hagglehaul.Server.Controllers.AuthenticationController:

Public Member Functions

 AuthenticationController (IOptions< JwtSettings > settings, IUserCoreService userCoreService, IRiderProfileService riderProfileService, IDriverProfileService driverProfileService)
 
async Task< IActionResult > Register ([FromBody] Register model)
 Creates a new user and stores their information in the database.
 
async Task< IActionResult > Login ([FromBody] Login model)
 Logs in as an existing user.
 
async Task< String > Role ()
 Get the role of the current user.
 

Detailed Description

Controller for authentication, registration, and role management.

Member Function Documentation

◆ Login()

async Task< IActionResult > hagglehaul.Server.Controllers.AuthenticationController.Login ( [FromBody] Login model)

Logs in as an existing user.

Parameters
modelThe login form
Returns
OkObjectResult if the user is logged in successfully, BadRequestObjectResult if one or more fields are empty, UnauthorizedResult if invalid email or password

◆ Register()

async Task< IActionResult > hagglehaul.Server.Controllers.AuthenticationController.Register ( [FromBody] Register model)

Creates a new user and stores their information in the database.

Parameters
modelThe registration form
Returns
OkObjectResult if the user is registered successfully, BadRequestObjectResult if one or more fields are empty, the user already exists, or invalid role

◆ Role()

async Task< String > hagglehaul.Server.Controllers.AuthenticationController.Role ( )

Get the role of the current user.

Returns
String representing the role of the current user, either "driver" or "rider".

The documentation for this class was generated from the following file: