Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

235
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda