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 🙏

© 2024 – Pkg Stats / Ryan Hefner

vt-password-picker

v2.0.4

Published

Vue.js component that helps pick a strong Virginia Tech PID password.

Downloads

12

Readme

VT Password Picker

A Vue.js 3.x component for choosing strong passwords for Virginia Tech electronic accounts (PID, Hokies, Oracle, etc). Check out the live demo. Note the demo requires being on the VT network, i.e. on campus or VPN.

Quick Start

Register the component

  1. Install the component: npm install vt-password-picker
  2. Install bootstrap dependency: npm install bootstrap
  3. Import the component and dependencies
  4. Register the component with the Vue instance

The following snippet demonstrates the steps above for the typcial case of using the component in a view:

import 'bootstrap/dist/css/bootstrap.min.css';
import PasswordPicker from 'vt-password-picker';

export default {
  name: 'PasswordView',
  components: {
    PasswordPicker,
  },
  data() {
    return {};
  },
};

Embed the component in a view

Component properties can be declared using either camel case or kebab case, e.g. userId and user-id are equivalent.

<password-picker password-type="PID"
                 user-id="nobody"
                 tier="prod"
                 v-bind:error-threshold="5"
                 v-bind:timeout="2000"
                 v-on:verified="onVerified"
                 v-on:unverified="onUnverified"
                 v-on:cleared="onCleared"
                 v-on:error="onError"></password-picker>

Note that the onX handler functions need to be defined separately; see the following section for details.

Define event handler methods

The event handler methods are the integration point between the component and the containing application. The following code snippet demonstrates how to configure event handlers on the application's Vue instance.

new Vue({
  el: '#app',
  methods: {
    onVerified (password) {
      var status = document.getElementById('status');
      status.innerHTML = 'You successfully chose the following password: <em>' + password + '</em>';
      status.style.visibility = 'visible';
    },
    onUnverified () {
      var status = document.getElementById('status');
      status.innerHTML = 'Passwords do not match';
      status.style.visibility = 'visible';
    },
    onCleared () {
      var status = document.getElementById('status');
      status.innerHTML = '';
      status.style.visibility = 'hidden';
    },
    onError () {
      window.alert('Error communicating with back-end REST Web service');
    }
  }
});

Component Reference

Properties

Properties allow for configuring the behavior of the component.

passwordType

The following password types are supported:

  1. AD - Hokies Active Directory
  2. BANNER - Banner Oracle account
  3. ORACLE - Generic Oracle account
  4. PID - Primary VT electronic account

userId

The userId property provides for user ID checking in the password and if desired should be configured programmatically based on the identity of the current authenticated user. Set to an invalid username to disable this kind of check (not recommended).

tier

A REST API backs all password validation calls and this property can be used to point to a different tier other than the default prod tier. Supported values: dev, pprd, prod.

timeout

Number of milliseconds to wait for REST API validation calls to timeout. Defaults to 2000ms.

errorThreshold

Number of successive REST API failures before error event is raised. Defaults to 5.

Events

The component emits events for important phases of password selection that can be registered to provide application-specific behavior in response to those events.

verified

The component maintains a valid field internally to track whether the provided password satisfies security and strength requirements for the configured account type. Once a valid password is chosen, a confirmation box appears to allow the user to confirm the chosen password. Upon successful confirmation, the component emits a verified event with a single argument containing the chosen password. This event can be used to signal the surrounding code that password selection is complete.

unverified

After a valid password is entered into the first field, the component emits this event on every key press until the password is successfully verified by typing it a second time. The match boolean argument is provided to indicate whether the characters of the confirmation password match the corresponding substring of the original. In other words this flag flips to false on the first mistyped character; this can be used to provide UI feedback for typos.

cleared

When either the password or confirmation field is cleared, this event is emitted.

error

The error event is emitted whenever the number of successive errors communicating with the back end REST API exceeds the value of the errorThreshold property. The count is set to zero on the next successful REST API call.

Building

The build system provides three NPM build targets:

  1. npm run dev - Runs the sample application at https://localhost:8443/
  2. npm run build - Packages the library for distribution
  3. npm run build-app - Packages the demo app for deployment (used with deploy.sh)

Supplementary scripts are provided in the bin directory.

  1. deploy.sh - Deploys the app to the demo site, https://vt-password-picker.middleware.cloud.vt.edu/
  2. publish.sh - Publishes the package to the public NPM repo