Password Protecting an App (Multiple User Accts)?

Disasterpiece

Freshman
Joined
Apr 2, 2003
Messages
47
Location
Blacksburg, VA
Hi All,

I'm fairly new to VB .NET, and I have to do a semester project for my VB class.

Now, what I want to do is create a program that keeps track of a checking account. The program will show transactions made, update the balance, etc. etc.

I know how to do the bulk of the program, but another thing I would like to do is to have user logins. When the app first runs I would like it to have the option to Login or Create New User. Now what I'm a little confused about is how do I actually do this? I would guess that I could either
a) Save the list of users/pw's in a text file on the hard drive, but security becomes an issue here
b) Somehow protect the database that I will be storing data into.

I also don't really know how I would do the syntax for passwords either. Could anyone give me a little help please?

Muchas gracias.
Disasterpiece
 
If its for a project use a Access Database, Make it password protected

Create a user table with Names, Passwords

When user loads program prompt for username & password check values against database if exists run program

Andy
 
Thanks, I'll look into the syntax for doing that.

Unless you want to post it here... :)

I understand how to create the database, and I understand how to write a program, I just haven't learned how to make them work together yet :confused:
 
Just a tip for however you decide to do it, don't store the actual password in the database, store a textual md5 hash of the password. Then when a user logs in, convert what he typed in the password box to an md5 hash and match that against the one in the database for the given username. It's safer that way, as nobody can get at the real password, stealing the md5 hash won't do anything for them because your program will take the hash of that! This is usually more important over the internet, or in applications where there is a danger of passwords being stolen (or causing havoc if they are) but you may get extra credit for it.

Code:
Public Function MD5(ByVal SourceText As String) As String
        'Create an encoding object to ensure the encoding standard for the source text
        Dim Ue As New System.Text.UnicodeEncoding()
        'Retrieve a byte array based on the source text
        Dim ByteSourceText() As Byte = Ue.GetBytes(SourceText)
        'Instantiate an MD5 Provider object
        Dim Md As New System.Security.Cryptography.MD5CryptoServiceProvider()
        'Compute the hash value from the source
        Dim ByteHash() As Byte = Md.ComputeHash(ByteSourceText)
        'And convert it to String format for return
        Dim mdHash() As Char = Convert.ToBase64String(ByteHash)
        Return Convert.ToString(mdHash)
    End Function
 
Well when you figure out how to make them work together, let me know lol. I'm in the same boat. I just know it has something to do with ADO.
 
That's very helpful!

I'm thinking about just making the program handle only one user for the time being. In that case I could just write out the md5 hash to a text file and do it that way.

Thanks!
 
I think this method is topper and have implemented it. The only problem I have now is that I get an error stating there is an error in the UpdateCommand, following the call to GetUpdateCommand

Any ideas?
 
Make sure you have an Insert command and you close that command.

Here is what I ended up doing for mine:

Visual Basic:
newRow.EndEdit()

dtUsers.Rows.Add(newRow)            'Inserts new row into the data table

daUsers.InsertCommand = commandBuilder.GetInsertCommand
daUsers.Update(dtUsers)             'Saves the new row to the database

daUsers.InsertCommand.Connection.Close()
daUsers.Dispose()

See if your code looks similar to that and tell me what happens :)
 
Back
Top