npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@webhandle/login

v1.0.0

Published

Simple tools to handle user login and logout.

Readme

@webhandle/login

Simple tools to handle user login and logout.

Install

npm install @webhandle/login

Usage

import setupLogin from "@webhandle/login/initialize-webhandle-component.mjs"
let loginManager = await setupLogin(webhandle)

Configuration

Configuration works like:

{
	"@webhandle/login": {

		"loginPostUrl": "/login"
		, "logoutUrl": "/logout"
		, "afterLogoutUrl": "/login"
		, "accessErrorUrl": "/login"
		, "postLoginDest": {
			"administrators": "/admin/menu-administrators"
		}
		, "accessAllowed": {
			"/admin/menu-administrators": ["administrators"]
		}
		, "forceLowerCaseUsernames": true
		, "setupUserErrorHandlers": true
	}
}

loginPostUrl : This is where login forms should submit the username and password

logoutUrl : This URL will cause the user to be logged out

afterLogoutUrl : This is where the user is redirected after logout

accessErrorUrl : Where to direct the user if the user is not signed in or lacks permissions.

forceLowerCaseUsernames : Will make all usernames lower case before trying to login. This is necessary for any site which allows non-admin user to sign in, especially if they're using email addresses as usernames.

setupUserErrorHandlers : If true it will watch for the Errors from @webhandle/users-data/errors and create an error message and redirect. This will be reasonable behavior by default, but may not be complex enough in a full application.

postLoginDest : Determines where users will be directed after successful login

accessAllowed : If this is defined, it will set up authorization requirements for these endpoints.

postLoginHandler, userMenuAuthorization, and errorHandler are the functions which will actually be used to perform the lifecycle tasks. They can't be set in the config file, but can be set after the component is loaded like

loginManager.config.postLoginHandler = (req, res, next) ...

Available Data

res.locals['@webhandle/login'] = {
	loginPostUrl
	, logoutUrl
}

loginPostUrl : the URL that the login form should POST to

logoutURL : the URL which either GET or POST will log out the user

Login Form

Really, you can use any form you want. However, if you want to start out with something simple you can use

__::@webhandle/login/login-form__

It will include all of its needed css dependencies via the external resources manager.

Error Messages

The code will add flash messages to indicate what went wrong if something went wrong.