Texts (password) compare

Options

Hi there, that's my first time with Xano, but I already made a few different APIs.

Now I'm facing a strange issue with one of them.

Actually, I made a simple "reset-passord" which get three inputs: user id (id of the user to update), password and retype_password.

I made a "pre-condition" comparing theese two inputs to check if they are the same beofre storing them on the realtive user.

It seems never pass it. I also tried to compare them with a simple =. But nothing works again.


Any tip would be appreciated.

Tagged:

Comments

  • pete letkeman
    Options

    Is the password of type 'password' field in Xano?

    If so then you will probably need to use the Check Password function

    Which is in the Security drawer


    I suggest that you take a look at the default /auth/login endpoint provided by Xano to see how it is used.

  • daniele.dagostino
    daniele.dagostino Member
    edited October 2022
    Options

    Ok, I checked that out and also I checked my inputs which is both type text.


    So, I think it should simply compare two strings.

    Also the check password function(validate password) I think it "encode" the plain text password and compare with the stored one.

    In my case I need just to compare two plain texts before store it (the new password).

    That would be essentially a "change password" api!

  • daniele.dagostino
    daniele.dagostino Member
    edited October 2022
    Options

    I changed the inputs with the type password. I'm trying also with validate password but still not works.



  • pete letkeman
    Options

    If both values are plain text then skip the filter of 'equals' and do

    password = retype_password

  • Michael Udinski
    Michael Udinski Administrator

    ADMIN

    Options

    @daniele.dagostino the Check (Validate) Password function is to check an existing password (stored in the database aka hashed password) against an inputted text password.


    What you want to do for your use-case is use a Precondition

    WHERE text: password = text: retype_password


    Preconditions enforce something must be true and will throw and error if they are not true,