LoginExample store data to SQLite

Hello,

How can I store user data in the SQLite database instead of in an array (user values) within the LoginExample ?

Thank you.

Kind regards,
Eric

Dim Db As DatabaseRecord
Db=New DatabaseRecord

Db.Column("UserID")=TxtUserId.Text.Trim
Db.Column("UserPass")=TxtPass.Text.Trim
Db.Column("tel")=TxtPhone.Text
Db.Column("emgtel")=TxtEmgPhone.Text
Db.Column("UserName")=TxtName.Text.Trim
Db.IntegerColumn("userlevel")=Val(TxtLevel.Text)

Session.DbMain.InsertRecord("userinfo",Db)
If Session.DbMain.Error Then
  Session.DbMain.Rollback
  MsgBox Session.DbMain.ErrorMessage
  exit sub
End If

Thanks Alexis,

Where do I have to store this code, in the ‘adduser’ --> action method I assume ?

I wouldn’t recommend using this even for internal use. Except if your purpose is to learn the passwords of your users. Read up on the topics hash and salt.

The hash and salt code can be inserted into this code right ?

How much experience do you have with databases and security?

You store the hashes of the user when he/she creates an account. And when logging in again you verify the hash. Never the password itself.

I am relatively new to Xojo. I have heard about the hash, which is very important (I saw a Xojo blog article about this). I am definitely gonna spend time on this security hash.

Do you have an alternative suggestion to the code above ?

This is a good read on how to store passwords securely in Xojo.
https://thezaz.com/blog/2013/12/storing_passwords_securely_wit.html

Thank you Albin, I will study this information !

@ Albin, do you have or know a tutorial how I can an user registration system ?

You need to ask more detailed questions. Start with something simple. If you hit a snag post the example and ask your questions. At the moment you make it very hard for us to help you.

Yes, I know this is hard. But we all have been there. Really.

Yes, you’re right. Thank you for pointing that out, I can learn from this.

What I would like to achieve:

Modify the LoginExample (I think that is the most easiest starting point) in way that the username and password automatically stored in a SQLite database (after clicking on 'register).

Hi Eric,

did you get to modify the LoginExample to store the user accession data in a SQLite database? I am also very interesting to store these parameters.

Sergio

Eric,

There is a good example project already included with Xojo. Web --> LoginExample.xojo_binary_project that should help you.

HTH

@ Sergio, I am still working on it.

@Mike, well that is the project I was talking about (see my first post) :wink:

[quote=232861:@Eric Fernee]@ Sergio, I am still working on it.

@Mike, well that is the project I was talking about (see my first post) ;-)[/quote]
Oh sorry as I didn’t put 2 and 2 together on that one :slight_smile: