kaze 0.4.0 → 0.6.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 (141) hide show
  1. checksums.yaml +4 -4
  2. data/lib/kaze/commands/install_command.rb +25 -13
  3. data/lib/kaze/commands/installs_hotwire_stack.rb +11 -8
  4. data/lib/kaze/commands/installs_inertia_stacks.rb +34 -24
  5. data/lib/kaze/commands/version_command.rb +6 -0
  6. data/lib/kaze/version.rb +1 -1
  7. data/lib/kaze.rb +1 -3
  8. data/stubs/default/app/forms/auth/login_form.rb +2 -8
  9. data/stubs/default/app/forms/auth/new_password_form.rb +1 -1
  10. data/stubs/default/app/forms/update_profile_information_form.rb +1 -1
  11. data/stubs/default/app/mailers/application_mailer.rb +4 -4
  12. data/stubs/default/app/mailers/user_mailer.rb +1 -1
  13. data/stubs/default/app/models/auth.rb +57 -0
  14. data/stubs/default/app/models/current.rb +1 -1
  15. data/stubs/default/app/validators/current_password_validator.rb +1 -1
  16. data/stubs/default/app/validators/email_validator.rb +1 -1
  17. data/stubs/default/app/validators/lowercase_validator.rb +2 -2
  18. data/stubs/default/app/views/layouts/mailer.html.erb +367 -372
  19. data/stubs/default/app/views/layouts/mailer.text.erb +1 -4
  20. data/stubs/default/app/views/user_mailer/reset_password.html.erb +21 -26
  21. data/stubs/default/config/routes.rb +16 -16
  22. data/stubs/default/db/migrate/20240101000001_create_delayed_jobs.rb +1 -1
  23. data/stubs/default/test/factories/users.rb +7 -0
  24. data/stubs/default/test/integration/auth/authentication_test.rb +43 -0
  25. data/stubs/default/test/integration/auth/password_reset_test.rb +41 -0
  26. data/stubs/default/test/integration/auth/registration_test.rb +21 -0
  27. data/stubs/default/test/integration/password_update_test.rb +28 -0
  28. data/stubs/default/test/integration/profile_test.rb +51 -0
  29. data/stubs/default/test/test_helper.rb +38 -0
  30. data/stubs/hotwire/app/components/danger_button_component.rb +1 -1
  31. data/stubs/hotwire/app/components/dropdown_component.html.erb +17 -18
  32. data/stubs/hotwire/app/components/dropdown_component.rb +7 -7
  33. data/stubs/hotwire/app/components/modal_component.html.erb +55 -59
  34. data/stubs/hotwire/app/components/modal_component.rb +6 -6
  35. data/stubs/hotwire/app/components/primary_button_component.rb +1 -1
  36. data/stubs/hotwire/app/components/secondary_button_component.rb +1 -1
  37. data/stubs/hotwire/app/controllers/application_controller.rb +1 -0
  38. data/stubs/hotwire/app/controllers/auth/authenticated_session_controller.rb +12 -9
  39. data/stubs/hotwire/app/controllers/auth/new_password_controller.rb +7 -5
  40. data/stubs/hotwire/app/controllers/auth/password_reset_link_controller.rb +7 -5
  41. data/stubs/hotwire/app/controllers/auth/registered_user_controller.rb +7 -5
  42. data/stubs/hotwire/app/controllers/concerns/authenticate.rb +5 -20
  43. data/stubs/hotwire/app/controllers/concerns/redirect_if_authenticated.rb +19 -0
  44. data/stubs/hotwire/app/controllers/concerns/set_current_auth.rb +9 -0
  45. data/stubs/hotwire/app/controllers/password_controller.rb +3 -3
  46. data/stubs/hotwire/app/controllers/profile_controller.rb +11 -9
  47. data/stubs/hotwire/app/controllers/welcome_controller.rb +1 -1
  48. data/stubs/hotwire/app/javascript/application.js +3 -3
  49. data/stubs/hotwire/app/views/auth/forgot_password.html.erb +12 -17
  50. data/stubs/hotwire/app/views/auth/login.html.erb +0 -9
  51. data/stubs/hotwire/app/views/auth/register.html.erb +0 -13
  52. data/stubs/hotwire/app/views/auth/reset_password.html.erb +0 -7
  53. data/stubs/hotwire/app/views/dashboard/index.html.erb +9 -10
  54. data/stubs/hotwire/app/views/layouts/_navigation.html.erb +77 -87
  55. data/stubs/hotwire/app/views/layouts/application.html.erb +0 -9
  56. data/stubs/hotwire/app/views/layouts/guest.html.erb +0 -6
  57. data/stubs/hotwire/app/views/profile/edit.html.erb +19 -22
  58. data/stubs/hotwire/app/views/profile/partials/_delete_user_form.html.erb +32 -42
  59. data/stubs/hotwire/app/views/profile/partials/_update_password_form.html.erb +42 -55
  60. data/stubs/hotwire/app/views/profile/partials/_update_profile_information_form.html.erb +36 -46
  61. data/stubs/hotwire/app/views/welcome/index.html.erb +34 -46
  62. data/stubs/hotwire/config/importmap.rb +3 -3
  63. data/stubs/hotwire/config/tailwind.config.js +2 -2
  64. data/stubs/inertia-common/app/controllers/application_controller.rb +1 -0
  65. data/stubs/inertia-common/app/controllers/auth/authenticated_session_controller.rb +11 -8
  66. data/stubs/inertia-common/app/controllers/auth/new_password_controller.rb +5 -3
  67. data/stubs/inertia-common/app/controllers/auth/password_reset_link_controller.rb +5 -3
  68. data/stubs/inertia-common/app/controllers/auth/registered_user_controller.rb +5 -3
  69. data/stubs/inertia-common/app/controllers/concerns/authenticate.rb +5 -20
  70. data/stubs/inertia-common/app/controllers/concerns/handle_inertia_requests.rb +1 -1
  71. data/stubs/inertia-common/app/controllers/concerns/redirect_if_authenticated.rb +19 -0
  72. data/stubs/inertia-common/app/controllers/concerns/set_current_auth.rb +9 -0
  73. data/stubs/inertia-common/app/controllers/concerns/verify_csrf_token.rb +4 -4
  74. data/stubs/inertia-common/app/controllers/dashboard_controller.rb +1 -1
  75. data/stubs/inertia-common/app/controllers/password_controller.rb +1 -1
  76. data/stubs/inertia-common/app/controllers/profile_controller.rb +7 -5
  77. data/stubs/inertia-common/app/controllers/welcome_controller.rb +2 -2
  78. data/stubs/inertia-common/bin/vite +6 -6
  79. data/stubs/inertia-common/test/integration/password_update_test.rb +28 -0
  80. data/stubs/inertia-common/test/integration/profile_test.rb +51 -0
  81. data/stubs/inertia-react-ts/app/javascript/Components/ApplicationLogo.tsx +13 -9
  82. data/stubs/inertia-react-ts/app/javascript/Components/Checkbox.tsx +15 -12
  83. data/stubs/inertia-react-ts/app/javascript/Components/DangerButton.tsx +20 -15
  84. data/stubs/inertia-react-ts/app/javascript/Components/Dropdown.tsx +119 -87
  85. data/stubs/inertia-react-ts/app/javascript/Components/InputError.tsx +14 -7
  86. data/stubs/inertia-react-ts/app/javascript/Components/InputLabel.tsx +18 -7
  87. data/stubs/inertia-react-ts/app/javascript/Components/Modal.tsx +60 -60
  88. data/stubs/inertia-react-ts/app/javascript/Components/NavLink.tsx +21 -16
  89. data/stubs/inertia-react-ts/app/javascript/Components/PrimaryButton.tsx +20 -15
  90. data/stubs/inertia-react-ts/app/javascript/Components/ResponsiveNavLink.tsx +19 -14
  91. data/stubs/inertia-react-ts/app/javascript/Components/SecondaryButton.tsx +22 -16
  92. data/stubs/inertia-react-ts/app/javascript/Components/TextInput.tsx +35 -24
  93. data/stubs/inertia-react-ts/app/javascript/Layouts/AuthenticatedLayout.tsx +157 -117
  94. data/stubs/inertia-react-ts/app/javascript/Layouts/GuestLayout.tsx +15 -15
  95. data/stubs/inertia-react-ts/app/javascript/Pages/Auth/ForgotPassword.tsx +52 -49
  96. data/stubs/inertia-react-ts/app/javascript/Pages/Auth/Login.tsx +90 -82
  97. data/stubs/inertia-react-ts/app/javascript/Pages/Auth/Register.tsx +118 -115
  98. data/stubs/inertia-react-ts/app/javascript/Pages/Auth/ResetPassword.tsx +63 -60
  99. data/stubs/inertia-react-ts/app/javascript/Pages/Dashboard.tsx +23 -17
  100. data/stubs/inertia-react-ts/app/javascript/Pages/Profile/Edit.tsx +31 -27
  101. data/stubs/inertia-react-ts/app/javascript/Pages/Profile/Partials/DeleteUserForm.tsx +109 -99
  102. data/stubs/inertia-react-ts/app/javascript/Pages/Profile/Partials/UpdatePasswordForm.tsx +121 -113
  103. data/stubs/inertia-react-ts/app/javascript/Pages/Profile/Partials/UpdateProfileInformationForm.tsx +76 -69
  104. data/stubs/inertia-react-ts/app/javascript/Pages/Welcome.tsx +87 -63
  105. data/stubs/inertia-react-ts/app/javascript/entrypoints/application.tsx +32 -25
  106. data/stubs/inertia-react-ts/app/views/layouts/application.html.erb +0 -4
  107. data/stubs/inertia-react-ts/config/tailwind.config.js +2 -2
  108. data/stubs/inertia-react-ts/vite.config.ts +2 -5
  109. data/stubs/inertia-vue-ts/app/javascript/Components/ApplicationLogo.vue +10 -6
  110. data/stubs/inertia-vue-ts/app/javascript/Components/Checkbox.vue +18 -18
  111. data/stubs/inertia-vue-ts/app/javascript/Components/DangerButton.vue +5 -5
  112. data/stubs/inertia-vue-ts/app/javascript/Components/Dropdown.vue +60 -57
  113. data/stubs/inertia-vue-ts/app/javascript/Components/DropdownLink.vue +9 -9
  114. data/stubs/inertia-vue-ts/app/javascript/Components/InputError.vue +7 -7
  115. data/stubs/inertia-vue-ts/app/javascript/Components/InputLabel.vue +6 -6
  116. data/stubs/inertia-vue-ts/app/javascript/Components/Modal.vue +84 -74
  117. data/stubs/inertia-vue-ts/app/javascript/Components/NavLink.vue +12 -12
  118. data/stubs/inertia-vue-ts/app/javascript/Components/PrimaryButton.vue +5 -5
  119. data/stubs/inertia-vue-ts/app/javascript/Components/ResponsiveNavLink.vue +12 -12
  120. data/stubs/inertia-vue-ts/app/javascript/Components/SecondaryButton.vue +13 -13
  121. data/stubs/inertia-vue-ts/app/javascript/Components/TextInput.vue +13 -13
  122. data/stubs/inertia-vue-ts/app/javascript/Layouts/AuthenticatedLayout.vue +168 -136
  123. data/stubs/inertia-vue-ts/app/javascript/Layouts/GuestLayout.vue +15 -13
  124. data/stubs/inertia-vue-ts/app/javascript/Pages/Auth/ForgotPassword.vue +56 -49
  125. data/stubs/inertia-vue-ts/app/javascript/Pages/Auth/Login.vue +78 -72
  126. data/stubs/inertia-vue-ts/app/javascript/Pages/Auth/Register.vue +101 -97
  127. data/stubs/inertia-vue-ts/app/javascript/Pages/Auth/ResetPassword.vue +71 -68
  128. data/stubs/inertia-vue-ts/app/javascript/Pages/Dashboard.vue +22 -14
  129. data/stubs/inertia-vue-ts/app/javascript/Pages/Profile/Edit.vue +34 -30
  130. data/stubs/inertia-vue-ts/app/javascript/Pages/Profile/Partials/DeleteUserForm.vue +87 -83
  131. data/stubs/inertia-vue-ts/app/javascript/Pages/Profile/Partials/UpdatePasswordForm.vue +105 -98
  132. data/stubs/inertia-vue-ts/app/javascript/Pages/Profile/Partials/UpdateProfileInformationForm.vue +69 -59
  133. data/stubs/inertia-vue-ts/app/javascript/Pages/Welcome.vue +74 -47
  134. data/stubs/inertia-vue-ts/app/views/layouts/application.html.erb +0 -4
  135. data/stubs/inertia-vue-ts/config/tailwind.config.js +2 -2
  136. data/stubs/inertia-vue-ts/vite.config.ts +2 -5
  137. metadata +19 -6
  138. data/stubs/hotwire/bin/vite +0 -27
  139. data/stubs/inertia-common/Procfile.dev +0 -3
  140. /data/stubs/{hotwire → default}/Procfile.dev +0 -0
  141. /data/stubs/hotwire/app/javascript/{alpinejs.js → alpinejs.stub} +0 -0
