@salesforce/ui-bundle-template-feature-vue-authentication 0.0.0-stage → 13.1.0

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 (217) hide show
  1. package/LICENSE.txt +82 -0
  2. package/README.md +106 -2
  3. package/dist/.forceignore +15 -0
  4. package/dist/.husky/pre-commit +4 -0
  5. package/dist/.prettierignore +11 -0
  6. package/dist/.prettierrc +17 -0
  7. package/dist/CHANGELOG.md +5423 -0
  8. package/dist/README.md +83 -0
  9. package/dist/config/project-scratch-def.json +13 -0
  10. package/dist/eslint.config.js +7 -0
  11. package/dist/force-app/main/default/classes/UIBundleAuthUtils.cls +68 -0
  12. package/dist/force-app/main/default/classes/UIBundleAuthUtils.cls-meta.xml +5 -0
  13. package/dist/force-app/main/default/classes/UIBundleAuthUtils_Test.cls +141 -0
  14. package/dist/force-app/main/default/classes/UIBundleAuthUtils_Test.cls-meta.xml +5 -0
  15. package/dist/force-app/main/default/classes/UIBundleChangePassword.cls +77 -0
  16. package/dist/force-app/main/default/classes/UIBundleChangePassword.cls-meta.xml +5 -0
  17. package/dist/force-app/main/default/classes/UIBundleForgotPassword.cls +71 -0
  18. package/dist/force-app/main/default/classes/UIBundleForgotPassword.cls-meta.xml +5 -0
  19. package/dist/force-app/main/default/classes/UIBundleLogin.cls +105 -0
  20. package/dist/force-app/main/default/classes/UIBundleLogin.cls-meta.xml +5 -0
  21. package/dist/force-app/main/default/classes/UIBundleRegistration.cls +162 -0
  22. package/dist/force-app/main/default/classes/UIBundleRegistration.cls-meta.xml +5 -0
  23. package/dist/force-app/main/default/classes/UIBundleSocialLoginConfig.cls +145 -0
  24. package/dist/force-app/main/default/classes/UIBundleSocialLoginConfig.cls-meta.xml +5 -0
  25. package/dist/force-app/main/default/classes/UIBundleSocialLoginConfig_Test.cls +181 -0
  26. package/dist/force-app/main/default/classes/UIBundleSocialLoginConfig_Test.cls-meta.xml +5 -0
  27. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/.forceignore +15 -0
  28. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/.graphqlrc.yml +2 -0
  29. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/.prettierignore +9 -0
  30. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/.prettierrc +11 -0
  31. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/README.md +43 -0
  32. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/codegen.yml +95 -0
  33. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/components.json +19 -0
  34. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/e2e/app.spec.ts +17 -0
  35. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/eslint.config.js +124 -0
  36. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/feature-vue-authentication.uibundle-meta.xml +7 -0
  37. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/index.html +12 -0
  38. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/package.json +74 -0
  39. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/playwright.config.ts +24 -0
  40. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/scripts/get-graphql-schema.mjs +71 -0
  41. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/scripts/rewrite-e2e-assets.mjs +23 -0
  42. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/App.vue +5 -0
  43. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/api/graphqlClient.ts +44 -0
  44. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/appLayout.vue +80 -0
  45. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/alerts/status-alert.vue +59 -0
  46. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/layouts/card-layout.vue +30 -0
  47. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/alert/Alert.vue +21 -0
  48. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/alert/AlertAction.vue +17 -0
  49. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/alert/AlertDescription.vue +22 -0
  50. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/alert/AlertTitle.vue +22 -0
  51. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/alert/index.ts +25 -0
  52. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/avatar/Avatar.vue +23 -0
  53. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/avatar/AvatarFallback.vue +31 -0
  54. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/avatar/AvatarImage.vue +16 -0
  55. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/avatar/index.ts +3 -0
  56. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/button/Button.vue +33 -0
  57. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/button/index.ts +43 -0
  58. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/card/Card.vue +29 -0
  59. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/card/CardAction.vue +22 -0
  60. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/card/CardContent.vue +17 -0
  61. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/card/CardDescription.vue +17 -0
  62. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/card/CardFooter.vue +22 -0
  63. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/card/CardHeader.vue +22 -0
  64. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/card/CardTitle.vue +22 -0
  65. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/card/index.ts +7 -0
  66. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/checkbox/Checkbox.vue +43 -0
  67. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/checkbox/index.ts +1 -0
  68. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/collapsible/Collapsible.vue +19 -0
  69. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/collapsible/CollapsibleContent.vue +12 -0
  70. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/collapsible/CollapsibleTrigger.vue +12 -0
  71. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/collapsible/index.ts +3 -0
  72. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/dialog/Dialog.vue +15 -0
  73. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/dialog/DialogClose.vue +12 -0
  74. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/dialog/DialogContent.vue +59 -0
  75. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/dialog/DialogDescription.vue +31 -0
  76. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/dialog/DialogFooter.vue +33 -0
  77. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/dialog/DialogHeader.vue +17 -0
  78. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/dialog/DialogOverlay.vue +31 -0
  79. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/dialog/DialogPortal.vue +12 -0
  80. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/dialog/DialogTitle.vue +26 -0
  81. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/dialog/DialogTrigger.vue +12 -0
  82. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/dialog/index.ts +10 -0
  83. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/dropdown-menu/DropdownMenu.vue +19 -0
  84. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/dropdown-menu/DropdownMenuCheckboxItem.vue +51 -0
  85. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/dropdown-menu/DropdownMenuContent.vue +47 -0
  86. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/dropdown-menu/DropdownMenuGroup.vue +12 -0
  87. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/dropdown-menu/DropdownMenuItem.vue +44 -0
  88. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/dropdown-menu/DropdownMenuLabel.vue +30 -0
  89. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/dropdown-menu/DropdownMenuPortal.vue +12 -0
  90. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/dropdown-menu/DropdownMenuRadioGroup.vue +21 -0
  91. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/dropdown-menu/DropdownMenuRadioItem.vue +52 -0
  92. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/dropdown-menu/DropdownMenuSeparator.vue +26 -0
  93. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/dropdown-menu/DropdownMenuShortcut.vue +19 -0
  94. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/dropdown-menu/DropdownMenuSub.vue +19 -0
  95. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/dropdown-menu/DropdownMenuSubContent.vue +37 -0
  96. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/dropdown-menu/DropdownMenuSubTrigger.vue +38 -0
  97. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/dropdown-menu/DropdownMenuTrigger.vue +17 -0
  98. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/dropdown-menu/index.ts +15 -0
  99. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/field/Field.vue +27 -0
  100. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/field/FieldContent.vue +22 -0
  101. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/field/FieldDescription.vue +24 -0
  102. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/field/FieldError.vue +48 -0
  103. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/field/FieldGroup.vue +22 -0
  104. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/field/FieldLabel.vue +24 -0
  105. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/field/FieldLegend.vue +29 -0
  106. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/field/FieldSeparator.vue +31 -0
  107. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/field/FieldSet.vue +22 -0
  108. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/field/FieldTitle.vue +22 -0
  109. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/field/index.ts +33 -0
  110. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/index.ts +115 -0
  111. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/input/Input.vue +30 -0
  112. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/input/index.ts +1 -0
  113. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/label/Label.vue +29 -0
  114. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/label/index.ts +1 -0
  115. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/pagination/Pagination.vue +17 -0
  116. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/pagination/PaginationContent.vue +15 -0
  117. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/pagination/PaginationEllipsis.vue +23 -0
  118. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/pagination/PaginationItem.vue +7 -0
  119. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/pagination/PaginationLink.vue +31 -0
  120. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/pagination/PaginationNext.vue +29 -0
  121. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/pagination/PaginationPrevious.vue +29 -0
  122. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/pagination/index.ts +7 -0
  123. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/popover/Popover.vue +15 -0
  124. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/popover/PopoverAnchor.vue +12 -0
  125. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/popover/PopoverContent.vue +44 -0
  126. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/popover/PopoverDescription.vue +17 -0
  127. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/popover/PopoverHeader.vue +17 -0
  128. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/popover/PopoverTitle.vue +14 -0
  129. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/popover/PopoverTrigger.vue +12 -0
  130. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/popover/index.ts +7 -0
  131. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/select/Select.vue +15 -0
  132. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/select/SelectContent.vue +65 -0
  133. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/select/SelectGroup.vue +26 -0
  134. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/select/SelectItem.vue +41 -0
  135. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/select/SelectLabel.vue +26 -0
  136. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/select/SelectScrollDownButton.vue +32 -0
  137. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/select/SelectScrollUpButton.vue +32 -0
  138. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/select/SelectSeparator.vue +24 -0
  139. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/select/SelectTrigger.vue +45 -0
  140. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/select/SelectValue.vue +12 -0
  141. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/select/index.ts +10 -0
  142. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/separator/Separator.vue +33 -0
  143. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/separator/index.ts +1 -0
  144. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/skeleton/Skeleton.vue +15 -0
  145. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/skeleton/index.ts +1 -0
  146. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/sonner/Sonner.vue +29 -0
  147. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/sonner/index.ts +3 -0
  148. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/spinner/Spinner.vue +17 -0
  149. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/components/ui/spinner/index.ts +1 -0
  150. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/composables/useAsyncData.ts +69 -0
  151. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/features/authentication/api/userProfileApi.ts +107 -0
  152. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/features/authentication/authHelpers.ts +78 -0
  153. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/features/authentication/authenticationConfig.ts +66 -0
  154. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/features/authentication/components/SocialLogin.vue +150 -0
  155. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/features/authentication/composables/useCountdownTimer.ts +246 -0
  156. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/features/authentication/composables/useRetryWithBackoff.ts +112 -0
  157. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/features/authentication/composables/useSessionTimeout.ts +244 -0
  158. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/features/authentication/context/authContext.ts +115 -0
  159. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/features/authentication/footers/FooterLink.vue +47 -0
  160. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/features/authentication/forms/AuthForm.vue +141 -0
  161. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/features/authentication/forms/SubmitButton.vue +57 -0
  162. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/features/authentication/hooks/EmailField.vue +46 -0
  163. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/features/authentication/hooks/PasswordField.vue +48 -0
  164. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/features/authentication/hooks/TextField.vue +106 -0
  165. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/features/authentication/hooks/form.ts +90 -0
  166. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/features/authentication/hooks/formContexts.ts +61 -0
  167. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/features/authentication/layout/CenteredPageLayout.vue +76 -0
  168. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/features/authentication/layouts/AuthAppLayout.vue +24 -0
  169. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/features/authentication/layouts/PrivateRouteLayout.vue +50 -0
  170. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/features/authentication/menu/AuthMenu.vue +143 -0
  171. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/features/authentication/pages/ChangePassword.vue +122 -0
  172. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/features/authentication/pages/ForgotPassword.vue +90 -0
  173. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/features/authentication/pages/Login.vue +106 -0
  174. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/features/authentication/pages/Profile.vue +180 -0
  175. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/features/authentication/pages/Register.vue +135 -0
  176. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/features/authentication/pages/ResetPassword.vue +114 -0
  177. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/features/authentication/sessionTimeout/SessionExpiredAlert.vue +50 -0
  178. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/features/authentication/sessionTimeout/SessionTimeoutValidator.vue +136 -0
  179. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/features/authentication/sessionTimeout/SessionWarningModal.vue +151 -0
  180. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/features/authentication/sessionTimeout/sessionTimeService.ts +142 -0
  181. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/features/authentication/sessionTimeout/sessionTimeoutConfig.ts +82 -0
  182. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/features/authentication/utils/helpers.ts +90 -0
  183. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/features/authentication/utils/queryToSearchParams.ts +33 -0
  184. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/lib/utils.ts +6 -0
  185. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/main.ts +6 -0
  186. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/pages/Home.vue +10 -0
  187. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/pages/NotFound.vue +18 -0
  188. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/router-utils.ts +32 -0
  189. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/router.ts +90 -0
  190. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/styles/global.css +134 -0
  191. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/src/test/setup.ts +1 -0
  192. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/tsconfig.json +45 -0
  193. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/tsconfig.node.json +13 -0
  194. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/tsconfig.tsbuildinfo +1 -0
  195. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/ui-bundle.json +7 -0
  196. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/vite-env.d.ts +14 -0
  197. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/vite.config.ts +106 -0
  198. package/dist/force-app/main/default/uiBundles/feature-vue-authentication/vitest-env.d.ts +2 -0
  199. package/dist/jest.config.js +6 -0
  200. package/dist/package-lock.json +12554 -0
  201. package/dist/package.json +46 -0
  202. package/dist/scripts/apex/hello.apex +10 -0
  203. package/dist/scripts/gitignore-templates.json +4 -0
  204. package/dist/scripts/graphql-search.sh +191 -0
  205. package/dist/scripts/network-senders.mjs +84 -0
  206. package/dist/scripts/org-setup-config-schema.mjs +132 -0
  207. package/dist/scripts/org-setup-dev.mjs +114 -0
  208. package/dist/scripts/org-setup-url.mjs +108 -0
  209. package/dist/scripts/org-setup-utils.mjs +569 -0
  210. package/dist/scripts/org-setup-xml.mjs +283 -0
  211. package/dist/scripts/org-setup.config.json +5 -0
  212. package/dist/scripts/org-setup.mjs +2545 -0
  213. package/dist/scripts/sf-project-setup.mjs +103 -0
  214. package/dist/scripts/soql/account.soql +6 -0
  215. package/dist/scripts/validate-org-setup-config.mjs +38 -0
  216. package/dist/sfdx-project.json +12 -0
  217. package/package.json +44 -4
