(createNew = false)
| 150 | }; |
| 151 | |
| 152 | export async function initPassword(createNew = false) { |
| 153 | const { t } = await import("../popup/helpers/lang.js"); |
| 154 | |
| 155 | if (!createNew) { |
| 156 | let pass = await locker.password.get(); |
| 157 | if (pass) return true; |
| 158 | } |
| 159 | |
| 160 | const { value: newPass } = await Swal.fire({ |
| 161 | title: t({ vi: "Tạo mật khẩu mới", en: "Create new password" }), |
| 162 | icon: "info", |
| 163 | input: "password", |
| 164 | html: t({ |
| 165 | vi: `Mật khẩu này dùng để mở khoá trang quản lý<br/> |
| 166 | và mở khoá các trang web<br/> |
| 167 | <p style="color:red">Hãy nhớ kỹ mật khẩu này</p>`, |
| 168 | en: `Used to open manager<br/> |
| 169 | and unlock websites<br/> |
| 170 | <p style="color:red">Please remember this password</p>`, |
| 171 | }), |
| 172 | showCancelButton: true, |
| 173 | }); |
| 174 | if (newPass) { |
| 175 | await locker.password.set(newPass); |
| 176 | return true; |
| 177 | } |
| 178 | return false; |
| 179 | } |
| 180 | |
| 181 | export async function checkPass(reason) { |
| 182 | const { t } = await import("../popup/helpers/lang.js"); |
no test coverage detected