Proyectos de Subversion LeadersLinked - SPA

Rev

Rev 3156 | Rev 3230 | Ir a la última revisión | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 3156 Rev 3190
Línea 1... Línea 1...
1
import React, { useRef, useState, useEffect } from 'react'
1
import React, { useRef, useState, useEffect } from 'react'
2
import { Link } from 'react-router-dom'
2
import { Link } from 'react-router-dom'
3
import { useDispatch, useSelector } from 'react-redux'
3
import { useDispatch, useSelector } from 'react-redux'
4
import { useForm } from 'react-hook-form'
4
import { useForm } from 'react-hook-form'
5
import { styled } from '@mui/material'
5
import { styled, Typography } from '@mui/material'
6
import { Mail } from '@mui/icons-material'
6
import { Mail } from '@mui/icons-material'
7
import Recaptcha from 'react-recaptcha'
7
import Recaptcha from 'react-recaptcha'
Línea 8... Línea 8...
8
 
8
 
9
import { axios } from '@utils'
-
 
10
import CryptoJSAesJson from '@utils/crypto-js/cryptojs-aes-format'
9
import { axios } from '@utils'
-
 
10
import { addNotification } from '@store/notification/notification.actions'
Línea -... Línea 11...
-
 
11
import CryptoJSAesJson from '@utils/crypto-js/cryptojs-aes-format'
-
 
12
 
11
import { addNotification } from '@store/notification/notification.actions'
13
import Form from '@components/common/form'
12
 
14
import Spinner from '@components/UI/Spinner'
13
import Input from '@components/UI/inputs/Input'
-
 
14
import Button from '@components/UI/buttons/Buttons'
-
 
Línea 15... Línea 15...
15
import Spinner from '@components/UI/Spinner'
15
import Input from '@components/UI/inputs/Input'
16
import AuthForm from '@components/auth/AuthForm'
16
import Button from '@components/UI/buttons/Buttons'
17
 
17
 
18
const StyledCheck = styled('div')`
18
const StyledCheck = styled('div')`
Línea 27... Línea 27...
27
  p {
27
  p {
28
    text-align: center;
28
    text-align: center;
29
  }
29
  }
30
`
30
`
Línea 31... Línea -...
31
 
-
 
32
const StyledSpinnerContainer = styled('div')`
-
 
33
  position: absolute;
-
 
34
  left: 0;
-
 
35
  top: 0;
-
 
36
  width: 100%;
-
 
37
  height: 100%;
-
 
38
  background: rgba(255, 255, 255, 0.4);
-
 
39
  display: flex;
-
 
40
  justify-content: center;
-
 
41
  align-items: center;
-
 
42
  z-index: 300;
-
 
43
`
-
 
44
 
31
 
45
const ForgotPassword = () => {
32
const ForgotPassword = () => {
46
  const { site_key, aes } = useSelector(({ auth }) => auth)
33
  const { site_key, aes } = useSelector(({ auth }) => auth)
47
  const [forgotSent, setForgotSent] = useState(false)
34
  const [forgotSent, setForgotSent] = useState(false)
48
  const [isLoading, setIsLoading] = useState(false)
35
  const [isLoading, setIsLoading] = useState(false)
Línea 125... Línea 112...
125
      </StyledCheck>
112
      </StyledCheck>
126
    )
113
    )
127
  }
114
  }
Línea 128... Línea 115...
128
 
115
 
129
  return (
116
  return (
-
 
117
    <Form onSubmit={onSubmitHandler}>
-
 
118
      {isLoading && <Spinner absolute />}
130
    <AuthForm onSubmit={onSubmitHandler}>
119
 
Línea 131... Línea 120...
131
      <h3>Olvide mi Clave</h3>
120
      <Typography variant='h3'>Olvide mi Clave</Typography>
132
 
121
 
133
      <Input
122
      <Input
-
 
123
        type='email'
-
 
124
        name='email'
-
 
125
        placeholder='Correo electrónico'
134
        control={control}
126
        icon={<Mail />}
135
        name='email'
127
        control={control}
136
        rules={{
128
        rules={{
137
          required: 'Este campo es requerido',
129
          required: 'Este campo es requerido',
138
          pattern: {
130
          pattern: {
139
            value: /^[\w-.]+@([\w-]+\.)+[\w-]{2,4}$/i,
131
            value: /^[\w-.]+@([\w-]+\.)+[\w-]{2,4}$/i,
140
            message: 'Debe ser una dirección de correo electrónico valida'
132
            message: 'Debe ser una dirección de correo electrónico valida'
141
          }
-
 
142
        }}
-
 
143
        placeholder='Correo electrónico'
133
          }
144
        type='email'
-
 
145
        error={errors.email?.message}
134
        }}
Línea 146... Línea 135...
146
        icon={<Mail />}
135
        error={errors.email?.message}
147
      />
136
      />
148
 
137
 
Línea 159... Línea 148...
159
      />
148
      />
Línea 160... Línea 149...
160
 
149
 
161
      <Button color='secondary' type='submit' disabled={!isVerified}>
150
      <Button color='secondary' type='submit' disabled={!isVerified}>
162
        Nueva Clave
151
        Nueva Clave
163
      </Button>
-
 
164
 
-
 
165
      {isLoading && (
-
 
166
        <StyledSpinnerContainer>
-
 
167
          <Spinner />
-
 
168
        </StyledSpinnerContainer>
-
 
169
      )}
152
      </Button>
170
    </AuthForm>
153
    </Form>
171
  )
154
  )
Línea 172... Línea 155...
172
}
155
}