@@ -1,42 +1,46 @@
1
1
  <script setup lang="ts">
2
- import AuthenticatedLayout from '@/Layouts/AuthenticatedLayout.vue';
3
- import DeleteUserForm from './Partials/DeleteUserForm.vue';
4
- import UpdatePasswordForm from './Partials/UpdatePasswordForm.vue';
5
- import UpdateProfileInformationForm from './Partials/UpdateProfileInformationForm.vue';
6
- import { Head } from '@inertiajs/vue3';
2
+ import AuthenticatedLayout from '@/Layouts/AuthenticatedLayout.vue'
3
+ import DeleteUserForm from './Partials/DeleteUserForm.vue'
4
+ import UpdatePasswordForm from './Partials/UpdatePasswordForm.vue'
5
+ import UpdateProfileInformationForm from './Partials/UpdateProfileInformationForm.vue'
6
+ import { Head } from '@inertiajs/vue3'
7
7
 
8
8
  defineProps<{
9
- mustVerifyEmail?: boolean;
10
- status?: string;
11
- }>();
9
+ mustVerifyEmail?: boolean
10
+ status?: string
11
+ }>()
12
12
  </script>
13
13
 
14
14
  <template>
15
- <Head title="Profile" />
15
+ <Head title="Profile" />
16
16
 
17
- <AuthenticatedLayout>
18
- <template #header>
19
- <h2 class="font-semibold text-xl text-gray-800 dark:text-gray-200 leading-tight">Profile</h2>
20
- </template>
17
+ <AuthenticatedLayout>
18
+ <template #header>
19
+ <h2
20
+ class="font-semibold text-xl text-gray-800 dark:text-gray-200 leading-tight"
21
+ >
22
+ Profile
23
+ </h2>
24
+ </template>
21
25
 
22
- <div class="py-12">
23
- <div class="max-w-7xl mx-auto sm:px-6 lg:px-8 space-y-6">
24
- <div class="p-4 sm:p-8 bg-white dark:bg-gray-800 shadow sm:rounded-lg">
25
- <UpdateProfileInformationForm
26
- :must-verify-email="mustVerifyEmail"
27
- :status="status"
28
- class="max-w-xl"
29
- />
30
- </div>
26
+ <div class="py-12">
27
+ <div class="max-w-7xl mx-auto sm:px-6 lg:px-8 space-y-6">
28
+ <div class="p-4 sm:p-8 bg-white dark:bg-gray-800 shadow sm:rounded-lg">
29
+ <UpdateProfileInformationForm
30
+ :must-verify-email="mustVerifyEmail"
31
+ :status="status"
32
+ class="max-w-xl"
33
+ />
34
+ </div>
31
35
 
