• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

CaptainFact / captain-fact-frontend / 20411409289

21 Dec 2025 02:42PM UTC coverage: 1.46% (-1.8%) from 3.249%
20411409289

push

github

Betree
iterate

26 of 1952 branches covered (1.33%)

Branch coverage included in aggregate %.

1 of 8 new or added lines in 4 files covered. (12.5%)

528 existing lines in 32 files now uncovered.

39 of 2500 relevant lines covered (1.56%)

0.07 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/app/components/Users/ResetPasswordRequestForm.jsx
1
import { useFormik } from 'formik'
2
import React, { useState } from 'react'
3
import { useTranslation } from 'react-i18next'
4

5
import { resetPasswordRequest } from '../../API/http_api/current_user'
6
import { validateUserForm } from '../../lib/user_validations'
7
import { Button } from '../ui/button'
8
import { Card, CardContent, CardHeader, CardTitle } from '../ui/card'
9
import { ErrorView } from '../Utils/ErrorView'
10
import { FormikUserEmailField } from './UserFormFields'
11

12
const ResetPasswordRequestForm = () => {
×
13
  const { t } = useTranslation('user')
×
14
  const [status, setStatus] = useState('ready')
×
UNCOV
15
  const [error, setError] = useState(null)
×
16

UNCOV
17
  const formik = useFormik({
×
18
    initialValues: {
19
      email: '',
20
    },
21
    validate: (values) =>
UNCOV
22
      validateUserForm(t, values, { emailRequired: true, passwordRequired: false }),
×
23
    onSubmit: async (values) => {
24
      try {
×
UNCOV
25
        await resetPasswordRequest(values.email)
×
UNCOV
26
        setStatus('done')
×
27
      } catch {
28
        setStatus('error')
×
29
        setError('reset_failed')
×
30
      }
31
    },
32
  })
33

34
  const { values, errors, touched, handleChange, handleBlur, handleSubmit, isSubmitting, isValid } =
35
    formik
×
36

UNCOV
37
  const renderContent = () => {
×
38
    if (status === 'error') {
×
39
      return <ErrorView error={error} i18nNS="user:errors.error" canGoBack={false} />
×
UNCOV
40
    } else if (status === 'ready') {
×
UNCOV
41
      return (
×
42
        <div className="space-y-4">
43
          <FormikUserEmailField
44
            t={t}
45
            values={values}
46
            errors={errors}
47
            touched={touched}
48
            handleChange={handleChange}
49
            handleBlur={handleBlur}
50
          />
51
          <Button
52
            type="submit"
53
            variant="outline"
54
            disabled={!isValid || isSubmitting}
×
55
            loading={isSubmitting}
56
          >
57
            {t('resetPassword')}
58
          </Button>
59
        </div>
60
      )
UNCOV
61
    } else if (status === 'done') {
×
UNCOV
62
      return t('resetPasswordRequestSuccess')
×
63
    } else {
UNCOV
64
      return null
×
65
    }
66
  }
67

UNCOV
68
  return (
×
69
    <div className="px-2 my-12">
70
      <Card className="max-w-[500px] mx-auto">
71
        <CardHeader>
72
          <CardTitle>{t('resetPassword')}</CardTitle>
73
        </CardHeader>
74
        <CardContent>
75
          <form onSubmit={handleSubmit}>{renderContent()}</form>
76
        </CardContent>
77
      </Card>
78
    </div>
79
  )
80
}
81

82
export default ResetPasswordRequestForm
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc