Support Topics Documentation Slack YouTube Blog

Login User then go to next page

There is not a lot of resources on the web of how to use this codeless feature. My first page is just a login page. When the user enters their email and password, it should check the database of usernames and passwords to see if there is a match. If there is a match, then it should go to the next page “SplashScreen”. I don’t know how to do that nor how to set a user token.

Hi @Rene_Ledesma,

Have you watched the videos from this playlist:?

There are a couple of things I’d change in your codeless logic:

  1. Use data binding for the txtEmail and txtPassword input controls.
  2. When the button is clicked, use the Login User block just like you do it now. However, the values for the username and password would be retrieved through data binding - they will be properties in the Page Data object.
  3. The Login User block returns a user object - you do not need to set it in the Set Current User token. In fact, the token will be set automatically.
  4. If the login doesn’t succeed, there is an error thrown out of the block, which should be handled with the try/catch block. (inside of the catch). So what you should do is put the login block inside of the try section. The Go to page should also be inside of try, right after the Login.

Please let me know if this is clear enough.

Also, consider creating another app using either the Insta Clone or the GeoChat blueprints. They come with all this logic already implemented and you can see how it is done.

Regards,
Mark