Login User
For a User to perform Login in your application, you will need to create a new Login Datasource.
Create User Login Datasource
- Create a new Login Screen.
- Add two Text Fields for email and password.
- Press the Datasource button, and then the + Create datasource button.
- Select the Kodika Server tab.
- Select the User Data Type.
- Select Login User.
- Bind the Email and Password parameters with the respective Text Fields.
- Connect at least the parameters of the On Success response.
- Press Save.
- Close the Datasource popup.
- Add a Button and change its title to
Login
. - Create a Start a Datasource Request Event Action in the On Click Event of the Login Button and select the newly created Datasource.
Request Parameters
The email the user will try to login with.
Validations:
- When Invalid Email response will be called, if the email is not in a valid email address format.
Password
The password the user will try to login with.
Validations:
- When Wrong Password response will be called, if the password is not correct for the provided email.
Responses
Note: If any of the validations failed, the On Success response is not called, and only the respective failure response is called.
On Success
Called when the login of the user is successful. User will be automatically logged in and set as Current User.
Parameters:
- User: The logged in user.
On Error
Called when there is an unknown error that is not handled by the other responses.
Parameters:
- Error: A text with an error message.
When Offline
Called when the user has no Internet connection.
Parameters:
- Error: A text with an error message.
When Invalid Email
Called when email parameter is a wrong formatted email address.
Parameters:
- Error: A text with an error message.
When Wrong Password
Called when password is not correct for the provided email.
Parameters:
- Error: A text with an error message.
Datasource automation
We would suggest setting the Datasource Spinner to ON and Auto start when Screen First Loads to OFF for this request, as we want to show a spinner during the request and execute the request only when the Button is pressed.