AI store generator for ecommerce, Malaysia first. Laravel 13 + React + TypeScript.
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

reset-password.tsx 3.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. import { Form, Head } from '@inertiajs/react';
  2. import InputError from '@/components/input-error';
  3. import PasswordInput from '@/components/password-input';
  4. import { Button } from '@/components/ui/button';
  5. import { Input } from '@/components/ui/input';
  6. import { Label } from '@/components/ui/label';
  7. import { Spinner } from '@/components/ui/spinner';
  8. import { update } from '@/routes/password';
  9. type Props = {
  10. token: string;
  11. email: string;
  12. passwordRules: string;
  13. };
  14. export default function ResetPassword({ token, email, passwordRules }: Props) {
  15. return (
  16. <>
  17. <Head title="Reset password" />
  18. <Form
  19. {...update.form()}
  20. transform={(data) => ({ ...data, token, email })}
  21. resetOnSuccess={['password', 'password_confirmation']}
  22. >
  23. {({ processing, errors }) => (
  24. <div className="grid gap-6">
  25. <div className="grid gap-2">
  26. <Label htmlFor="email">Email</Label>
  27. <Input
  28. id="email"
  29. type="email"
  30. name="email"
  31. autoComplete="email"
  32. value={email}
  33. className="mt-1 block w-full"
  34. readOnly
  35. />
  36. <InputError
  37. message={errors.email}
  38. className="mt-2"
  39. />
  40. </div>
  41. <div className="grid gap-2">
  42. <Label htmlFor="password">Password</Label>
  43. <PasswordInput
  44. id="password"
  45. name="password"
  46. autoComplete="new-password"
  47. className="mt-1 block w-full"
  48. autoFocus
  49. placeholder="Password"
  50. passwordrules={passwordRules}
  51. />
  52. <InputError message={errors.password} />
  53. </div>
  54. <div className="grid gap-2">
  55. <Label htmlFor="password_confirmation">
  56. Confirm password
  57. </Label>
  58. <PasswordInput
  59. id="password_confirmation"
  60. name="password_confirmation"
  61. autoComplete="new-password"
  62. className="mt-1 block w-full"
  63. placeholder="Confirm password"
  64. passwordrules={passwordRules}
  65. />
  66. <InputError
  67. message={errors.password_confirmation}
  68. className="mt-2"
  69. />
  70. </div>
  71. <Button
  72. type="submit"
  73. className="mt-4 w-full"
  74. disabled={processing}
  75. data-test="reset-password-button"
  76. >
  77. {processing && <Spinner />}
  78. Reset password
  79. </Button>
  80. </div>
  81. )}
  82. </Form>
  83. </>
  84. );
  85. }
  86. ResetPassword.layout = {
  87. title: 'Reset password',
  88. description: 'Please enter your new password below',
  89. };