32
- <div class="p-4 sm:p-8 bg-white dark:bg-gray-800 shadow sm:rounded-lg">
33
- <UpdatePasswordForm class="max-w-xl" />
34
- </div>
36
+ <div class="p-4 sm:p-8 bg-white dark:bg-gray-800 shadow sm:rounded-lg">
37
+ <UpdatePasswordForm class="max-w-xl" />
38
+ </div>
35
39
 
36
- <div class="p-4 sm:p-8 bg-white dark:bg-gray-800 shadow sm:rounded-lg">
37
- <DeleteUserForm class="max-w-xl" />
38
- </div>
39
- </div>
40
+ <div class="p-4 sm:p-8 bg-white dark:bg-gray-800 shadow sm:rounded-lg">
41
+ <DeleteUserForm class="max-w-xl" />
40
42
  </div>
41
- </AuthenticatedLayout>
43
+ </div>
44
+ </div>
45
+ </AuthenticatedLayout>
42
46
  </template>
@@ -1,98 +1,102 @@
1
1
  <script setup lang="ts">
2
- import DangerButton from '@/Components/DangerButton.vue';
3
- import InputError from '@/Components/InputError.vue';
4
- import InputLabel from '@/Components/InputLabel.vue';
5
- import Modal from '@/Components/Modal.vue';
6
- import SecondaryButton from '@/Components/SecondaryButton.vue';
7
- import TextInput from '@/Components/TextInput.vue';
8
- import { useForm } from '@inertiajs/vue3';
9
- import { nextTick, ref } from 'vue';
10
- import { profile_destroy_path } from '@/routes';
11
-
12
- const confirmingUserDeletion = ref(false);
13
- const passwordInput = ref<HTMLInputElement | null>(null);
2
+ import DangerButton from '@/Components/DangerButton.vue'
3
+ import InputError from '@/Components/InputError.vue'
4
+ import InputLabel from '@/Components/InputLabel.vue'
5
+ import Modal from '@/Components/Modal.vue'
6
+ import SecondaryButton from '@/Components/SecondaryButton.vue'
7
+ import TextInput from '@/Components/TextInput.vue'
8
+ import { useForm } from '@inertiajs/vue3'
9
+ import { nextTick, ref } from 'vue'
10
+ import { profile_destroy_path } from '@/routes'
11
+
12
+ const confirmingUserDeletion = ref(false)
13
+ const passwordInput = ref<HTMLInputElement | null>(null)
14
14
 
15
15
  const form = useForm({
16
- password: '',
17
- });
16
+ password: '',
17
+ })
18
18
 
19
19
  const confirmUserDeletion = () => {
20
- confirmingUserDeletion.value = true;
20
+ confirmingUserDeletion.value = true
21
21
 
22
- nextTick(() => passwordInput.value?.focus());
23
- };
22
+ nextTick(() => passwordInput.value?.focus())
23
+ }
24
24
 
25
25
  const deleteUser = () => {
26
- form.delete(profile_destroy_path(), {
27
- preserveScroll: true,
28
- onSuccess: () => closeModal(),
29
- onError: () => passwordInput.value?.focus(),
30
- onFinish: () => {
31
- form.reset();
32
- },
33
- });
34
- };
26
+ form.delete(profile_destroy_path(), {
27
+ preserveScroll: true,
28
+ onSuccess: () => closeModal(),
29
+ onError: () => passwordInput.value?.focus(),
30
+ onFinish: () => {
31
+ form.reset()
32
+ },
33
+ })
34
+ }
35
35
 
36
36
  const closeModal = () => {
37
- confirmingUserDeletion.value = false;
37
+ confirmingUserDeletion.value = false
38
38
 
39
- form.reset();
40
- };
39
+ form.reset()
40
+ }
41
41
  </script>
42
42
 
43
43
  <template>
44
- <section class="space-y-6">
45
- <header>
46
- <h2 class="text-lg font-medium text-gray-900 dark:text-gray-100">Delete Account</h2>
47
-
48
- <p class="mt-1 text-sm text-gray-600 dark:text-gray-400">
49
- Once your account is deleted, all of its resources and data will be permanently deleted. Before deleting
50
- your account, please download any data or information that you wish to retain.
51
- </p>
52
- </header>
53
-
54
- <DangerButton @click="confirmUserDeletion">Delete Account</DangerButton>
55
-
56
- <Modal :show="confirmingUserDeletion" @close="closeModal">
57
- <div class="p-6">
58
- <h2 class="text-lg font-medium text-gray-900 dark:text-gray-100">
59
- Are you sure you want to delete your account?
60
- </h2>
61
-
62
- <p class="mt-1 text-sm text-gray-600 dark:text-gray-400">
63
- Once your account is deleted, all of its resources and data will be permanently deleted. Please
64
- enter your password to confirm you would like to permanently delete your account.
65
- </p>
66
-
67
- <div class="mt-6">
68
- <InputLabel for="password" value="Password" class="sr-only" />
69
-
70
- <TextInput
71
- id="password"
72
- ref="passwordInput"
73
- v-model="form.password"
74
- type="password"
75
- class="mt-1 block w-3/4"
76
- placeholder="Password"
77
- @keyup.enter="deleteUser"
78
- />
79
-
80
- <InputError :message="form.errors.password" class="mt-2" />
81
- </div>
82
-
83
- <div class="mt-6 flex justify-end">
84
- <SecondaryButton @click="closeModal"> Cancel </SecondaryButton>
85
-
86
- <DangerButton
87
- class="ms-3"
88
- :class="{ 'opacity-25': form.processing }"
89
- :disabled="form.processing"
90
- @click="deleteUser"
91
- >
92
- Delete Account
93
- </DangerButton>
94
- </div>
95
- </div>
96
- </Modal>
97
- </section>
44
+ <section class="space-y-6">
45
+ <header>
46
+ <h2 class="text-lg font-medium text-gray-900 dark:text-gray-100">
47
+ Delete Account
48
+ </h2>
49
+
50
+ <p class="mt-1 text-sm text-gray-600 dark:text-gray-400">
51
+ Once your account is deleted, all of its resources and data will be
52
+ permanently deleted. Before deleting your account, please download any
53
+ data or information that you wish to retain.
54
+ </p>
55
+ </header>
56
+
57
+ <DangerButton @click="confirmUserDeletion">Delete Account</DangerButton>
58
+
59
+ <Modal :show="confirmingUserDeletion" @close="closeModal">
60
+ <div class="p-6">
61
+ <h2 class="text-lg font-medium text-gray-900 dark:text-gray-100">
62
+ Are you sure you want to delete your account?
63
+ </h2>
64
+
65
+ <p class="mt-1 text-sm text-gray-600 dark:text-gray-400">
66
+ Once your account is deleted, all of its resources and data will be
67
+ permanently deleted. Please enter your password to confirm you would
68
+ like to permanently delete your account.
69
+ </p>
70
+
71
+ <div class="mt-6">
72
+ <InputLabel for="password" value="Password" class="sr-only" />
73
+
74
+ <TextInput
75
+ id="password"
76
+ ref="passwordInput"
77
+ v-model="form.password"
78
+ type="password"
79
+ class="mt-1 block w-3/4"
80
+ placeholder="Password"
81
+ @keyup.enter="deleteUser"
82
+ />
83
+
84
+ <InputError :message="form.errors.password" class="mt-2" />
85
+ </div>
86
+
87
+ <div class="mt-6 flex justify-end">
88
+ <SecondaryButton @click="closeModal"> Cancel </SecondaryButton>
89
+
90
+ <DangerButton
91
+ class="ms-3"
92
+ :class="{ 'opacity-25': form.processing }"
93
+ :disabled="form.processing"
94
+ @click="deleteUser"
95
+ >
96
+ Delete Account
97
+ </DangerButton>
98
+ </div>
99
+ </div>
100
+ </Modal>
101
+ </section>
98
102
  </template>
