Proyectos de Subversion LeadersLinked - SPA

Rev

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

Rev 3263 Rev 3264
Línea 9... Línea 9...
9
import { asyncLogin } from '@store/auth/auth.actions'
9
import { asyncLogin } from '@store/auth/auth.actions'
10
import { addNotification } from '@store/notification/notification.actions'
10
import { addNotification } from '@store/notification/notification.actions'
11
import CryptoJSAesJson from '@utils/crypto-js/cryptojs-aes-format'
11
import CryptoJSAesJson from '@utils/crypto-js/cryptojs-aes-format'
Línea 12... Línea 12...
12
 
12
 
-
 
13
import Captcha from './captcha'
13
import Captcha from './captcha'
14
import Row from '@components/common/Row'
14
import Form from '@components/common/form'
15
import Form from '@components/common/form'
15
import Input from '@components/UI/inputs/Input'
16
import Input from '@components/UI/inputs/Input'
16
import CheckboxInput from '@components/UI/inputs/Checkbox'
17
import CheckboxInput from '@components/UI/inputs/Checkbox'
17
import LoadingWrapper from '@components/common/loading-wrapper'
18
import LoadingWrapper from '@components/common/loading-wrapper'
18
import FormErrorFeedback from '@components/UI/form/FormErrorFeedback'
-
 
Línea 19... Línea 19...
19
import Row from '@components/common/Row'
19
import FormErrorFeedback from '@components/UI/form/FormErrorFeedback'
20
 
20
 
21
export default function LoginForm() {
21
export default function LoginForm() {
Línea 31... Línea 31...
31
    handleSubmit,
31
    handleSubmit,
32
    reset
32
    reset
33
  } = useForm({ mode: 'all' })
33
  } = useForm({ mode: 'all' })
Línea 34... Línea 34...
34
 
34
 
35
  const onSubmitHandler = handleSubmit(
35
  const onSubmitHandler = handleSubmit(
36
    async ({ email, password, remember, token }) => {
36
    async ({ email, password, remember, captcha }) => {
37
      try {
37
      try {
38
        const response = await dispatch(
38
        const response = await dispatch(
39
          asyncLogin({
39
          asyncLogin({
40
            email: CryptoJSAesJson.encrypt(email, aes),
40
            email: CryptoJSAesJson.encrypt(email, aes),
41
            password: CryptoJSAesJson.encrypt(password, aes),
41
            password: CryptoJSAesJson.encrypt(password, aes),
42
            captcha: token,
42
            captcha,
43
            remember: remember ? 1 : 0
43
            remember: remember ? 1 : 0
44
          })
44
          })
45
        )
45
        )
Línea 102... Línea 102...
102
        name='captcha'
102
        name='captcha'
103
        rules={{ required: 'Este campo es requerido' }}
103
        rules={{ required: 'Este campo es requerido' }}
104
        control={control}
104
        control={control}
105
        render={({ field: { ref, onChange } }) => (
105
        render={({ field: { ref, onChange } }) => (
106
          <>
106
          <>
-
 
107
            <Captcha
-
 
108
              instanceRef={ref}
107
            <Captcha instanceRef={ref} onVerify={onChange} />
109
              onVerify={onChange}
-
 
110
              onExpired={onChange}
-
 
111
            />
108
            {errors.captcha && (
112
            {errors.captcha && (
109
              <FormErrorFeedback>{errors.captcha.message}</FormErrorFeedback>
113
              <FormErrorFeedback>{errors.captcha.message}</FormErrorFeedback>
110
            )}
114
            )}
111
          </>
115
          </>
112
        )}
116
        )}