package/dist/README.md ADDED
@@ -0,0 +1,83 @@
1
+ # Salesforce DX Project: Next Steps
2
+
3
+ Now that you’ve created a Salesforce DX project, what’s next? Here are some documentation resources to get you started.
4
+
5
+ ## Web app: install, build, and dev server
6
+
7
+ From the **SFDX project root** (this directory), run:
8
+
9
+ ```bash
10
+ npm run sf-project-setup
11
+ ```
12
+
13
+ This installs dependencies in the UI Bundle, builds it, and starts the Vite dev server. Use this after cloning or extracting the project.
14
+
15
+ ## Set up the org
16
+
17
+ `npm run setup` configures a target org from this project in one command: it logs in
18
+ (a required precondition — auto-skipped if the org is already connected), deploys
19
+ metadata, assigns permission sets, imports sample data, refreshes the GraphQL
20
+ schema/types, and builds the UI Bundle. When `--target-org` is omitted it uses your
21
+ default org or, in an interactive terminal, prompts you to pick one.
22
+
23
+ ```bash
24
+ npm run setup -- --target-org <alias> # or omit --target-org to use the default / pick
25
+ ```
26
+
27
+ Before each Network deployment, setup reads the target org's existing sender
28
+ address and preserves it in the local metadata. Sender changes must be made in
29
+ the site's Administration settings. For a direct `sf project deploy` command,
30
+ first run `node scripts/network-senders.mjs --target-org <alias>` after generating
31
+ the project.
32
+
33
+ Setup does **not** start the dev server. Once the org is set up, use `dev:preview` to
34
+ refresh the GraphQL types against the org and launch the Vite dev server on its own:
35
+
36
+ ```bash
37
+ npm run dev:preview
38
+ ```
39
+
40
+ ### Setup configuration (`scripts/org-setup.config.json`)
41
+
42
+ `org-setup.config.json` controls which steps run and how. Every top-level section is
43
+ optional; an absent section hides its step. It is validated against a shared schema
44
+ at build/CI time and again at the start of every `npm run setup`, so a malformed
45
+ config fails fast rather than misbehaving.
46
+
47
+ ```jsonc
48
+ {
49
+ "permsetAssignments": {
50
+ "assignments": {
51
+ "My_Access": { "assignee": "currentUser" }
52
+ }
53
+ },
54
+ "role": { "assignee": "currentUser", "roleName": "Admin" },
55
+ "selfRegistration": {
56
+ "selfRegProfile": "My Prospect Profile",
57
+ "accountName": "My Self-Registration"
58
+ }
59
+ }
60
+ ```
61
+
62
+ When a `selfRegistration` section is present, setup runs a **license pre-check**
63
+ before configuring self-registration: it derives the required `UserLicense` from the
64
+ configured `selfRegProfile` (matched on the stable `LicenseDefinitionKey`, not the
65
+ display name) and, if the org lacks that license or has no available seats, **warns
66
+ and skips** self-registration instead of reporting success — so prospect login can't
67
+ silently fail on an under-provisioned org. No separate license field is configured;
68
+ the requirement always follows the profile the flow assigns.
69
+
70
+ ## How Do You Plan to Deploy Your Changes?
71
+
72
+ Do you want to deploy a set of changes, or create a self-contained application? Choose a [development model](https://developer.salesforce.com/tools/vscode/en/user-guide/development-models).
73
+
74
+ ## Configure Your Salesforce DX Project
75
+
76
+ The `sfdx-project.json` file contains useful configuration information for your project. See [Salesforce DX Project Configuration](https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_dev_ws_config.htm) in the _Salesforce DX Developer Guide_ for details about this file.
77
+
78
+ ## Read All About It
79
+
80
+ - [Salesforce Extensions Documentation](https://developer.salesforce.com/tools/vscode/)
81
+ - [Salesforce CLI Setup Guide](https://developer.salesforce.com/docs/atlas.en-us.sfdx_setup.meta/sfdx_setup/sfdx_setup_intro.htm)
82
+ - [Salesforce DX Developer Guide](https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_dev_intro.htm)
83
+ - [Salesforce CLI Command Reference](https://developer.salesforce.com/docs/atlas.en-us.sfdx_cli_reference.meta/sfdx_cli_reference/cli_reference.htm)
@@ -0,0 +1,13 @@
1
+ {
2
+ "orgName": "My Saleforce Org",
3
+ "edition": "Developer",
4
+ "features": ["EnableSetPasswordInApi"],
5
+ "settings": {
6
+ "lightningExperienceSettings": {
7
+ "enableS1DesktopEnabled": true
8
+ },
9
+ "mobileSettings": {
10
+ "enableS1EncryptedStoragePref2": false
11
+ }
12
+ }
13
+ }
@@ -0,0 +1,7 @@
1
+ /**
2
+ * ESLint 9 flat config for LWC and Aura.
3
+ * @see https://github.com/salesforce/eslint-config-lwc
4
+ */
5
+ const lwcConfig = require("@salesforce/eslint-config-lwc");
6
+
7
+ module.exports = [...lwcConfig.configs.recommended];
@@ -0,0 +1,68 @@
1
+ /**
2
+ * Utility class for Web Application authentication REST endpoints.
3
+ */
4
+ public without sharing class UIBundleAuthUtils {
5
+
6
+ /**
7
+ * Exception for authentication errors with HTTP status code support.
8
+ */
9
+ public class AuthException extends Exception {
10
+ public Integer statusCode { get; private set; } // HTTP status code (e.g. 400, 500)
11
+ public List<String> messages { get; private set; } // List of error messages
12
+
13
+ public AuthException(Integer statusCode, String message) {
14
+ this.statusCode = statusCode;
15
+ this.messages = new List<String>{ message };
16
+ }
17
+
18
+ public AuthException(Integer statusCode, List<String> messages) {
19
+ this.statusCode = statusCode;
20
+ this.messages = new List<String>(messages);
21
+ }
22
+ }
23
+
24
+ /**
25
+ * Validates and sanitizes redirect URL to prevent open redirect vulnerabilities.
26
+ * @param url The URL to validate.
27
+ * @param defaultUrl Fallback URL if validation fails.
28
+ * @return Sanitized URL or defaultUrl if invalid.
29
+ */
30
+ public static String getSanitizedStartUrl(String url, String defaultUrl) {
31
+ if (String.isBlank(url) || url.equals('/')) { return defaultUrl; }
32
+
33
+ String decoded; // Decode URL to catch encoded bypasses (%2f%2f -> //)
34
+ try {
35
+ decoded = EncodingUtil.urlDecode(url, 'UTF-8');
36
+ } catch (Exception e) {
37
+ return defaultUrl;
38
+ }
39
+
40
+ // Must start with / but not // (protocol-relative)
41
+ if (!decoded.startsWith('/') || decoded.startsWith('//')) { return defaultUrl; }
42
+ // Reject backslashes (some browsers treat \ as /)
43
+ if (decoded.contains('\\')) { return defaultUrl; }
44
+ // Reject @ which can indicate user info in URL (//user@evil.com)
45
+ if (decoded.contains('@')) { return defaultUrl; }
46
+ // Reject : which could indicate protocol or port manipulation
47
+ if (decoded.contains(':')) { return defaultUrl; }
48
+ // Reject control characters (ASCII < 32) and DEL (127)
49
+ for (Integer i = 0; i < decoded.length(); i++) {
50
+ Integer charCode = decoded.charAt(i);
51
+ if (charCode < 32 || charCode == 127) { return defaultUrl; }
52
+ }
53
+
54
+ return defaultUrl + url;
55
+ }
56
+
57
+ /**
58
+ * Logs an error message and stack trace to the system debug log.
59
+ * It is only captured if a Trace Flag is active for the user.
60
+ *
61
+ * @param ex The exception to log.
62
+ * @param level The logging level to use.
63
+ */
64
+ public static void debugLog(Exception ex, LoggingLevel level) {
65
+ System.debug(level, 'Message: ' + ex.getMessage());
66
+ System.debug(level, 'Stack Trace: ' + ex.getStackTraceString());
67
+ }
68
+ }
@@ -0,0 +1,5 @@
1
+ <?xml version="1.0" encoding="UTF-8" ?>
2
+ <ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
3
+ <apiVersion>67.0</apiVersion>
4
+ <status>Active</status>
5
+ </ApexClass>
@@ -0,0 +1,141 @@
1
+ /**
2
+ * Test class for UIBundleAuthUtils.
3
+ *
4
+ * Focuses on getSanitizedStartUrl, the shared open-redirect (CWE-601) guard
5
+ * used by UIBundleLogin, UIBundleRegistration and UIBundleSocialLoginConfig.
6
+ * Every rejection path and the safe-path prefixing
7
+ * behavior are asserted deterministically with an explicit path prefix.
8
+ */
9
+ @isTest
10
+ private class UIBundleAuthUtils_Test {
11
+
12
+ // Explicit, non-null community path prefix so behavior is deterministic
13
+ // (Site.getPathPrefix() is null/blank in a plain unit-test context).
14
+ private static final String PREFIX = '/community';
15
+
16
+ // ---- Safe / allowed inputs ----------------------------------------------
17
+
18
+ @isTest
19
+ static void allowsSafeRelativePath() {
20
+ System.assertEquals(
21
+ '/community/dashboard',
22
+ UIBundleAuthUtils.getSanitizedStartUrl('/dashboard', PREFIX),
23
+ 'A safe community-relative path should be prefixed and preserved'
24
+ );
25
+ }
26
+
27
+ @isTest
28
+ static void allowsNestedRelativePath() {
29
+ System.assertEquals(
30
+ '/community/safe/relative/path',
31
+ UIBundleAuthUtils.getSanitizedStartUrl('/safe/relative/path', PREFIX),
32
+ 'A nested relative path should be prefixed and preserved'
33
+ );
34
+ }
35
+
36
+ @isTest
37
+ static void blankAndRootFallBackToDefault() {
38
+ System.assertEquals(PREFIX, UIBundleAuthUtils.getSanitizedStartUrl(null, PREFIX), 'null -> default');
39
+ System.assertEquals(PREFIX, UIBundleAuthUtils.getSanitizedStartUrl('', PREFIX), 'empty -> default');
40
+ System.assertEquals(PREFIX, UIBundleAuthUtils.getSanitizedStartUrl(' ', PREFIX), 'whitespace -> default');
41
+ System.assertEquals(PREFIX, UIBundleAuthUtils.getSanitizedStartUrl('/', PREFIX), '"/" -> default');
42
+ }
43
+
44
+ // ---- Rejected / malicious inputs (all fall back to the default) ----------
45
+
46
+ @isTest
47
+ static void rejectsAbsoluteHttpUrl() {
48
+ System.assertEquals(
49
+ PREFIX,
50
+ UIBundleAuthUtils.getSanitizedStartUrl('https://evil-attacker.com', PREFIX),
51
+ 'Absolute http(s) URL must be rejected'
52
+ );
53
+ }
54
+
55
+ @isTest
56
+ static void rejectsProtocolRelativeUrl() {
57
+ System.assertEquals(
58
+ PREFIX,
59
+ UIBundleAuthUtils.getSanitizedStartUrl('//evil-attacker.com', PREFIX),
60
+ 'Protocol-relative URL must be rejected'
61
+ );
62
+ }
63
+
64
+ @isTest
65
+ static void rejectsAmbiguousScheme() {
66
+ System.assertEquals(
67
+ PREFIX,
68
+ UIBundleAuthUtils.getSanitizedStartUrl('https:evil-attacker.com', PREFIX),
69
+ 'Malformed/ambiguous scheme must be rejected'
70
+ );
71
+ }
72
+
73
+ @isTest
74
+ static void rejectsBackslashVariant() {
75
+ System.assertEquals(
76
+ PREFIX,
77
+ UIBundleAuthUtils.getSanitizedStartUrl('/\\evil-attacker.com', PREFIX),
78
+ 'Backslash normalization trick must be rejected'
79
+ );
80
+ }
81
+
82
+ @isTest
83
+ static void rejectsAtSign() {
84
+ System.assertEquals(
85
+ PREFIX,
86
+ UIBundleAuthUtils.getSanitizedStartUrl('/x@evil-attacker.com', PREFIX),
87
+ 'User-info "@" must be rejected'
88
+ );
89
+ }
90
+
91
+ @isTest
92
+ static void rejectsColon() {
93
+ System.assertEquals(
94
+ PREFIX,
95
+ UIBundleAuthUtils.getSanitizedStartUrl('/path:8080', PREFIX),
96
+ 'Colon (port/scheme manipulation) must be rejected'
97
+ );
98
+ }
99
+
100
+ @isTest
101
+ static void rejectsEncodedProtocolRelativeBypass() {
102
+ // %2f%2f decodes to // — the decode step must catch this.
103
+ System.assertEquals(
104
+ PREFIX,
105
+ UIBundleAuthUtils.getSanitizedStartUrl('%2f%2fevil-attacker.com', PREFIX),
106
+ 'URL-encoded protocol-relative bypass must be rejected'
107
+ );
108
+ }
109
+
110
+ @isTest
111
+ static void rejectsControlCharacters() {
112
+ String withNewline = '/foo' + String.fromCharArray(new List<Integer>{ 10 }) + 'bar';
113
+ System.assertEquals(
114
+ PREFIX,
115
+ UIBundleAuthUtils.getSanitizedStartUrl(withNewline, PREFIX),
116
+ 'Embedded control characters must be rejected'
117
+ );
118
+ }
119
+
120
+ // ---- Supporting API coverage --------------------------------------------
121
+
122
+ @isTest
123
+ static void authExceptionCarriesStatusAndMessages() {
124
+ UIBundleAuthUtils.AuthException single = new UIBundleAuthUtils.AuthException(400, 'bad request');
125
+ System.assertEquals(400, single.statusCode, 'statusCode should round-trip');
126
+ System.assertEquals(1, single.messages.size(), 'single-message constructor');
127
+
128
+ UIBundleAuthUtils.AuthException multi =
129
+ new UIBundleAuthUtils.AuthException(500, new List<String>{ 'a', 'b' });
130
+ System.assertEquals(500, multi.statusCode, 'statusCode should round-trip');
131
+ System.assertEquals(2, multi.messages.size(), 'multi-message constructor');
132
+ }
133
+
134
+ @isTest
135
+ static void debugLogCompletesWithoutError() {
136
+ Test.startTest();
137
+ UIBundleAuthUtils.debugLog(new IllegalArgumentException('boom'), LoggingLevel.ERROR);
138
+ Test.stopTest();
139
+ System.assert(true, 'debugLog should complete without throwing');
140
+ }
141
+ }
@@ -0,0 +1,5 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
3
+ <apiVersion>67.0</apiVersion>
4
+ <status>Active</status>
5
+ </ApexClass>
@@ -0,0 +1,77 @@
1
+ /**
2
+ * Web Applications REST endpoint for authenticated user password changes.
3
+ *
4
+ * Endpoint: POST /services/apexrest/auth/change-password
5
+ *
6
+ * Allows authenticated users to change their password by providing their current password
7
+ * and a new password. The new password is validated against org password policies.
8
+ *
9
+ * Security: Uses 'with sharing' to enforce user-level security. Only authenticated users
10
+ * can change their own password.
11
+ */
12
+ @RestResource(urlMapping='/auth/change-password')
13
+ global with sharing class UIBundleChangePassword {
14
+
15
+ /**
16
+ * Changes the password for the currently authenticated user.
17
+ *
18
+ * @param newPassword The new password to set.
19
+ * @param currentPassword The user's current password for verification.
20
+ * @return SuccessPasswordChangeResponse on success, ErrorPasswordChangeResponse on failure.
21
+ */
22
+ @HttpPost
23
+ global static PasswordChangeResponse changePassword(String newPassword, String currentPassword) {
24
+ Savepoint sp = Database.setSavepoint();
25
+ try {
26
+ // newPassword and confirmPassword should be validated to be the same value on the client
27
+ Site.changePassword(newPassword, newPassword, currentPassword);
28
+ return new SuccessPasswordChangeResponse();
29
+ } catch (Exception ex) {
30
+ Database.rollback(sp);
31
+
32
+ // System.SecurityException is a user error but treat others as system errors
33
+ if (ex instanceof System.SecurityException) {
34
+ RestContext.response.statusCode = 400;
35
+ return new ErrorPasswordChangeResponse(ex.getMessage());
36
+ }
37
+
38
+ // Logs are only captured if a Trace Flag is active for the user
39
+ UIBundleAuthUtils.debugLog(ex, LoggingLevel.ERROR);
40
+
41
+ RestContext.response.statusCode = 500;
42
+ return new ErrorPasswordChangeResponse('Password change failed');
43
+ }
44
+ }
45
+
46
+ /** Base response class for password change operations. */
47
+ global abstract class PasswordChangeResponse {
48
+
49
+ /** Success or failure of the password change operation */
50
+ protected final Boolean success;
51
+ }
52
+
53
+ /** Success response for password change. */
54
+ global class SuccessPasswordChangeResponse extends PasswordChangeResponse {
55
+
56
+ /** Constructs a success response. */
57
+ private SuccessPasswordChangeResponse() {
58
+ this.success = true;
59
+ }
60
+ }
61
+
62
+ /** Error response for password change. */
63
+ global class ErrorPasswordChangeResponse extends PasswordChangeResponse {
64
+
65
+ /** Error message describing the failure reason */
66
+ private final String error;
67
+
68
+ /**
69
+ * Constructs an error response with the specified error message.
70
+ * @param error The error message to return to the client.
71
+ */
72
+ private ErrorPasswordChangeResponse(String error) {
73
+ this.success = false;
74
+ this.error = error;
75
+ }
76
+ }
77
+ }
@@ -0,0 +1,5 @@
1
+ <?xml version="1.0" encoding="UTF-8" ?>
2
+ <ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
3
+ <apiVersion>67.0</apiVersion>
4
+ <status>Active</status>
5
+ </ApexClass>
@@ -0,0 +1,71 @@
1
+ /**
2
+ * REST endpoint for Web Applications forgot password functionality.
3
+ *
4
+ * Endpoint: POST /services/apexrest/auth/forgot-password
5
+ *
6
+ * Sends a password reset email to the user's registered email address.
7
+ */
8
+ @RestResource(urlMapping='/auth/forgot-password')
9
+ global with sharing class UIBundleForgotPassword {
10
+
11
+ /**
12
+ * Initiates the forgot password process by sending a reset email.
13
+ * @param email User's email address (used as username).
14
+ * @return ForgotPasswordResponse with success status or error message.
15
+ */
16
+ @HttpPost
17
+ global static ForgotPasswordResponse forgotPassword(String username) {
18
+ try {
19
+ username = username.trim().toLowerCase();
20
+
21
+ if (String.isBlank(username)) {
22
+ RestContext.response.statusCode = 400;
23
+ return new ErrorForgotPasswordResponse('Username is required.');
24
+ }
25
+
26
+ // [Dev Note] This will send a password reset link to the user's email address
27
+ // if the username exists.
28
+ Site.forgotPassword(username);
29
+
30
+ return new SuccessForgotPasswordResponse();
31
+ } catch (Exception ex) {
32
+ // Logs are only captured if a Trace Flag is active for the user
33
+ UIBundleAuthUtils.debugLog(ex, LoggingLevel.ERROR);
34
+
35
+ RestContext.response.statusCode = 500;
36
+ return new ErrorForgotPasswordResponse('Could not send password reset link.');
37
+ }
38
+ }
39
+
40
+ /** Base response class for forgot password operations. */
41
+ global abstract class ForgotPasswordResponse {
42
+
43
+ /** Success or failure of the forgot password operation */
44
+ protected final Boolean success;
45
+ }
46
+
47
+ /** Success response for forgot password. */
48
+ global class SuccessForgotPasswordResponse extends ForgotPasswordResponse {
49
+
50
+ /** Constructs a success response. */
51
+ private SuccessForgotPasswordResponse() {
52
+ this.success = true;
53
+ }
54
+ }
55
+
56
+ /** Error response for forgot password. */
57
+ global class ErrorForgotPasswordResponse extends ForgotPasswordResponse {
58
+
59
+ /** Error message describing the failure reason */
60
+ private final String error;
61
+
62
+ /**
63
+ * Constructs an error response with the specified error message.
64
+ * @param error The error message to return to the client.
65
+ */
66
+ private ErrorForgotPasswordResponse(String error) {
67
+ this.success = false;
68
+ this.error = error;
69
+ }
70
+ }
71
+ }
@@ -0,0 +1,5 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
3
+ <apiVersion>67.0</apiVersion>
4
+ <status>Active</status>
5
+ </ApexClass>
@@ -0,0 +1,105 @@
1
+ /**
2
+ * REST endpoint for Web Applications user login.
3
+ *
4
+ * Endpoint: POST /services/apexrest/auth/login
5
+ *
6
+ * Authenticates a user and returns a redirect URL for session creation.
7
+ *
8
+ * @see https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_classes_sites.htm#apex_System_Site_login
9
+ */
10
+ @RestResource(urlMapping='/auth/login')
11
+ global with sharing class UIBundleLogin {
12
+
13
+ /**
14
+ * Authenticates a user and returns a redirect URL.
15
+ * @param email User's email address (used as username).
16
+ * @param password User's password.
17
+ * @param startUrl Optional URL to redirect to after login.
18
+ * @return LoginResponse with redirectUrl on success, or error message on failure.
19
+ */
20
+ @HttpPost
21
+ global static LoginResponse doLogin(String email, String password, String startUrl) {
22
+ try {
23
+ validateInput(email, password);
24
+
25
+ String username = email.trim().toLowerCase();
26
+ String sanitizedStartUrl = UIBundleAuthUtils.getSanitizedStartUrl(startUrl, Site.getPathPrefix());
27
+
28
+ PageReference loginResult;
29
+ try {
30
+ loginResult = Site.login(username, password, sanitizedStartUrl);
31
+ } catch (Exception loginEx) {
32
+ RestContext.response.statusCode = 400;
33
+ return new ErrorLoginResponse('Invalid username or password.');
34
+ }
35
+
36
+ if (loginResult != null) {
37
+ return new SuccessLoginResponse(loginResult.getUrl());
38
+ } else {
39
+ RestContext.response.statusCode = 401;
40
+ return new ErrorLoginResponse(
41
+ 'Your login attempt has failed. Make sure the username and password are correct.'
42
+ );
43
+ }
44
+ } catch (UIBundleAuthUtils.AuthException ex) {
45
+ RestContext.response.statusCode = ex.statusCode;
46
+ return new ErrorLoginResponse(ex.messages);
47
+ } catch (Exception ex) {
48
+ UIBundleAuthUtils.debugLog(ex, LoggingLevel.ERROR);
49
+ RestContext.response.statusCode = 500;
50
+ return new ErrorLoginResponse('An unexpected error occurred. Please contact your administrator.');
51
+ }
52
+ }
53
+
54
+ /**
55
+ * Validates login input fields.
56
+ * @param email The email to validate.
57
+ * @param password The password to validate.
58
+ * @throws UIBundleAuthUtils.AuthException if validation fails.
59
+ */
60
+ private static void validateInput(String email, String password) {
61
+ List<String> errors = new List<String>();
62
+ if (String.isBlank(email)) {
63
+ errors.add('Email is required.');
64
+ }
65
+ if (String.isBlank(password)) {
66
+ errors.add('Password is required.');
67
+ }
68
+ if (!errors.isEmpty()) {
69
+ throw new UIBundleAuthUtils.AuthException(400, errors);
70
+ }
71
+ }
72
+
73
+ /**
74
+ * Base response class for login.
75
+ */
76
+ global abstract class LoginResponse {
77
+ }
78
+
79
+ /**
80
+ * Success response with redirect URL.
81
+ */
82
+ global class SuccessLoginResponse extends LoginResponse {
83
+ global Boolean success = true;
84
+ global String redirectUrl;
85
+
86
+ global SuccessLoginResponse(String redirectUrl) {
87
+ this.redirectUrl = redirectUrl;
88
+ }
89
+ }
90
+
91
+ /**
92
+ * Error response with error messages.
93
+ */
94
+ global class ErrorLoginResponse extends LoginResponse {
95
+ global List<String> errors;
96
+
97
+ global ErrorLoginResponse(List<String> errors) {
98
+ this.errors = new List<String>(errors);
99
+ }
100
+
101
+ global ErrorLoginResponse(String error) {
102
+ this.errors = new List<String>{ error };
103
+ }
104
+ }
105
+ }
@@ -0,0 +1,5 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
3
+ <apiVersion>67.0</apiVersion>
4
+ <status>Active</status>
5
+ </ApexClass>