@@ -1,108 +1,115 @@
1
1
  <script setup lang="ts">
2
- import InputError from '@/Components/InputError.vue';
3
- import InputLabel from '@/Components/InputLabel.vue';
4
- import PrimaryButton from '@/Components/PrimaryButton.vue';
5
- import TextInput from '@/Components/TextInput.vue';
6
- import { useForm } from '@inertiajs/vue3';
7
- import { ref } from 'vue';
8
- import { password_update_path } from '@/routes';
2
+ import InputError from '@/Components/InputError.vue'
3
+ import InputLabel from '@/Components/InputLabel.vue'
4
+ import PrimaryButton from '@/Components/PrimaryButton.vue'
5
+ import TextInput from '@/Components/TextInput.vue'
6
+ import { useForm } from '@inertiajs/vue3'
7
+ import { ref } from 'vue'
8
+ import { password_update_path } from '@/routes'
9
9
 
10
- const passwordInput = ref<HTMLInputElement | null>(null);
11
- const currentPasswordInput = ref<HTMLInputElement | null>(null);
10
+ const passwordInput = ref<HTMLInputElement | null>(null)
11
+ const currentPasswordInput = ref<HTMLInputElement | null>(null)
12
12
 
13
13
  const form = useForm({
14
- current_password: '',
15
- password: '',
16
- password_confirmation: '',
17
- });
14
+ current_password: '',
15
+ password: '',
16
+ password_confirmation: '',
17
+ })
18
18
 
19
19
  const updatePassword = () => {
20
- form.put(password_update_path(), {
21
- preserveScroll: true,
22
- onSuccess: () => {
23
- form.reset();
24
- },
25
- onError: () => {
26
- if (form.errors.password) {
27
- form.reset('password', 'password_confirmation');
28
- passwordInput.value?.focus();
29
- }
30
- if (form.errors.current_password) {
31
- form.reset('current_password');
32
- currentPasswordInput.value?.focus();
33
- }
34
- },
35
- });
36
- };
20
+ form.put(password_update_path(), {
21
+ preserveScroll: true,
22
+ onSuccess: () => {
23
+ form.reset()
24
+ },
25
+ onError: () => {
26
+ if (form.errors.password) {
27
+ form.reset('password', 'password_confirmation')
28
+ passwordInput.value?.focus()
29
+ }
30
+ if (form.errors.current_password) {
31
+ form.reset('current_password')
32
+ currentPasswordInput.value?.focus()
33
+ }
34
+ },
35
+ })
36
+ }
37
37
  </script>
38
38
 
39
39
  <template>
