tiny-essentials
Version:
Collection of small, essential scripts designed to be used across various projects. These simple utilities are crafted for speed, ease of use, and versatility.
22 lines • 1.28 kB
text/typescript
/**
* Handles the login process by checking the configuration, generating authentication URLs, and redirecting the user to the appropriate destination.
* Depending on the configuration type, it handles various authentication methods like login, login_command, and webhook.
*
* @function
* @param {Record<string, any>} req - The request object, typically provided by the web framework (e.g., Express).
* @param {Record<string, any>} res - The response object, typically provided by the web framework (e.g., Express).
* @param {Record<string, any>} cfg - The configuration object that includes various settings for the login process.
* @param {boolean} existSession - A flag indicating whether the user already has an active session.
*
* @returns {void} This function does not return anything. It sends a redirect response to the user based on the configuration.
*
* @throws {Error} If any validation or configuration fails, an error response will be sent.
*
* @example
* // Example usage with Express:
* app.get('/login', (req, res) => {
* login(req, res, config, sessionExists);
* });
*/
export default function login(req: Record<string, any>, res: Record<string, any>, cfg: Record<string, any>, existSession: boolean): void;
//# sourceMappingURL=login.d.mts.map