Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Database login with saving password

Posted on 2002-07-12
5
Medium Priority
?
227 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 600 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

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

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

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
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…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
Suggested Courses

610 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