# new LoginHandler()
This class extends the EventHandler to provide specific handling for login events. It validates the presence of username and password in the event data.
Handler for login events
Example
const loginHandler = new LoginHandler();
const event = {
data: { username: 'user', password: 'pass' }
};
const isValid = await loginHandler.handle(event);
console.log(isValid); // true
Methods
# async handle(event) → {Promise.<boolean>}
This method extracts the username and password from the event data and checks if both are truthy values. It returns true if both username and password are present, false otherwise.
Handles the login event
Parameters:
| Name | Type | Description |
|---|---|---|
event |
ICrudFormEvent
|
The event object containing login data |
A promise that resolves to true if login is valid, false otherwise
Promise.<boolean>