VBA code for Password Change

Aimn_4U

Registered User.
Local time
Tomorrow, 00:28
Joined
May 14, 2019
Messages
33
Hi all,

I currently have a form setup for User Login into a specific part of my database.
Staff are required to enter their staff ID and then their password.
I have got this set up to the point where it takes them to the correct screen if their password and username are correct, and gives them an error if they have not entered their username or password. However, I am having an issue if they are a new user.
If they are a New User, I was going to get the administrator to add them and leave the password blank (already set up to add a person), I was hoping to add a code that recognizes that their Staff ID has no password set against it in the table and prompts them to enter one. could someone please help me with a code to do this ?

Any help would be appreciated.
 
what method are you currently using to verify that their username and password *is* correct? if you are currently using code to do it, then making access recognize a new user should basically be the same code anyway. so, if you're looking up their name after the admin has added their name but left the pw blank, you would do something like this:
Code:
if dcount("password", "table", "username = '" & me.InputControl & "'") = 0 then
   'do what you want here to get them to add a password.  maybe using INPUTBOX()
else
   'they already have a password, let them in here
end if

https://support.office.com/en-us/article/dcount-function-f6b5d78b-ad0b-4e42-be7a-11a64acbf3d3
 
Hi all,

I currently have a form setup for User Login into a specific part of my database.
Staff are required to enter their staff ID and then their password.
I have got this set up to the point where it takes them to the correct screen if their password and username are correct, and gives them an error if they have not entered their username or password. However, I am having an issue if they are a new user.
If they are a New User, I was going to get the administrator to add them and leave the password blank (already set up to add a person), I was hoping to add a code that recognizes that their Staff ID has no password set against it in the table and prompts them to enter one. could someone please help me with a code to do this ?

Any help would be appreciated.

You should setup a 'dummy' password for new users that they are required to change. Leaving it blank provides a loophole to the login process

See my example app Password login in the sample databases area. It includes exactly the feature you want as well as other things you may find useful.
This is an old utility that I completely rewrote some time ago. Use the latest version 5.2 that is attached to post #20 of that thread.
 
going on from that you probably want to store a password expiry date, which would force a new temporary password to be treated as expired and request a new one. An existing password would need to be changed after the expiry date. Also at the very least store the passwords as encrypted text, not plain text. You can use xor for a simple encryption. It's better than nothing, although it would probably be pretty easy to crack.
 
The app in my link includes the option to set password expiry dates.
In addition the passwords are encrypted. The original app used XOR but I replaced that with a far more secure 128-bit RC4 cipher.
Of course it would be far better not to store passwords in Access at all but make use of active directory
 

Users who are viewing this thread

Back
Top Bottom