Help with logging in and creating users

Help with logging in and creating users

  

Hi, i,m pretty new to outsystems and i'm using it for a school project. I want to be able to create users from a register screen through a form (wich is working atm) and i want users to be able to login with their username and password in the login screen (wich is set as the home screen), the registerscreen is selfmade and the loginscreen comes from the common tab, i copied the loginscreen template into the mainflow, so i'm using all the standart login logic stuff that outsystems comes with. But i keep getting errors that my username or password is incorrect eventough i can see that the data in my Users entity is correct. Idk what do to please help. 

I attached some screenshots in a zip file.

Hi Hidde,

are you applying the function GenerateSaltedMD5Hash (available in the PlatformPasswordUtils extension) to the password before saving the user in the database? The password needs to be encrypted before being saved in the database. I would expect that to be the problem.

You have an example in the Forge, the (How To: User Self Register). In the Login page of that module you can register a new user. This calls the Register action, that is the action you want to look at.

Hope this helps.

greetings,
pedro

Hi Pedro, Thanks for the reply but i still have no idea what to do, im just using the standard stuff that the mobile app template comes with. I just made a form on a 'register' page. That works fine. i just cant log in with any username&password. Not even my own (wich used to work). And i have no idea what GenerateSaltedMD5Hash is   

Hi Hidde, could you upload your application in here? Then I will take a look. It should be a very small change. 

Pedro Rodrigues wrote:

Hi Hidde, could you upload your application in here? Then I will take a look. It should be a very small change. 



Hi Hidde,


As Pedro supposed (and i confirmed by checking you .oml) you are not encrypting you password before you save it to the database. 

When you store a password it has to be encrypted otherwise if you just do like you are doing in your example, imagine you typed "123456" as password this will be encrypted and given another meaning/value.  If you want your password to be "123456" encrypt first, then save it to the database. 


You will find the EncryptPassword function in the users module.

Solution

Hi Hidde, the password was indeed not being encrypted before it was persisted in the database. That is why you could not log in after creating a user. Please find attached your module with some small changes, namely:

- the copy of the Login and the Splash screens found in the MainFlow were removed. There is no need for these to be also present in the MainFlow.

- the link to register a new user was placed on the Common/Login screen.

- a server action (CreateNewUser) was created to create the user; this action encrypts the password and sets the creation date of the user.

- that same action is now being used in the screen that creates a new user


Suggestions for further improvement:

- Let the user introduce twice the password when creating a new user and check whether they have the same contents before creating the new user

- Check whether a user with that same username already exists; if this is the case, notify the user that he has to choose a different username.


And that's it. Good luck in proceeding with your project.

Solution

Pedro Rodrigues wrote:

Hi Hidde, the password was indeed not being encrypted before it was persisted in the database. That is why you could not log in after creating a user. Please find attached your module with some small changes, namely:

- the copy of the Login and the Splash screens found in the MainFlow were removed. There is no need for these to be also present in the MainFlow.

- the link to register a new user was placed on the Common/Login screen.

- a server action (CreateNewUser) was created to create the user; this action encrypts the password and sets the creation date of the user.

- that same action is now being used in the screen that creates a new user


Suggestions for further improvement:

- Let the user introduce twice the password when creating a new user and check whether they have the same contents before creating the new user

- Check whether a user with that same username already exists; if this is the case, notify the user that he has to choose a different username.


And that's it. Good luck in proceeding with your project.


Thank you so much! this will realy help 

Hello, 

I am creating hospital application in which i created login page for doctor.. I have also list of appointments for doctors.. 

My question is when a docter logged in, it should display me the appointment list of only that doctor.. How should i do this?plzz help 

Hi Shweta,

First, please refrain from adding posts to old discussions that have almost nothing to do with what you want to get help.

Second, have you done the online training? I recommend this one for web development: https://www.outsystems.com/learn/courses/15/developing-outsystems-web-applications/

Cheers,

José