40
- <section>
41
- <header>
42
- <h2 class="text-lg font-medium text-gray-900 dark:text-gray-100">Update Password</h2>
43
-
44
- <p class="mt-1 text-sm text-gray-600 dark:text-gray-400">
45
- Ensure your account is using a long, random password to stay secure.
46
- </p>
47
- </header>
48
-
49
- <form @submit.prevent="updatePassword" class="mt-6 space-y-6">
50
- <div>
51
- <InputLabel for="current_password" value="Current Password" />
52
-
53
- <TextInput
54
- id="current_password"
55
- ref="currentPasswordInput"
56
- v-model="form.current_password"
57
- type="password"
58
- class="mt-1 block w-full"
59
- autocomplete="current-password"
60
- />
61
-
62
- <InputError :message="form.errors.current_password" class="mt-2" />
63
- </div>
64
-
65
- <div>
66
- <InputLabel for="password" value="New Password" />
67
-
68
- <TextInput
69
- id="password"
70
- ref="passwordInput"
71
- v-model="form.password"
72
- type="password"
73
- class="mt-1 block w-full"
74
- autocomplete="new-password"
75
- />
76
-
77
- <InputError :message="form.errors.password" class="mt-2" />
78
- </div>
79
-
80
- <div>
81
- <InputLabel for="password_confirmation" value="Confirm Password" />
82
-
83
- <TextInput
84
- id="password_confirmation"
85
- v-model="form.password_confirmation"
86
- type="password"
87
- class="mt-1 block w-full"
88
- autocomplete="new-password"
89
- />
90
-
91
- <InputError :message="form.errors.password_confirmation" class="mt-2" />
92
- </div>
93
-
94
- <div class="flex items-center gap-4">
95
- <PrimaryButton :disabled="form.processing">Save</PrimaryButton>
96
-
97
- <Transition
98
- enter-active-class="transition ease-in-out"
99
- enter-from-class="opacity-0"
100
- leave-active-class="transition ease-in-out"
101
- leave-to-class="opacity-0"
102
- >
103
- <p v-if="form.recentlySuccessful" class="text-sm text-gray-600 dark:text-gray-400">Saved.</p>
104
- </Transition>
105
- </div>
106
- </form>
107
- </section>
40
+ <section>
41
+ <header>
42
+ <h2 class="text-lg font-medium text-gray-900 dark:text-gray-100">
43
+ Update Password
44
+ </h2>
45
+
46
+ <p class="mt-1 text-sm text-gray-600 dark:text-gray-400">
47
+ Ensure your account is using a long, random password to stay secure.
48
+ </p>
49
+ </header>
50
+
51
+ <form @submit.prevent="updatePassword" class="mt-6 space-y-6">
52
+ <div>
53
+ <InputLabel for="current_password" value="Current Password" />
54
+
55
+ <TextInput
56
+ id="current_password"
57
+ ref="currentPasswordInput"
58
+ v-model="form.current_password"
59
+ type="password"
60
+ class="mt-1 block w-full"
61
+ autocomplete="current-password"
62
+ />
63
+
64
+ <InputError :message="form.errors.current_password" class="mt-2" />
65
+ </div>
66
+
67
+ <div>
68
+ <InputLabel for="password" value="New Password" />
69
+
70
+ <TextInput
71
+ id="password"
72
+ ref="passwordInput"
73
+ v-model="form.password"
74
+ type="password"
75
+ class="mt-1 block w-full"
76
+ autocomplete="new-password"
77
+ />
78
+
79
+ <InputError :message="form.errors.password" class="mt-2" />
80
+ </div>
81
+
82
+ <div>
83
+ <InputLabel for="password_confirmation" value="Confirm Password" />
84
+
85
+ <TextInput
86
+ id="password_confirmation"
87
+ v-model="form.password_confirmation"
88
+ type="password"
89
+ class="mt-1 block w-full"
90
+ autocomplete="new-password"
91
+ />
92
+
93
+ <InputError :message="form.errors.password_confirmation" class="mt-2" />
94
+ </div>
95
+
96
+ <div class="flex items-center gap-4">
97
+ <PrimaryButton :disabled="form.processing">Save</PrimaryButton>
98
+
99
+ <Transition
100
+ enter-active-class="transition ease-in-out"
101
+ enter-from-class="opacity-0"
102
+ leave-active-class="transition ease-in-out"
103
+ leave-to-class="opacity-0"
104
+ >
105
+ <p
106
+ v-if="form.recentlySuccessful"
107
+ class="text-sm text-gray-600 dark:text-gray-400"
108
+ >
109
+ Saved.
110
+ </p>
111
+ </Transition>
112
+ </div>
113
+ </form>
114
+ </section>
108
115
  </template>
@@ -1,78 +1,88 @@
1
1
  <script setup lang="ts">
2
- import InputError from '@/Components/InputError.vue';
3
- import InputLabel from '@/Components/InputLabel.vue';
4
- import PrimaryButton from '@/Components/PrimaryButton.vue';
5
- import TextInput from '@/Components/TextInput.vue';
6
- import { Link, useForm, usePage } from '@inertiajs/vue3';
7
- import { profile_update_path } from '@/routes';
2
+ import InputError from '@/Components/InputError.vue'
3
+ import InputLabel from '@/Components/InputLabel.vue'
4
+ import PrimaryButton from '@/Components/PrimaryButton.vue'
5
+ import TextInput from '@/Components/TextInput.vue'
6
+ import { useForm, usePage } from '@inertiajs/vue3'
7
+ import { profile_update_path } from '@/routes'
8
8
 
