Problem pulling login info from previous page

Hi guys,

Please see the pic below:

I’m having issues pulling the login information (login by email) from one page to another, to login in after verifying an OTP.

Its as though because the sendgrid email custom action has used the email address in the first screen, it is then not available to use it again to login.

Is this something anyone else has encountered? Ive tried deleting an reprogramming a few time. I had something similar on the sign up page but in the end it worked.

Does anyone have a solution or workaround? Unfortunately it is essential that I have an OTP for logging in…

Thanks

I realise this probably requires a little more info.

The ‘next’ button on the first page generates a new record in a separate database ‘login verification codes’, and then sends and email of this current record to the users email address via the sendgrid API, with a link to the next page. The verify button (only visible when the code above matches) on the login 2 page has the sign in action on it, this is where the problem arises.

Hopefully this is a little clearer! :slight_smile:

Hi @JLCSerious,

Could you please explain a bit more:

  • do you try to Log In the user with OTP, or Sign Up the user?
  • what action do you use for “Login” button?
  • why did you choose to use a separate DB for OTP codes instead of having a field in Users’ collection?

Just in case, some time ago I’ve made a video about custom password restore with OTP via email, you might find it useful: https://youtu.be/kQ3v_-us2as

Best regards, Victor.

Hi Victor, no worries:

  • do you try to Log In the user with OTP, or Sign Up the user?

Actually both, but Ive got it working for signing up the user, but not for logging in the user

  • what action do you use for “Login” button?

This is login by username. The button is only visible if the code equals the current OTP code that has just been generated and sent via email

  • why did you choose to use a separate DB for OTP codes instead of having a field in Users’ collection?

Because I want to use OTP for login and sign up, the usual way of changing the visibility of items on the homescreen would not work unless a “logged in” field was triggered. Without changing the visibility, a user could just leave the OTP verification page, close the app, open it, and be back on the homescreen. If a user never hit the log out button, the “logged in” field would never be nullified, meaning that they could log and circumnavigate the OTP, basically, more than one user could use the same account. Does that make sense?

Hi @JLCSerious,

So, what action do you have on “Next” button on the screen to the left? Is it “Log in the user”?

Or you’re trying first to collect all the info (i.e. login, password) on the left screen, and then on “Verify” button on the “right” screen you have an action “Log in the user” based on the fields from “left” screen, and you try to show the button based on “Count” filter on “Login Verification Codes” collection?
What stops you from taking email from the input box on the 1st screen?

As for me, I would do it differently. On the 1st screen, I would actually log in the user. Then I would have interim screen, on which I would generate OTP, store it in Logged-In user and send it via custom action. This screen should be passed automatically (last link - 3rd screen). Then, on the 3rd screen, I would check the OTP, and show the “continue” button only if OTP in the input box matches the stored OTP.
And I will make the 2nd screen (Interim one) to be a Home screen, so user never can pass the OTP check.
One side advantage - the emails will be sent only to real users.
But that’s my personal approach, someone may disagree :slight_smile:

Best regards, Victor.

Hi Victor,

So, what action do you have on “Next” button on the screen to the left? Is it “Log in the user”?

No, the left screen is just a link to the right screen and generates an OTP code.

Or you’re trying first to collect all the info (i.e. login, password) on the left screen, and then on “Verify” button on the “right” screen you have an action “Log in the user” based on the fields from “left” screen, and you try to show the button based on “Count” filter on “Login Verification Codes” collection?

This is exactly right, only there is no count filter and the Verify button is only visible when the input field matches the OTP.

What stops you from taking email from the input box on the 1st screen?

This is what I’m trying to do, but unfortunately it doesn’t log the user in, it’s as though the email address is used for sending the verification email and then becomes nullified, and cannot be used for anything else. I had the same thing on the sign up screens (when I tried to pull it through to create a user it would create the account but leave the email blank) but after rebuilding it a couple of times it eventually worked - now Im too scared to edit anything on the screen in case it breaks, even though it doesn’t display some text on the screen for an unknown reason!

I’m not sure I’ve 100% got my head around your solution, but it does appear elegant. Would a user have to then do an OTP check everytime they opened the app? This may too much of a hinderence…I only want to do it on sign up and login. How do you make it automatically skip a screen?

Thanks for your help.

Best,

Jack

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.