Solved

Database login with saving password

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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
This video shows how to use Hyena, from SystemTools Software, to update 100 user accounts from an external text file. View in 1080p for best video quality.

738 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