9
9
  defineProps<{
10
- mustVerifyEmail?: Boolean;
11
- status?: String;
12
- }>();
10
+ mustVerifyEmail?: Boolean
11
+ status?: String
12
+ }>()
13
13
 
14
- const user = usePage().props.auth.user;
14
+ const user = usePage().props.auth.user
15
15
 
16
16
  const form = useForm({
17
- name: user.name,
18
- email: user.email,
19
- });
17
+ name: user.name,
18
+ email: user.email,
19
+ })
20
20
  </script>
21
21
 
22
22
  <template>
23
- <section>
24
- <header>
25
- <h2 class="text-lg font-medium text-gray-900 dark:text-gray-100">Profile Information</h2>
23
+ <section>
24
+ <header>
25
+ <h2 class="text-lg font-medium text-gray-900 dark:text-gray-100">
26
+ Profile Information
27
+ </h2>
26
28
 
27
- <p class="mt-1 text-sm text-gray-600 dark:text-gray-400">
28
- Update your account's profile information and email address.
29
- </p>
30
- </header>
29
+ <p class="mt-1 text-sm text-gray-600 dark:text-gray-400">
30
+ Update your account's profile information and email address.
31
+ </p>
32
+ </header>
31
33
 
32
- <form @submit.prevent="form.patch(profile_update_path())" class="mt-6 space-y-6">
33
- <div>
34
- <InputLabel for="name" value="Name" />
34
+ <form
35
+ @submit.prevent="form.patch(profile_update_path())"
36
+ class="mt-6 space-y-6"
37
+ >
38
+ <div>
39
+ <InputLabel for="name" value="Name" />
35
40
 
36
- <TextInput
37
- id="name"
38
- type="text"
39
- class="mt-1 block w-full"
40
- v-model="form.name"
41
- required
42
- autofocus
43
- autocomplete="name"
44
- />
41
+ <TextInput
42
+ id="name"
43
+ type="text"
44
+ class="mt-1 block w-full"
45
+ v-model="form.name"
46
+ required
47
+ autofocus
48
+ autocomplete="name"
49
+ />
45
50
 
46
- <InputError class="mt-2" :message="form.errors.name" />
47
- </div>
51
+ <InputError class="mt-2" :message="form.errors.name" />
52
+ </div>
48
53
 
49
- <div>
50
- <InputLabel for="email" value="Email" />
54
+ <div>
55
+ <InputLabel for="email" value="Email" />
51
56
 
52
- <TextInput
53
- id="email"
54
- type="email"
55
- class="mt-1 block w-full"
56
- v-model="form.email"
57
- required
58
- autocomplete="username"
59
- />
57
+ <TextInput
58
+ id="email"
59
+ type="email"
60
+ class="mt-1 block w-full"
61
+ v-model="form.email"
62
+ required
63
+ autocomplete="username"
64
+ />
60
65
 
61
- <InputError class="mt-2" :message="form.errors.email" />
62
- </div>
66
+ <InputError class="mt-2" :message="form.errors.email" />
67
+ </div>
63
68
 
64
- <div class="flex items-center gap-4">
65
- <PrimaryButton :disabled="form.processing">Save</PrimaryButton>
69
+ <div class="flex items-center gap-4">
70
+ <PrimaryButton :disabled="form.processing">Save</PrimaryButton>
66
71
 
67
- <Transition
68
- enter-active-class="transition ease-in-out"
69
- enter-from-class="opacity-0"
70
- leave-active-class="transition ease-in-out"
71
- leave-to-class="opacity-0"
72
- >
73
- <p v-if="form.recentlySuccessful" class="text-sm text-gray-600 dark:text-gray-400">Saved.</p>
74
- </Transition>
75
- </div>
76
- </form>
77
- </section>
72
+ <Transition
73
+ enter-active-class="transition ease-in-out"
74
+ enter-from-class="opacity-0"
75
+ leave-active-class="transition ease-in-out"
76
+ leave-to-class="opacity-0"
77
+ >
78
+ <p
79
+ v-if="form.recentlySuccessful"
80
+ class="text-sm text-gray-600 dark:text-gray-400"
81
+ >
82
+ Saved.
83
+ </p>
84
+ </Transition>
85
+ </div>
86
+ </form>
87
+ </section>
78
88
  </template>