19
Views
2
Comments
Employee Login and validation in Mobile Application
Question

I have EmployeeMaster and  PunchLog entities.  My home page is a login page with user name and password. When user press "Login" button, need to validate if the username and password matches with any record in EmployeeMaster entity. If true, go to another page, else show a warning message.

How can I do the validation? Is there any tutorial which contains this type of logic.

Rank: #193

Ambi wrote:

I have EmployeeMaster and  PunchLog entities.  My home page is a login page with user name and password. When user press "Login" button, need to validate if the username and password matches with any record in EmployeeMaster entity. If true, go to another page, else show a warning message.

How can I do the validation? Is there any tutorial which contains this type of logic.

Hi Ambi, the user_Login action already does this functionality and in most of the cases you already have this in your apps flow under the Common flow, it a page called "Login", check the pic bellow

If you don't have this flow on your app, create a new app with a template, if you don't know how follow this link


Follow this link to extra customization of the Login: https://success.outsystems.com/Documentation/How-to_Guides/Logic/How_to_add_extra_logic_to_Users'_login

But the question is: Do you need to do this validation in another way? do you need to replicate this actions code?

If the answer is yes you need to query the Users entities and check if exist a user with that Username and if the password match

And finally, if you are new to Outsystems I advise you to make one of the Paths from the online Bootcamp, it will save you hours of your coding when you understand the basics

Traditional web: https://www.outsystems.com/learn/courses/114/developing-web-apps-outsystems-11/?LearningPathId=2

Reactive: https://www.outsystems.com/learn/paths/18/becoming-a-reactive-web-developer/

Mobile: https://www.outsystems.com/learn/courses/115/developing-mobile-apps-outsystems-11/


Hope I could help you

Best Regards

Carlos Lessa

Rank: #370

Ambi wrote:

I have EmployeeMaster and  PunchLog entities.  My home page is a login page with user name and password. When user press "Login" button, need to validate if the username and password matches with any record in EmployeeMaster entity. If true, go to another page, else show a warning message.

How can I do the validation? Is there any tutorial which contains this type of logic.

Hi, 

I think , Outsystems already provide all logic to perform login in application.


And if u still want to do it by yourself.


Username and password is save in your EmployeeMaster entity and you want to validate it at Login Button. 

So , there must be a login form in your login page where Username and password store in some local variables.

So you can make separate server action (or in login screen action) that take 2 input parameter username and password , in that server action take an aggregate with your EmployeeMaster entity and apply filter by username in EmployeeMaster . 

If you u are doing it in login screen action then you need not take input parameter you can dot it with username and password input local variable.

 

For example i am applying in my user table. 


Aggregate will give u single record with that username and password. Not it turns to validate password in your screen action (or if you r doing it in server action). i am sure you are definitely using Encrypt password for encryption. 

In manage dependencies there is PlatformPasswordUtils where you can find validate password . 


this will help you to validate your form password to your aggregate password.

If validation failed simply show error message and if success then use Destination to go another page.


Hope this help.

Thanks