@fiduswriter/frontend 0.1.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (359) hide show
  1. package/LICENSE +661 -0
  2. package/README.md +66 -0
  3. package/dist/admin_console/index.d.ts +8 -0
  4. package/dist/admin_console/index.d.ts.map +1 -0
  5. package/dist/admin_console/index.js +54 -0
  6. package/dist/admin_console/index.js.map +1 -0
  7. package/dist/api/index.d.ts +193 -0
  8. package/dist/api/index.d.ts.map +1 -0
  9. package/dist/api/index.js +6 -0
  10. package/dist/api/index.js.map +1 -0
  11. package/dist/app/index.d.ts +74 -0
  12. package/dist/app/index.d.ts.map +1 -0
  13. package/dist/app/index.js +471 -0
  14. package/dist/app/index.js.map +1 -0
  15. package/dist/common/index.d.ts +3 -0
  16. package/dist/common/index.d.ts.map +1 -0
  17. package/dist/common/index.js +3 -0
  18. package/dist/common/index.js.map +1 -0
  19. package/dist/common/templates.d.ts +3 -0
  20. package/dist/common/templates.d.ts.map +1 -0
  21. package/dist/common/templates.js +42 -0
  22. package/dist/common/templates.js.map +1 -0
  23. package/dist/common/user_util.d.ts +6 -0
  24. package/dist/common/user_util.d.ts.map +1 -0
  25. package/dist/common/user_util.js +16 -0
  26. package/dist/common/user_util.js.map +1 -0
  27. package/dist/document_templates/actions.d.ts +11 -0
  28. package/dist/document_templates/actions.d.ts.map +1 -0
  29. package/dist/document_templates/actions.js +141 -0
  30. package/dist/document_templates/actions.js.map +1 -0
  31. package/dist/document_templates/editor.d.ts +28 -0
  32. package/dist/document_templates/editor.d.ts.map +1 -0
  33. package/dist/document_templates/editor.js +139 -0
  34. package/dist/document_templates/editor.js.map +1 -0
  35. package/dist/document_templates/index.d.ts +3 -0
  36. package/dist/document_templates/index.d.ts.map +1 -0
  37. package/dist/document_templates/index.js +3 -0
  38. package/dist/document_templates/index.js.map +1 -0
  39. package/dist/document_templates/menu.d.ts +7 -0
  40. package/dist/document_templates/menu.d.ts.map +1 -0
  41. package/dist/document_templates/menu.js +62 -0
  42. package/dist/document_templates/menu.js.map +1 -0
  43. package/dist/document_templates/overview.d.ts +52 -0
  44. package/dist/document_templates/overview.d.ts.map +1 -0
  45. package/dist/document_templates/overview.js +274 -0
  46. package/dist/document_templates/overview.js.map +1 -0
  47. package/dist/document_templates/templates.d.ts +3 -0
  48. package/dist/document_templates/templates.d.ts.map +1 -0
  49. package/dist/document_templates/templates.js +9 -0
  50. package/dist/document_templates/templates.js.map +1 -0
  51. package/dist/documents/importer/docx/import.d.ts +5 -0
  52. package/dist/documents/importer/docx/import.d.ts.map +1 -0
  53. package/dist/documents/importer/docx/import.js +15 -0
  54. package/dist/documents/importer/docx/import.js.map +1 -0
  55. package/dist/documents/importer/docx/index.d.ts +2 -0
  56. package/dist/documents/importer/docx/index.d.ts.map +1 -0
  57. package/dist/documents/importer/docx/index.js +2 -0
  58. package/dist/documents/importer/docx/index.js.map +1 -0
  59. package/dist/documents/importer/native/file.d.ts +7 -0
  60. package/dist/documents/importer/native/file.d.ts.map +1 -0
  61. package/dist/documents/importer/native/file.js +60 -0
  62. package/dist/documents/importer/native/file.js.map +1 -0
  63. package/dist/documents/importer/native/import.d.ts +41 -0
  64. package/dist/documents/importer/native/import.d.ts.map +1 -0
  65. package/dist/documents/importer/native/import.js +126 -0
  66. package/dist/documents/importer/native/import.js.map +1 -0
  67. package/dist/documents/importer/native/index.d.ts +3 -0
  68. package/dist/documents/importer/native/index.d.ts.map +1 -0
  69. package/dist/documents/importer/native/index.js +3 -0
  70. package/dist/documents/importer/native/index.js.map +1 -0
  71. package/dist/documents/importer/odt/import.d.ts +5 -0
  72. package/dist/documents/importer/odt/import.d.ts.map +1 -0
  73. package/dist/documents/importer/odt/import.js +16 -0
  74. package/dist/documents/importer/odt/import.js.map +1 -0
  75. package/dist/documents/importer/odt/index.d.ts +2 -0
  76. package/dist/documents/importer/odt/index.d.ts.map +1 -0
  77. package/dist/documents/importer/odt/index.js +2 -0
  78. package/dist/documents/importer/odt/index.js.map +1 -0
  79. package/dist/documents/importer/pandoc/import.d.ts +5 -0
  80. package/dist/documents/importer/pandoc/import.d.ts.map +1 -0
  81. package/dist/documents/importer/pandoc/import.js +37 -0
  82. package/dist/documents/importer/pandoc/import.js.map +1 -0
  83. package/dist/documents/importer/pandoc/index.d.ts +2 -0
  84. package/dist/documents/importer/pandoc/index.d.ts.map +1 -0
  85. package/dist/documents/importer/pandoc/index.js +2 -0
  86. package/dist/documents/importer/pandoc/index.js.map +1 -0
  87. package/dist/documents/importer/register.d.ts +4 -0
  88. package/dist/documents/importer/register.d.ts.map +1 -0
  89. package/dist/documents/importer/register.js +4 -0
  90. package/dist/documents/importer/register.js.map +1 -0
  91. package/dist/documents/overview/actions.d.ts +32 -0
  92. package/dist/documents/overview/actions.d.ts.map +1 -0
  93. package/dist/documents/overview/actions.js +725 -0
  94. package/dist/documents/overview/actions.js.map +1 -0
  95. package/dist/documents/overview/index.d.ts +98 -0
  96. package/dist/documents/overview/index.d.ts.map +1 -0
  97. package/dist/documents/overview/index.js +814 -0
  98. package/dist/documents/overview/index.js.map +1 -0
  99. package/dist/documents/overview/menu.d.ts +28 -0
  100. package/dist/documents/overview/menu.d.ts.map +1 -0
  101. package/dist/documents/overview/menu.js +222 -0
  102. package/dist/documents/overview/menu.js.map +1 -0
  103. package/dist/documents/overview/templates.d.ts +31 -0
  104. package/dist/documents/overview/templates.d.ts.map +1 -0
  105. package/dist/documents/overview/templates.js +39 -0
  106. package/dist/documents/overview/templates.js.map +1 -0
  107. package/dist/documents/revisions/index.d.ts +14 -0
  108. package/dist/documents/revisions/index.d.ts.map +1 -0
  109. package/dist/documents/revisions/index.js +143 -0
  110. package/dist/documents/revisions/index.js.map +1 -0
  111. package/dist/documents/revisions/templates.d.ts +4 -0
  112. package/dist/documents/revisions/templates.d.ts.map +1 -0
  113. package/dist/documents/revisions/templates.js +36 -0
  114. package/dist/documents/revisions/templates.js.map +1 -0
  115. package/dist/documents/tools.d.ts +16 -0
  116. package/dist/documents/tools.d.ts.map +1 -0
  117. package/dist/documents/tools.js +69 -0
  118. package/dist/documents/tools.js.map +1 -0
  119. package/dist/error_hook/index.d.ts +19 -0
  120. package/dist/error_hook/index.d.ts.map +1 -0
  121. package/dist/error_hook/index.js +75 -0
  122. package/dist/error_hook/index.js.map +1 -0
  123. package/dist/feedback/index.d.ts +12 -0
  124. package/dist/feedback/index.d.ts.map +1 -0
  125. package/dist/feedback/index.js +125 -0
  126. package/dist/feedback/index.js.map +1 -0
  127. package/dist/index.d.ts +42 -0
  128. package/dist/index.d.ts.map +1 -0
  129. package/dist/index.js +48 -0
  130. package/dist/index.js.map +1 -0
  131. package/dist/indexed_db/index.d.ts +24 -0
  132. package/dist/indexed_db/index.d.ts.map +1 -0
  133. package/dist/indexed_db/index.js +175 -0
  134. package/dist/indexed_db/index.js.map +1 -0
  135. package/dist/maintenance/index.d.ts +19 -0
  136. package/dist/maintenance/index.d.ts.map +1 -0
  137. package/dist/maintenance/index.js +223 -0
  138. package/dist/maintenance/index.js.map +1 -0
  139. package/dist/menu/index.d.ts +25 -0
  140. package/dist/menu/index.d.ts.map +1 -0
  141. package/dist/menu/index.js +229 -0
  142. package/dist/menu/index.js.map +1 -0
  143. package/dist/menu/templates.d.ts +6 -0
  144. package/dist/menu/templates.d.ts.map +1 -0
  145. package/dist/menu/templates.js +10 -0
  146. package/dist/menu/templates.js.map +1 -0
  147. package/dist/pages/404.d.ts +9 -0
  148. package/dist/pages/404.d.ts.map +1 -0
  149. package/dist/pages/404.js +12 -0
  150. package/dist/pages/404.js.map +1 -0
  151. package/dist/pages/flatpage.d.ts +12 -0
  152. package/dist/pages/flatpage.d.ts.map +1 -0
  153. package/dist/pages/flatpage.js +39 -0
  154. package/dist/pages/flatpage.js.map +1 -0
  155. package/dist/pages/offline.d.ts +10 -0
  156. package/dist/pages/offline.d.ts.map +1 -0
  157. package/dist/pages/offline.js +27 -0
  158. package/dist/pages/offline.js.map +1 -0
  159. package/dist/pages/setup.d.ts +10 -0
  160. package/dist/pages/setup.d.ts.map +1 -0
  161. package/dist/pages/setup.js +22 -0
  162. package/dist/pages/setup.js.map +1 -0
  163. package/dist/plugins/menu/index.d.ts +3 -0
  164. package/dist/plugins/menu/index.d.ts.map +1 -0
  165. package/dist/plugins/menu/index.js +2 -0
  166. package/dist/plugins/menu/index.js.map +1 -0
  167. package/dist/prelogin/index.d.ts +51 -0
  168. package/dist/prelogin/index.d.ts.map +1 -0
  169. package/dist/prelogin/index.js +131 -0
  170. package/dist/prelogin/index.js.map +1 -0
  171. package/dist/prelogin/templates.d.ts +20 -0
  172. package/dist/prelogin/templates.d.ts.map +1 -0
  173. package/dist/prelogin/templates.js +50 -0
  174. package/dist/prelogin/templates.js.map +1 -0
  175. package/dist/state_plugins/contributor_input/add_button.d.ts +22 -0
  176. package/dist/state_plugins/contributor_input/add_button.d.ts.map +1 -0
  177. package/dist/state_plugins/contributor_input/add_button.js +106 -0
  178. package/dist/state_plugins/contributor_input/add_button.js.map +1 -0
  179. package/dist/state_plugins/contributor_input/helpers.d.ts +3 -0
  180. package/dist/state_plugins/contributor_input/helpers.d.ts.map +1 -0
  181. package/dist/state_plugins/contributor_input/helpers.js +23 -0
  182. package/dist/state_plugins/contributor_input/helpers.js.map +1 -0
  183. package/dist/state_plugins/contributor_input/index.d.ts +4 -0
  184. package/dist/state_plugins/contributor_input/index.d.ts.map +1 -0
  185. package/dist/state_plugins/contributor_input/index.js +4 -0
  186. package/dist/state_plugins/contributor_input/index.js.map +1 -0
  187. package/dist/state_plugins/contributor_input/node_view.d.ts +20 -0
  188. package/dist/state_plugins/contributor_input/node_view.d.ts.map +1 -0
  189. package/dist/state_plugins/contributor_input/node_view.js +85 -0
  190. package/dist/state_plugins/contributor_input/node_view.js.map +1 -0
  191. package/dist/state_plugins/index.d.ts +3 -0
  192. package/dist/state_plugins/index.d.ts.map +1 -0
  193. package/dist/state_plugins/index.js +3 -0
  194. package/dist/state_plugins/index.js.map +1 -0
  195. package/dist/state_plugins/tag_input/helpers.d.ts +5 -0
  196. package/dist/state_plugins/tag_input/helpers.d.ts.map +1 -0
  197. package/dist/state_plugins/tag_input/helpers.js +55 -0
  198. package/dist/state_plugins/tag_input/helpers.js.map +1 -0
  199. package/dist/state_plugins/tag_input/index.d.ts +5 -0
  200. package/dist/state_plugins/tag_input/index.d.ts.map +1 -0
  201. package/dist/state_plugins/tag_input/index.js +5 -0
  202. package/dist/state_plugins/tag_input/index.js.map +1 -0
  203. package/dist/state_plugins/tag_input/node_view.d.ts +19 -0
  204. package/dist/state_plugins/tag_input/node_view.d.ts.map +1 -0
  205. package/dist/state_plugins/tag_input/node_view.js +85 -0
  206. package/dist/state_plugins/tag_input/node_view.js.map +1 -0
  207. package/dist/state_plugins/tag_input/tag_editor.d.ts +4 -0
  208. package/dist/state_plugins/tag_input/tag_editor.d.ts.map +1 -0
  209. package/dist/state_plugins/tag_input/tag_editor.js +160 -0
  210. package/dist/state_plugins/tag_input/tag_editor.js.map +1 -0
  211. package/dist/state_plugins/tag_input/tag_editor_plugins.d.ts +5 -0
  212. package/dist/state_plugins/tag_input/tag_editor_plugins.d.ts.map +1 -0
  213. package/dist/state_plugins/tag_input/tag_editor_plugins.js +64 -0
  214. package/dist/state_plugins/tag_input/tag_editor_plugins.js.map +1 -0
  215. package/dist/types.d.ts +53 -0
  216. package/dist/types.d.ts.map +1 -0
  217. package/dist/types.js +2 -0
  218. package/dist/types.js.map +1 -0
  219. package/dist/user/auth/email_confirm.d.ts +23 -0
  220. package/dist/user/auth/email_confirm.d.ts.map +1 -0
  221. package/dist/user/auth/email_confirm.js +123 -0
  222. package/dist/user/auth/email_confirm.js.map +1 -0
  223. package/dist/user/auth/email_confirm_templates.d.ts +12 -0
  224. package/dist/user/auth/email_confirm_templates.d.ts.map +1 -0
  225. package/dist/user/auth/email_confirm_templates.js +30 -0
  226. package/dist/user/auth/email_confirm_templates.js.map +1 -0
  227. package/dist/user/auth/login.d.ts +13 -0
  228. package/dist/user/auth/login.d.ts.map +1 -0
  229. package/dist/user/auth/login.js +186 -0
  230. package/dist/user/auth/login.js.map +1 -0
  231. package/dist/user/auth/password_reset_change.d.ts +11 -0
  232. package/dist/user/auth/password_reset_change.d.ts.map +1 -0
  233. package/dist/user/auth/password_reset_change.js +101 -0
  234. package/dist/user/auth/password_reset_change.js.map +1 -0
  235. package/dist/user/auth/password_reset_request.d.ts +10 -0
  236. package/dist/user/auth/password_reset_request.d.ts.map +1 -0
  237. package/dist/user/auth/password_reset_request.js +82 -0
  238. package/dist/user/auth/password_reset_request.js.map +1 -0
  239. package/dist/user/auth/signup.d.ts +9 -0
  240. package/dist/user/auth/signup.d.ts.map +1 -0
  241. package/dist/user/auth/signup.js +148 -0
  242. package/dist/user/auth/signup.js.map +1 -0
  243. package/dist/user/auth/two_factor.d.ts +10 -0
  244. package/dist/user/auth/two_factor.d.ts.map +1 -0
  245. package/dist/user/auth/two_factor.js +201 -0
  246. package/dist/user/auth/two_factor.js.map +1 -0
  247. package/dist/user/contacts/add_dialog.d.ts +7 -0
  248. package/dist/user/contacts/add_dialog.d.ts.map +1 -0
  249. package/dist/user/contacts/add_dialog.js +84 -0
  250. package/dist/user/contacts/add_dialog.js.map +1 -0
  251. package/dist/user/contacts/delete_dialog.d.ts +6 -0
  252. package/dist/user/contacts/delete_dialog.d.ts.map +1 -0
  253. package/dist/user/contacts/delete_dialog.js +38 -0
  254. package/dist/user/contacts/delete_dialog.js.map +1 -0
  255. package/dist/user/contacts/index.d.ts +35 -0
  256. package/dist/user/contacts/index.d.ts.map +1 -0
  257. package/dist/user/contacts/index.js +234 -0
  258. package/dist/user/contacts/index.js.map +1 -0
  259. package/dist/user/contacts/invite.d.ts +9 -0
  260. package/dist/user/contacts/invite.d.ts.map +1 -0
  261. package/dist/user/contacts/invite.js +21 -0
  262. package/dist/user/contacts/invite.js.map +1 -0
  263. package/dist/user/contacts/menu.d.ts +7 -0
  264. package/dist/user/contacts/menu.d.ts.map +1 -0
  265. package/dist/user/contacts/menu.js +62 -0
  266. package/dist/user/contacts/menu.js.map +1 -0
  267. package/dist/user/contacts/respond_invite.d.ts +9 -0
  268. package/dist/user/contacts/respond_invite.d.ts.map +1 -0
  269. package/dist/user/contacts/respond_invite.js +65 -0
  270. package/dist/user/contacts/respond_invite.js.map +1 -0
  271. package/dist/user/contacts/templates.d.ts +7 -0
  272. package/dist/user/contacts/templates.d.ts.map +1 -0
  273. package/dist/user/contacts/templates.js +24 -0
  274. package/dist/user/contacts/templates.js.map +1 -0
  275. package/dist/user/profile/delete_user.d.ts +8 -0
  276. package/dist/user/profile/delete_user.d.ts.map +1 -0
  277. package/dist/user/profile/delete_user.js +56 -0
  278. package/dist/user/profile/delete_user.js.map +1 -0
  279. package/dist/user/profile/dialogs.d.ts +10 -0
  280. package/dist/user/profile/dialogs.d.ts.map +1 -0
  281. package/dist/user/profile/dialogs.js +311 -0
  282. package/dist/user/profile/dialogs.js.map +1 -0
  283. package/dist/user/profile/index.d.ts +27 -0
  284. package/dist/user/profile/index.d.ts.map +1 -0
  285. package/dist/user/profile/index.js +254 -0
  286. package/dist/user/profile/index.js.map +1 -0
  287. package/dist/user/profile/templates.d.ts +22 -0
  288. package/dist/user/profile/templates.d.ts.map +1 -0
  289. package/dist/user/profile/templates.js +261 -0
  290. package/dist/user/profile/templates.js.map +1 -0
  291. package/dist/workers/adjust_doc_to_template.d.ts +11 -0
  292. package/dist/workers/adjust_doc_to_template.d.ts.map +1 -0
  293. package/dist/workers/adjust_doc_to_template.js +26 -0
  294. package/dist/workers/adjust_doc_to_template.js.map +1 -0
  295. package/package.json +225 -0
  296. package/src/admin_console/index.ts +84 -0
  297. package/src/api/index.ts +149 -0
  298. package/src/app/index.ts +605 -0
  299. package/src/common/index.ts +2 -0
  300. package/src/common/templates.ts +49 -0
  301. package/src/common/user_util.ts +16 -0
  302. package/src/document_templates/actions.ts +179 -0
  303. package/src/document_templates/editor.ts +177 -0
  304. package/src/document_templates/index.ts +2 -0
  305. package/src/document_templates/menu.ts +74 -0
  306. package/src/document_templates/overview.ts +335 -0
  307. package/src/document_templates/templates.ts +9 -0
  308. package/src/documents/importer/docx/import.ts +25 -0
  309. package/src/documents/importer/docx/index.ts +1 -0
  310. package/src/documents/importer/native/file.ts +112 -0
  311. package/src/documents/importer/native/import.ts +219 -0
  312. package/src/documents/importer/native/index.ts +2 -0
  313. package/src/documents/importer/odt/import.ts +26 -0
  314. package/src/documents/importer/odt/index.ts +1 -0
  315. package/src/documents/importer/pandoc/import.ts +57 -0
  316. package/src/documents/importer/pandoc/index.ts +1 -0
  317. package/src/documents/importer/register.ts +8 -0
  318. package/src/documents/overview/actions.ts +1031 -0
  319. package/src/documents/overview/index.ts +1006 -0
  320. package/src/documents/overview/menu.ts +311 -0
  321. package/src/documents/overview/templates.ts +64 -0
  322. package/src/documents/revisions/index.ts +183 -0
  323. package/src/documents/revisions/templates.ts +42 -0
  324. package/src/documents/tools.ts +107 -0
  325. package/src/error_hook/index.ts +129 -0
  326. package/src/feedback/index.ts +185 -0
  327. package/src/global.d.ts +22 -0
  328. package/src/index.ts +95 -0
  329. package/src/indexed_db/index.ts +217 -0
  330. package/src/maintenance/index.ts +258 -0
  331. package/src/menu/index.ts +267 -0
  332. package/src/menu/templates.ts +21 -0
  333. package/src/pages/404.ts +13 -0
  334. package/src/pages/flatpage.ts +43 -0
  335. package/src/pages/offline.ts +39 -0
  336. package/src/pages/setup.ts +34 -0
  337. package/src/plugins/menu/index.ts +3 -0
  338. package/src/prelogin/index.ts +175 -0
  339. package/src/prelogin/templates.ts +86 -0
  340. package/src/types.ts +63 -0
  341. package/src/user/auth/email_confirm.ts +153 -0
  342. package/src/user/auth/email_confirm_templates.ts +76 -0
  343. package/src/user/auth/login.ts +221 -0
  344. package/src/user/auth/password_reset_change.ts +120 -0
  345. package/src/user/auth/password_reset_request.ts +107 -0
  346. package/src/user/auth/signup.ts +182 -0
  347. package/src/user/auth/two_factor.ts +244 -0
  348. package/src/user/contacts/add_dialog.ts +104 -0
  349. package/src/user/contacts/delete_dialog.ts +40 -0
  350. package/src/user/contacts/index.ts +289 -0
  351. package/src/user/contacts/invite.ts +24 -0
  352. package/src/user/contacts/menu.ts +70 -0
  353. package/src/user/contacts/respond_invite.ts +76 -0
  354. package/src/user/contacts/templates.ts +29 -0
  355. package/src/user/profile/delete_user.ts +71 -0
  356. package/src/user/profile/dialogs.ts +363 -0
  357. package/src/user/profile/index.ts +359 -0
  358. package/src/user/profile/templates.ts +299 -0
  359. package/src/workers/adjust_doc_to_template.ts +41 -0
@@ -0,0 +1,107 @@
1
+ import {escapeText, post} from "fwtoolkit"
2
+ import {PreloginPage} from "../../prelogin/index.js"
3
+
4
+ export class PasswordResetRequest extends PreloginPage {
5
+ constructor({app, language}: {app: any; language: string}) {
6
+ super({app, language})
7
+ this.title = gettext("Reset Password")
8
+ }
9
+
10
+ render(): void {
11
+ this.contents = `<div class="fw-login-left">
12
+ <h1 class="fw-login-title">${gettext("Password reset")}</h1>
13
+ <p>${gettext("Forgotten your password? Enter your e-mail address in the form, and we'll send you an e-mail allowing you to reset it.")}</p>
14
+ <p>${interpolate(
15
+ gettext(
16
+ 'If you have any trouble resetting your password, please <a href="mailto:%(contactEmail)s">contact us</a>.'
17
+ ),
18
+ {contactEmail: (this.app.settings?.CONTACT_EMAIL as string) || ""},
19
+ true
20
+ )}</p>
21
+ </div>
22
+ <div class="fw-login-right">
23
+ <form>
24
+ <ul id="non-field-errors" class="fw-errorlist"></ul>
25
+ <div class="input-wrapper">
26
+ <label for="id-email">${gettext("E-mail address")}</label>
27
+ <input type="email" name="email" size="30" placeholder="${gettext("E-mail address")}" required="" id="id-email" autocomplete="email">
28
+ <ul id="id-email-errors" class="fw-errorlist"></ul>
29
+ </div>
30
+ <div class="submit-wrapper">
31
+ <button class="fw-button fw-dark fw-uppercase" id="email-submit" type="submit">${gettext("Reset My Password")}</button>
32
+ </div>
33
+ </form>
34
+ </div>`
35
+ super.render()
36
+ }
37
+
38
+ bind(): void {
39
+ super.bind()
40
+
41
+ const emailInput = document.getElementById("id-email")
42
+ if (emailInput) {
43
+ emailInput.focus()
44
+ }
45
+
46
+ const submitBtn = document.getElementById("email-submit")
47
+ if (submitBtn) {
48
+ submitBtn.addEventListener("click", (event: Event) => {
49
+ event.preventDefault()
50
+ const nonFieldErrors = document.querySelector("#non-field-errors")!
51
+ const emailErrors = document.querySelector("#id-email-errors")!
52
+ nonFieldErrors.innerHTML = ""
53
+ emailErrors.innerHTML = ""
54
+
55
+ const emailEl = document.getElementById("id-email") as HTMLInputElement
56
+ const email = emailEl.value
57
+ let errors = false
58
+ if (!emailEl.checkValidity()) {
59
+ emailErrors.innerHTML = `<li>${gettext("This is not a valid email.")}</li>`
60
+ errors = true
61
+ } else if (!email.length) {
62
+ emailErrors.innerHTML = `<li>${gettext("This field is required.")}</li>`
63
+ errors = true
64
+ }
65
+ if (errors) {
66
+ return
67
+ }
68
+
69
+ post("/api/user/password/reset/", {email})
70
+ .then(() => {
71
+ if (document.body !== this.dom) {
72
+ return
73
+ }
74
+ const contentsEl = document.querySelector(".fw-contents")
75
+ if (contentsEl) {
76
+ contentsEl.innerHTML = `<div class="fw-login-left">
77
+ <h1 class="fw-login-title">${gettext("Instructions emailed")}</h1>
78
+ <p>
79
+ ${interpolate(
80
+ gettext(
81
+ 'We have sent an e-mail to <a href="mailto:%(email)s">%(email)s</a> with instructions on how to reset your password.'
82
+ ),
83
+ {email},
84
+ true
85
+ )}
86
+ <br />
87
+ ${gettext("Please contact us if you do not receive it within a few minutes.")}
88
+ </p>
89
+ </div>`
90
+ }
91
+ })
92
+ .catch((response: any) =>
93
+ response.json().then((json: any) => {
94
+ json.form.errors.forEach(
95
+ (error: string) =>
96
+ (nonFieldErrors.innerHTML += `<li>${escapeText(error)}</li>`)
97
+ )
98
+ json.form.fields.email.errors.forEach(
99
+ (error: string) =>
100
+ (emailErrors.innerHTML += `<li>${escapeText(error)}</li>`)
101
+ )
102
+ })
103
+ )
104
+ })
105
+ }
106
+ }
107
+ }
@@ -0,0 +1,182 @@
1
+ import {escapeText, postJson} from "fwtoolkit"
2
+ import {PreloginPage} from "../../prelogin/index.js"
3
+
4
+ export class Signup extends PreloginPage {
5
+ constructor({app, language}: {app: any; language: string}) {
6
+ super({app, language})
7
+ this.title = gettext("Signup")
8
+ if (this.app.settings?.REGISTRATION_OPEN) {
9
+ this.contents = `<div class="fw-login-left">
10
+ <h1 class="fw-login-title">${gettext("Sign up")}</h1>
11
+ <p>
12
+ ${gettext(
13
+ 'Already have an account? Then please <a href="/" title="Login">login</a>.'
14
+ )}
15
+ </p>
16
+ </div>
17
+ <div class="fw-login-right">
18
+ <form>
19
+ <ul id="non-field-errors" class="fw-errorlist"></ul>
20
+ <div class="input-wrapper">
21
+ <label for="id-username">${gettext("Choose your username")}</label>
22
+ <input type="text" name="username" placeholder="${gettext("Username")}" autofocus="autofocus" minlength="1" maxlength="150" required="" id="id-username" autocomplete="username">
23
+ <ul id="id-username-errors" class="fw-errorlist"></ul>
24
+ </div>
25
+ <div class="input-wrapper">
26
+ <label for="id-password1">${gettext("Create a password")}</label>
27
+ <input type="password" name="password1" placeholder="${gettext("Password")}" required="" id="id-password1" autocomplete="new-password">
28
+ <ul id="id-password1-errors" class="fw-errorlist"></ul>
29
+ </div>
30
+ <div class="input-wrapper">
31
+ <label for="id-password2">${gettext("Confirm your password")}</label>
32
+ <input type="password" name="password2" placeholder="${gettext("Password (again)")}" required="" id="id-password2" autocomplete="new-password">
33
+ <ul id="id-password2-errors" class="fw-errorlist"></ul>
34
+ </div>
35
+ <div class="input-wrapper">
36
+ <label for="id-email">${gettext("E-mail address")}</label>
37
+ <input type="email" name="email" placeholder="${gettext("E-mail address")}" required="" id="id-email" autocomplete="email">
38
+ <ul id="id-email-errors" class="fw-errorlist"></ul>
39
+ </div>
40
+ <div class="submit-wrapper">
41
+ <button class="fw-button fw-dark fw-uppercase" id="signup-submit" type="submit">${gettext("Sign up")}</button>
42
+ </div>
43
+ </form>
44
+ </div>`
45
+ } else {
46
+ this.contents = `<div class="fw-login-left">
47
+ <h1 class="fw-login-title">${gettext("Sign Up Closed")}</h1>
48
+ <p>${gettext("We are sorry, but the sign up is currently closed.")}</p>
49
+ </div>`
50
+ }
51
+ }
52
+
53
+ bind(): void {
54
+ super.bind()
55
+
56
+ const signupSubmit = document.querySelector("#signup-submit")
57
+
58
+ if (!this.app.settings?.REGISTRATION_OPEN || !signupSubmit) {
59
+ return
60
+ }
61
+
62
+ signupSubmit.addEventListener("click", (event: Event) => {
63
+ event.preventDefault()
64
+
65
+ const nonFieldErrors = document.querySelector("#non-field-errors")
66
+ const idUsername = document.querySelector("#id-username") as HTMLInputElement
67
+ const idUsernameErrors = document.querySelector("#id-username-errors")
68
+ const idPassword1 = document.querySelector("#id-password1") as HTMLInputElement
69
+ const idPassword1Errors = document.querySelector("#id-password1-errors")
70
+ const idPassword2 = document.querySelector("#id-password2") as HTMLInputElement
71
+ const idPassword2Errors = document.querySelector("#id-password2-errors")
72
+ const idEmail = document.querySelector("#id-email") as HTMLInputElement
73
+ const idEmailErrors = document.querySelector("#id-email-errors")
74
+ const fwContents = document.querySelector(".fw-contents")
75
+
76
+ if (
77
+ !nonFieldErrors ||
78
+ !idUsername ||
79
+ !idUsernameErrors ||
80
+ !idPassword1 ||
81
+ !idPassword1Errors ||
82
+ !idPassword2 ||
83
+ !idPassword2Errors ||
84
+ !idEmail ||
85
+ !idEmailErrors ||
86
+ !fwContents
87
+ ) {
88
+ return
89
+ }
90
+
91
+ nonFieldErrors.innerHTML = ""
92
+ idUsernameErrors.innerHTML = ""
93
+ idPassword1Errors.innerHTML = ""
94
+ idPassword2Errors.innerHTML = ""
95
+ idEmailErrors.innerHTML = ""
96
+
97
+ const username = idUsername.value
98
+ const password1 = idPassword1.value
99
+ const password2 = idPassword2.value
100
+ const email = idEmail.value
101
+ let errors = false
102
+ if (!username.length) {
103
+ idUsernameErrors.innerHTML = `<li>${gettext("This field is required.")}</li>`
104
+ errors = true
105
+ }
106
+ if (!password1.length) {
107
+ idPassword1Errors.innerHTML = `<li>${gettext("This field is required.")}</li>`
108
+ errors = true
109
+ }
110
+ if (!password2.length) {
111
+ idPassword2Errors.innerHTML = `<li>${gettext("This field is required.")}</li>`
112
+ errors = true
113
+ }
114
+ if (password1 !== password2) {
115
+ idPassword2Errors.innerHTML = `<li>${gettext("You must type the same password each time.")}</li>`
116
+ errors = true
117
+ }
118
+ if (!idEmail.checkValidity()) {
119
+ idEmailErrors.innerHTML = `<li>${gettext("This is not a valid email.")}</li>`
120
+ errors = true
121
+ } else if (!email.length) {
122
+ idEmailErrors.innerHTML = `<li>${gettext("This field is required.")}</li>`
123
+ errors = true
124
+ }
125
+ if (errors) {
126
+ return
127
+ }
128
+ const sendData: Record<string, unknown> = {username, password1, password2, email}
129
+ if ((this.app as any).inviteKey) {
130
+ sendData["invite_key"] = (this.app as any).inviteKey
131
+ }
132
+ postJson("/api/user/signup/", sendData)
133
+ .then(({json}: any) => {
134
+ if (json.location === "/api/account/confirm-email/") {
135
+ fwContents.innerHTML = `<div class="fw-login-left">
136
+ <h1 class="fw-login-title">${gettext("Verify Your E-mail Address")}</h1>
137
+ <p>
138
+ ${interpolate(
139
+ gettext(
140
+ 'We have sent an e-mail to <a href="mailto:%(email)s">%(email)s</a> for verification. Follow the link provided to finalize the signup process.'
141
+ ),
142
+ {email},
143
+ true
144
+ )}
145
+ <br />
146
+ ${gettext(
147
+ "Please contact us if you do not receive it within a few minutes."
148
+ )}
149
+ </p>
150
+ </div>`
151
+ } else {
152
+ window.history.pushState({}, "", "/")
153
+ ;(this.app as any).init()
154
+ }
155
+ })
156
+ .catch((response: any) =>
157
+ response.json().then((json: any) => {
158
+ json.form.errors.forEach(
159
+ (error: string) =>
160
+ (nonFieldErrors.innerHTML += `<li>${escapeText(error)}</li>`)
161
+ )
162
+ json.form.fields.username.errors.forEach(
163
+ (error: string) =>
164
+ (idUsernameErrors.innerHTML += `<li>${escapeText(error)}</li>`)
165
+ )
166
+ json.form.fields.password1.errors.forEach(
167
+ (error: string) =>
168
+ (idPassword1Errors.innerHTML += `<li>${escapeText(error)}</li>`)
169
+ )
170
+ json.form.fields.password2.errors.forEach(
171
+ (error: string) =>
172
+ (idPassword2Errors.innerHTML += `<li>${escapeText(error)}</li>`)
173
+ )
174
+ json.form.fields.email.errors.forEach(
175
+ (error: string) =>
176
+ (idEmailErrors.innerHTML += `<li>${escapeText(error)}</li>`)
177
+ )
178
+ })
179
+ )
180
+ })
181
+ }
182
+ }
@@ -0,0 +1,244 @@
1
+ import {
2
+ Dialog,
3
+ activateWait,
4
+ addAlert,
5
+ deactivateWait,
6
+ postJson
7
+ } from "fwtoolkit"
8
+ import QRCode from "qrcode"
9
+
10
+ export const twoFactorSetupDialog = (): Promise<any> => {
11
+ let secretKey: string | null = null
12
+ let deviceId: string | null = null
13
+
14
+ activateWait()
15
+ return postJson("/api/user/two-factor/setup/").then(({json}: any): any => {
16
+ deactivateWait()
17
+
18
+ if (json.status !== "success") {
19
+ addAlert("error", json.message)
20
+ return Promise.reject(json.message)
21
+ }
22
+
23
+ secretKey = json.secret_key
24
+ deviceId = json.device_id
25
+ const provisioningUri = json.provisioning_uri
26
+
27
+ const qrContainer = document.createElement("div")
28
+ qrContainer.className = "two-factor-qr-container"
29
+
30
+ QRCode.toCanvas(
31
+ provisioningUri,
32
+ {
33
+ width: 200,
34
+ margin: 2,
35
+ color: {
36
+ dark: "#000000",
37
+ light: "#ffffff"
38
+ }
39
+ },
40
+ function (error: Error | null | undefined, canvas: HTMLCanvasElement) {
41
+ if (error) {
42
+ console.error("QR Code generation error:", error)
43
+ qrContainer.innerHTML = `<p style="color: red;">${gettext("Could not generate QR code. Please use the secret key below.")}</p>`
44
+ } else {
45
+ qrContainer.appendChild(canvas)
46
+ }
47
+ }
48
+ )
49
+
50
+ const buttons = [
51
+ {
52
+ text: gettext("Verify"),
53
+ classes: "fw-dark",
54
+ click: () => {
55
+ const codeInput = document.querySelector(
56
+ "#two-factor-code"
57
+ ) as HTMLInputElement
58
+ const code = codeInput.value.trim()
59
+
60
+ if (code.length !== 6) {
61
+ addAlert("error", gettext("Please enter a 6-digit code."))
62
+ return
63
+ }
64
+
65
+ postJson("/api/user/two-factor/verify/", {
66
+ code,
67
+ device_id: deviceId
68
+ })
69
+ .then(({json}: any) => {
70
+ if (json.status === "success") {
71
+ addAlert("success", json.message)
72
+ dialog.close()
73
+ window.location.reload()
74
+ } else {
75
+ addAlert("error", json.message)
76
+ }
77
+ })
78
+ .catch(() => {
79
+ addAlert("error", gettext("Could not verify the code."))
80
+ })
81
+ }
82
+ },
83
+ {type: "cancel"}
84
+ ]
85
+
86
+ const dialog = new Dialog({
87
+ id: "two-factor-setup-dialog",
88
+ title: gettext("Set Up Two-Factor Authentication"),
89
+ body: `
90
+ <p>${gettext("Scan this QR code with your authenticator app (Google Authenticator, Authy, etc.)")}</p>
91
+ <div class="two-factor-qr-wrapper"></div>
92
+ <p><strong>${gettext("Or enter this code manually:")}</strong></p>
93
+ <code class="two-factor-secret">${secretKey}</code>
94
+ <div class="two-factor-verify-section">
95
+ <p>${gettext("Enter the 6-digit code from your authenticator app to verify:")}</p>
96
+ <input type="text" id="two-factor-code" placeholder="123456" maxlength="6" class="fw-button fw-large" autocomplete="one-time-code" />
97
+ </div>
98
+ `,
99
+ buttons,
100
+ icon: "shield-alt",
101
+ width: 500
102
+ } as any)
103
+
104
+ dialog.open()
105
+
106
+ const qrWrapper = dialog.dialogEl.querySelector(".two-factor-qr-wrapper")
107
+ if (qrWrapper && qrContainer) {
108
+ qrWrapper.appendChild(qrContainer)
109
+ }
110
+
111
+ const codeInput = dialog.dialogEl.querySelector("#two-factor-code")
112
+ if (codeInput) {
113
+ ;(codeInput as HTMLElement).addEventListener("keypress", (event: Event) => {
114
+ if ((event as KeyboardEvent).key === "Enter") {
115
+ event.preventDefault()
116
+ ;(buttons[0] as any).click()
117
+ }
118
+ })
119
+ }
120
+ })
121
+ }
122
+
123
+ export const twoFactorDisableDialog = (): any => {
124
+ const buttons = [
125
+ {
126
+ text: gettext("Disable 2FA"),
127
+ classes: "fw-orange",
128
+ click: () => {
129
+ activateWait()
130
+ postJson("/api/user/two-factor/disable/", {})
131
+ .then(({json}: any) => {
132
+ if (json.status === "success") {
133
+ addAlert("success", json.message)
134
+ dialog.close()
135
+ window.location.reload()
136
+ } else {
137
+ addAlert("error", json.message)
138
+ }
139
+ })
140
+ .catch(() => {
141
+ addAlert(
142
+ "error",
143
+ gettext("Could not disable two-factor authentication.")
144
+ )
145
+ })
146
+ .then(() => {
147
+ deactivateWait()
148
+ })
149
+ }
150
+ },
151
+ {type: "cancel"}
152
+ ]
153
+
154
+ const dialog = new Dialog({
155
+ id: "two-factor-disable-dialog",
156
+ title: gettext("Disable Two-Factor Authentication"),
157
+ body: `<p>${gettext("Are you sure you want to disable two-factor authentication? This will reduce the security of your account.")}</p>`,
158
+ buttons,
159
+ icon: "exclamation-triangle"
160
+ } as any)
161
+
162
+ dialog.open()
163
+ return dialog
164
+ }
165
+
166
+ export const twoFactorLoginDialog = ({
167
+ login,
168
+ password,
169
+ remember,
170
+ loginPage
171
+ }: {
172
+ login: string
173
+ password: string
174
+ remember: boolean
175
+ loginPage: any
176
+ }): any => {
177
+ const buttons = [
178
+ {
179
+ text: gettext("Verify"),
180
+ classes: "fw-dark",
181
+ click: () => {
182
+ const twofactorInput = dialog.dialogEl.querySelector(
183
+ "#two-factor-code"
184
+ ) as HTMLInputElement
185
+ const twofactor = twofactorInput ? twofactorInput.value.trim() : ""
186
+
187
+ if (twofactor.length !== 6) {
188
+ addAlert("error", gettext("Please enter a 6-digit code."))
189
+ return
190
+ }
191
+
192
+ activateWait()
193
+ postJson("/api/user/login/", {
194
+ login,
195
+ password,
196
+ remember,
197
+ twofactor
198
+ })
199
+ .then(({json}: any) => {
200
+ deactivateWait()
201
+ dialog.close()
202
+ loginPage.afterLogin(json)
203
+ })
204
+ .catch(() => {
205
+ addAlert("error", gettext("Could not verify the code."))
206
+ deactivateWait()
207
+ })
208
+ }
209
+ }
210
+ ]
211
+
212
+ const dialog = new Dialog({
213
+ id: "two-factor-login-dialog",
214
+ title: gettext("Two-Factor Authentication"),
215
+ body: `<p>${gettext("Enter the 6-digit code from your authenticator app:")}</p>
216
+ <input type="text" id="two-factor-code" placeholder="123456" maxlength="6" class="fw-button fw-large" autocomplete="one-time-code" autofocus />`,
217
+ buttons,
218
+ icon: "shield-alt",
219
+ width: 500
220
+ } as any)
221
+
222
+ dialog.open()
223
+ const codeInput = dialog.dialogEl.querySelector("#two-factor-code")
224
+ if (codeInput) {
225
+ ;(codeInput as HTMLElement).addEventListener("keypress", (event: Event) => {
226
+ if ((event as KeyboardEvent).key === "Enter") {
227
+ event.preventDefault()
228
+ buttons[0].click()
229
+ }
230
+ })
231
+ }
232
+ return dialog
233
+ }
234
+
235
+ export const checkTwoFactorStatus = (): Promise<boolean> => {
236
+ return postJson("/api/user/two-factor/status/")
237
+ .then(({json}: any) => {
238
+ if (json.status === "success") {
239
+ return json.enabled
240
+ }
241
+ return false
242
+ })
243
+ .catch(() => false)
244
+ }
@@ -0,0 +1,104 @@
1
+ import {Dialog, cancelPromise, escapeText, postJson} from "fwtoolkit"
2
+ import {addContactTemplate} from "./templates.js"
3
+
4
+ export class AddContactDialog {
5
+ settings: Record<string, unknown>
6
+
7
+ constructor(settings: Record<string, unknown>) {
8
+ this.settings = settings
9
+ }
10
+
11
+ init(): Promise<Array<Record<string, unknown>>> {
12
+ return new Promise(resolve => {
13
+ const buttons = [
14
+ {
15
+ text: gettext("Submit"),
16
+ classes: "fw-dark",
17
+ click: () => {
18
+ const userString = (
19
+ document.getElementById("new-contact-user-string") as HTMLInputElement
20
+ ).value
21
+ document
22
+ .querySelectorAll("#add-new-contact .fw-warning")
23
+ .forEach(el => el.parentElement!.removeChild(el))
24
+ const userStrings = userString.split(/[\s,;]+/)
25
+ let chain: Promise<Array<Record<string, unknown>>> = Promise.resolve([])
26
+
27
+ userStrings
28
+ .filter(singleUserString => singleUserString.length)
29
+ .forEach(
30
+ singleUserString =>
31
+ (chain = chain.then(responses =>
32
+ this.addContact(singleUserString).then(
33
+ data => [...responses, data]
34
+ )
35
+ ))
36
+ )
37
+ Promise.resolve(chain).then(contactData => {
38
+ if (contactData.length) {
39
+ dialog.close()
40
+ resolve(contactData)
41
+ }
42
+ })
43
+ }
44
+ },
45
+ {type: "cancel"}
46
+ ]
47
+
48
+ const dialog = new Dialog({
49
+ id: "add-new-contact",
50
+ title:
51
+ this.settings?.REGISTRATION_OPEN ||
52
+ this.settings?.SOCIALACCOUNT_OPEN
53
+ ? gettext("Add contact or invite new user")
54
+ : gettext("Add contact"),
55
+ body: addContactTemplate(),
56
+ width: 350,
57
+ height: 250,
58
+ buttons
59
+ } as any)
60
+
61
+ dialog.open()
62
+ ;(document.getElementById("new-contact-user-string") as HTMLElement).style.width =
63
+ "340"
64
+ })
65
+ }
66
+
67
+ addContact(
68
+ userString: string | null | undefined
69
+ ): Promise<Record<string, unknown>> {
70
+ if (null === userString || "undefined" == typeof userString) {
71
+ return cancelPromise()
72
+ }
73
+
74
+ userString = userString.trim()
75
+ if ("" === userString) {
76
+ return cancelPromise()
77
+ }
78
+
79
+ return postJson("/api/user/invites/add/", {
80
+ user_string: userString
81
+ }).then(({json, status}: any) => {
82
+ if (status == 201) {
83
+ return json.contact
84
+ } else {
85
+ let responseHtml
86
+ if (json.error === 1) {
87
+ responseHtml = gettext("You cannot add yourself to your contacts!")
88
+ } else if (json.error === 2) {
89
+ responseHtml = gettext("This person is already in your contacts!")
90
+ } else if (json.error === 3) {
91
+ responseHtml = gettext("Invalid email!")
92
+ }
93
+ const container = document.getElementById("add-new-contact")
94
+ if (container) {
95
+ container.insertAdjacentHTML(
96
+ "beforeend",
97
+ `<div class="fw-warning" style="padding: 8px;">${escapeText(userString!)}: ${responseHtml}</div>`
98
+ )
99
+ }
100
+ return cancelPromise()
101
+ }
102
+ })
103
+ }
104
+ }
@@ -0,0 +1,40 @@
1
+ import {Dialog, postJson} from "fwtoolkit"
2
+
3
+ export class DeleteContactDialog {
4
+ contacts: Array<Record<string, unknown>>
5
+
6
+ constructor(contacts: Array<Record<string, unknown>>) {
7
+ this.contacts = contacts
8
+ }
9
+
10
+ init(): Promise<void> {
11
+ return new Promise((resolve, reject) => {
12
+ const buttons = [
13
+ {
14
+ text: gettext("Delete"),
15
+ classes: "fw-dark",
16
+ click: () => {
17
+ postJson("/api/user/contacts/delete/", {
18
+ contacts: this.contacts
19
+ }).then(({status}: any) => {
20
+ dialog.close()
21
+ if (status == 200) {
22
+ return resolve()
23
+ }
24
+ return reject()
25
+ })
26
+ }
27
+ },
28
+ {type: "cancel"}
29
+ ]
30
+ const dialog = new Dialog({
31
+ title: gettext("Confirm deletion"),
32
+ id: "confirmdeletion",
33
+ body: `<p>${gettext("Remove from contacts")}?</p>`,
34
+ height: 60,
35
+ buttons
36
+ } as any)
37
+ dialog.open()
38
+ })
39
+ }
40
+ }