Solved

Database login with saving password

Posted on 2002-07-12
5
209 Views
Last Modified: 2010-04-04
Hi,

I have application where database user name and password are hardcoded. I need to change it to enable user to type their own name and password. I'm using ADO components and connecting to database via ODBC.
I've seen in some commercial applications login prompts that take last user name from Windows registry (ODBC entries) and allows user to save password, so it won't promt again (assuming that the password is OK).

How to do it?
0
Comment
Question by:PeterZG
5 Comments
 
LVL 12

Expert Comment

by:Lee_Nover
ID: 7151674
hm .. what do you mean l/p is hardcoded in the db ?
to get the current users name use GetUserName api
0
 
LVL 5

Accepted Solution

by:
Hamlet081299 earned 200 total points
ID: 7151877
(If I unserstand the question) there are a few possibilities.

Firstly let me recap what I understand the desired solution to look like...

1. If the current user has previously saved their password then use saved user name and password. (skip to 5)
2. Application presents login dialog of some sort.
3. User enters name (auto filled from current windows user).
4. A check box allows the user to save their password.
5. Attempt login with user name and password.
6. If logged in successfully and "save password" checked then save user name password combination, otherwise go back to 2.

One part is deciding where/how to store all the valid user name and passwords.  Typically this is done in the registry.  (Let me know if you need more advice on how to do this).

I don't think I should provide too much specific code, as it looks like you'll have to fit in around the existing system, but here are the salient points for each step.

1. Get the current signed on user (from windows api).  Some applications also remember the last user logged in (stored in registry).  You may want to try both.

2. I'm assuming there is some dialog already?  You just need to add the "save password" checkbox.  I also considered autofilling the password if the user name entered was available in the registry, but this seems risky, because anyone could then sign on with just the user name.

3. The current user is the one that you try at step 1 (again this could be EITHER the windows user or a user name remembered in the registry)

4. (as noted at 2)

5. (I'm assuming this functionality is done)

6. ONLY save the password AFTER the login is successful.  You may also consider DELETING the saved password from the registry on an unsuccessful login attempt.  You should also consider how to ENCRYPT the password in the registry.

I hope this helps.  Let me know if there are specific areas you need help on - Windows API, Registry, Encryption, etc.
0
 
LVL 1

Author Comment

by:PeterZG
ID: 7155586
Thanx Hamlet,
This is more less solution I wanted to use, I was just wondering if there is any way to get database login prompt from ODBC itself?
0
 

Expert Comment

by:CleanupPing
ID: 9343069
PeterZG:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
EXPERTS:
Post your closing recommendations!  No comment means you don't care.
0
 
LVL 1

Author Comment

by:PeterZG
ID: 9344873
Sorry for the delay, haven't been here for a while...
Grade B only because of partial answer to my question.

Cheers
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Sending Gmail through Delphi 3 91
add combobox item based on numbers 9 123
Delphi: how to implement a User Shortcut mapper? 1 95
QRReport  TQrmemo vertical stretching 1 42
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…
Both in life and business – not all partnerships are created equal. As the demand for cloud services increases, so do the number of self-proclaimed cloud partners. Asking the right questions up front in the partnership, will enable both parties …

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now