Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

233
Vistas
How to validate current password against new password using Yup

I am using yup and yup-password to validate password creation on my app and ran into a problem when validating New Password against Current Password. I needed to find a way to throw an error if the new password matches the existing one.

I had a bit of a hard time finding this answered anywhere, so I thought I'd create this issue and answer it myself. Hope it helps someone!

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Came across this function on yup documentation, and here's the implementation:

const newPasswordField = () =>
  passwordField().notOneOf(
    [Yup.ref('currentPassword'), null],
    'passwords must be different'
  );

When the newPassword matches currentPassword, an error is thrown with the message 'passwords must be different'.

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda