Solved

Database login with saving password

Posted on 2002-07-12
5
207 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
Comment Utility
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
Comment Utility
(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
Comment Utility
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
Comment Utility
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
Comment Utility
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 run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

763 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

7 Experts available now in Live!

Get 1:1 Help Now