(reason)
| 179 | } |
| 180 | |
| 181 | export 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 | |
| 224 | function matchOneOfPatterns(url, patterns) { |
| 225 | for (let pattern of patterns) { |
no test coverage detected