Friday, May 18, 2012

User Login and Verification


I was able to add the menubar, main user interface window and the logo a few hours ago. Now it's time to add a login window that will verify authorized users. It will have a very simple verification. The logic is to simply check if a user provided user name is in the users table and check if the entered password match the one in our record.

However, a thought came to me earlier about having one admin user. At present there's no way to tell in our users table who the admin user will be. So I'll have to add a new field  lAdmin l(1). It will be a logical field that tells the software whether the user is the administrator.

The difference between an ordinary user and an administrator is that the user won't be able to define new users while the administrator will be able to do so. This is still a simple logic design and will still fit my goal of a simplified accounting system. More advanced security features in full-blown accounting systems allows access definition up to data entry level (cash receipts entry, disbursements entry),  function level (add, edit, delete) and up to field level (who can see the price, the customer balance, etc.).

We won't have any advanced security in the simple accounting system but I mentioned it so you'll have an idea of what advanced system security is all about.

Here's the revised structure for our users table. 

username  c(20)
password c(20)
ladmin l(1)

I manually added two records in the users table. One is username: admin password: omar and the other is username: guest password: guest


I added these users manually so that even if there's no facility yet for adding the users, we can already log into the system.

I'll now work on the login screen and post a screenshot at the top of this post once it is done.
~2:26 PM Saturday, 5/19/2012

The login form is now working. I was thinking earlier that I may have to add in the codes in this post and I will..I'll probably do the entire documentation on how things work behind the scenes when I'm done with the entire project  by Monday but for the meantime I added the screenshot of the login form at the top of this post and here's the screen shot of the user validation codes as well as how the login code was called from the main program.

By the way I added a user defined property to the form called lAccess - this is a logical property that I use as a switch. If false it will indicate that the validation failed for the user, if true it will indicate that the user passed the username and password check.

Code when "Login" button is clicked:


Here's the code when the "Cancel" button in the login window is clicked

Here's the code calling the login window in the main program


No comments:

Post a Comment