Solved

Database login with saving password

Posted on 2002-07-12
5
213 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

790 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