Package io.github.sigmacasino.routes
Class LoginPost
java.lang.Object
io.github.sigmacasino.HTTPRoute
io.github.sigmacasino.PostRoute
io.github.sigmacasino.routes.LoginPost
- All Implemented Interfaces:
spark.Route
The LoginPost class handles the POST request for processing the login form submission.
-
Field Summary
FieldsFields inherited from class io.github.sigmacasino.HTTPRoute
app, loginRequired, path
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
handlePost
(spark.Request request, spark.Response response) Handles the POST request for the login form submission.Methods inherited from class io.github.sigmacasino.PostRoute
handle, parseBodyParams, registerSparkRoute
-
Field Details
-
logger
private org.slf4j.Logger loggerThe logger for this class.
-
-
Constructor Details
-
LoginPost
Constructs a LoginPost route with the specified application.- Parameters:
app
- the application instance
-
-
Method Details
-
handlePost
Handles the POST request for the login form submission. This method checks the user's credentials and logs them in if they are valid. If the user's credentials are invalid, the user is redirected back to the login page with an error message. If the credentials are valid, the session is updated with the user's identifier and username attributes.- Specified by:
handlePost
in classPostRoute
- Parameters:
request
- the HTTP requestresponse
- the HTTP response- Throws:
SQLException
- if an SQL error occurs
-