Colin Mckinney
|
Posted: 06/14/2004, 10:06 AM |
|
What is the best way to allow users the ability to change login password. It would have to check the users old password first to verify - then ask them to enter a new one twice for confimation
Using ASP, Access
|
|
|
Eiden
|
Posted: 06/29/2004, 1:41 PM |
|
This may help:
1. Create a new record form
2. Create three text boxes (old password, new password and confirm)
3. Set the new password control source to the password field in your user
database
And in the onValidate event of the form:
With ChangePassword
If isempty(.old.value) then
..errors.addError("Type in your old password")
end if
If isempty(.new.value) then
..errors.addError("Type in your new password")
end if
If isempty(.confirm.value) then
..errors.addError("Confirm your password")
end if
If .new.value <> .confirm.value then
..errors.addError("New password and confirm password not equal")
end if
If .old.value <> CCDLookUp("password","users","ID="&CCGetUserID(), DBdb)
then
..errors.addError("old password does not match")
end if
end With
|
|
|
Colin Mckinney
|
Posted: 07/01/2004, 11:09 AM |
|
Thanks!
|
|
|
S_A
Posts: 29
|
Posted: 07/28/2004, 9:09 AM |
|
Hi, excuse the ignorance here......when I do the above and name the controls to match mine and the DB connection etc....I get this error when running the page.
Variable is undefined: 'ChangePassword'
I guess I have to declare that, if so where?
Thanks
|
|
|
Eiden
|
Posted: 07/29/2004, 9:37 AM |
|
ChangePassword is the formname. Change this to your formname:)
|
|
|
S_A
Posts: 29
|
Posted: 07/30/2004, 8:39 AM |
|
Er....thanks, bit stupid of me that one.......the whole thing is on the verge of working but the bit I still dont get is that if the "New" field has it's datasource bound to the database password field, when you overwrite this with the "New" value, and hit submit, I get an error saying that the old password does not match. Well unless I got it wrong, it won't match, because I just overwrote it! I think..... Any ideas? Thanks for your help.
|
|
|
S_A
Posts: 29
|
Posted: 07/30/2004, 8:48 AM |
|
What I did not mention is that I'm also getting this error, which I don't think is related to the above and may be causing it???
Source: CCDLookUp function
Command Text: SELECT Pass FROM tbl_users WHERE UserName=JOE
Error description: [Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1. (Microsoft OLE DB Provider for ODBC Drivers)
|
|
|
Eiden
|
Posted: 07/31/2004, 2:23 AM |
|
If you take a quick look at the documentation, the OnValidate event occurs
before any database operations have been performed.
The error you are getting is cause by an error in your SQL statement
(CCDLookup):
Try to use this one:
CCDLookUp("Pass","tbl_users","UserName="&CCToSQL("JOE","text"),DBdb)
For more information: http://www.w3schools.com/sql/sql_where.asp
Try this and good luck:)
|
|
|
S_A
Posts: 29
|
Posted: 07/31/2004, 10:14 AM |
|
That's great thanks!! It's working really well now. Your help is much appreciated!! Thanks.
|
|
|
|