New:Socket for Asana Is Now Available.Learn more
Get Started

@isoftdata/svelte-password-fields

Package Overview
Dependencies
Maintainers
12
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@isoftdata/svelte-password-fields

This component handled * Check whether both password values are matched and meet(optionally) a set of validation rules.

npmnpm
Version
1.1.0
Version published
Weekly downloads
19
-83.76%
Maintainers
12
Weekly downloads
 
Created
Source

Svelte PasswordFields

This component handled

  • Check whether both password values are matched and meet(optionally) a set of validation rules.

Install

npm i @isoftdata/svelte-password-fields

Props

NameTypeDescriptionDefault Value
passwordstringThe password string entered.''
confirmPasswordstringThe confirm password string entered.''
passwordMismatchbooleanWhether there is a mismatch with the password and confirm password. An error message will be shown when there is a mismatchfalse
columnClassstringThe column with grid breakpoint bootstrap class for BOTH password and confirm password inputscol-12 col-md-6
passwordLabelstringThe label of the password input.Password
confirmPasswordLabelstringThe label of the confirm password input.Confirm Password
validationRulesValidationRules | undefinedAn object containing validation rules to be enforced and show in the UI. If undefinedundefined, validation will be ignored.

ValidationRules

interface ValidationRules {
	minimumPasswordLength?: number
	maximumPasswordLength?: number
	numberOfRequiredLowercaseCharacters?: number
	numberOfRequiredUppercaseCharacters?: number
	numberOfRequiredNumericCharacters?: number
	numberOfRequiredSpecialCharacters?: number
}

Example

<script lang="ts">
	import PasswordFields from '@isoftdata/svelte-password-fields'
	let passwordMismatch: boolean = false
</script>

<div class="container">
	<h1>PasswordFields</h1>

	<PasswordFields />
	<PasswordFields
		columnClass="col-12 col-md-4"
		passwordLabel="New Password"
		confirmPasswordLabel="Confirm New Password"
		bind:passwordMismatch
		validationRules={{
			minimumPasswordLength: 3,
			maximumPasswordLength: 10,
			numberOfRequiredLowercaseCharacters: 2,
			numberOfRequiredUppercaseCharacters: 2,
			numberOfRequiredNumericCharacters: 2,
			numberOfRequiredSpecialCharacters: 2,
		}}
	/>
	{#if passwordMismatch}
		<div class="alert alert-danger">Passwords do not match</div>
	{/if}
</div>

FAQs

Package last updated on 06 Dec 2023

Related posts