MCPcopy Create free account
hub / github.com/Useful-Scripts-Extension/useful-script / checkPass

Function checkPass

scripts/auto_lockWebsite.js:181–222  ·  view source on GitHub ↗
(reason)

Source from the content-addressed store, hash-verified

179}
180
181export async function checkPass(reason) {
182 const { t } = await import("../popup/helpers/lang.js");
183
184 let hasPass = await locker.password.has();
185 if (!hasPass) return "not init";
186
187 const { value: pass } = await Swal.fire({
188 icon: "info",
189 title: t({
190 vi: "Nhập mật khẩu" + t(reason),
191 en: "Enter password" + t(reason),
192 }),
193 input: "password",
194 inputPlaceholder: t({
195 vi: "Nhập mật khẩu",
196 en: "Enter password",
197 }),
198 inputAttributes: {
199 autocapitalize: "off",
200 autocorrect: "off",
201 },
202 showCancelButton: true,
203 inputValidator: (value) => {
204 if (!value) {
205 return t({
206 vi: "Vui lòng nhập mât khẩu",
207 en: "Please enter password!",
208 });
209 }
210 },
211 });
212
213 if (await locker.password.compare(pass)) return true;
214 if (pass != null) {
215 await Swal.fire(
216 t({ vi: "Sai mật khẩu", en: "Wrong password!" }),
217 "",
218 "error"
219 );
220 }
221 return false;
222}
223
224function matchOneOfPatterns(url, patterns) {
225 for (let pattern of patterns) {

Callers 4

restoreFunction · 0.85
resetFunction · 0.85

Calls 1

tFunction · 0.50

Tested by

no test coverage detected