From 6cf466e5d1d423aec8ec06f65644c73c7e9a8ecd Mon Sep 17 00:00:00 2001
From: syuilo <Syuilotan@yahoo.co.jp>
Date: Fri, 15 Sep 2023 14:28:29 +0900
Subject: update deps (#11820)

* update deps

* fix

* wip

* wip

* wip

* Update docker-compose.yml.example

* Delete reviewer-lottery.yml

* Update RepositoryModule.ts

* wip

* wip

* clean up

* update deps

* wip

* wip
---
 .../src/components/MkSignupDialog.form.vue         | 25 +++++++++++++++++++++-
 1 file changed, 24 insertions(+), 1 deletion(-)

(limited to 'packages/frontend/src/components/MkSignupDialog.form.vue')

diff --git a/packages/frontend/src/components/MkSignupDialog.form.vue b/packages/frontend/src/components/MkSignupDialog.form.vue
index de9b320da2..60541b256b 100644
--- a/packages/frontend/src/components/MkSignupDialog.form.vue
+++ b/packages/frontend/src/components/MkSignupDialog.form.vue
@@ -77,7 +77,6 @@ SPDX-License-Identifier: AGPL-3.0-only
 
 <script lang="ts" setup>
 import { } from 'vue';
-import getPasswordStrength from 'syuilo-password-strength';
 import { toUnicode } from 'punycode/';
 import MkButton from './MkButton.vue';
 import MkInput from './MkInput.vue';
@@ -132,6 +131,30 @@ const shouldDisableSubmitting = $computed((): boolean => {
 		passwordRetypeState !== 'match';
 });
 
+function getPasswordStrength(source: string): number {
+	let strength = 0;
+	let power = 0.018;
+
+	// 英数字
+	if (/[a-zA-Z]/.test(source) && /[0-9]/.test(source)) {
+		power += 0.020;
+	}
+
+	// 大文字と小文字が混ざってたら
+	if (/[a-z]/.test(source) && /[A-Z]/.test(source)) {
+		power += 0.015;
+	}
+
+	// 記号が混ざってたら
+	if (/[!\x22\#$%&@'()*+,-./_]/.test(source)) {
+		power += 0.02;
+	}
+
+	strength = power * source.length;
+
+	return Math.max(0, Math.min(1, strength));
+}
+
 function onChangeUsername(): void {
 	if (username === '') {
 		usernameState = null;
-- 
cgit v1.2.3-freya

