473,406 Members | 2,710 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

How to create a random password and setup a change password form?

Any ideas on how to send info from one form into another domain or how to write a default value for a new user's password with a formula?

Here's what I'm trying to do: design my database so that a new employee record has a password generated with a formula (obviously, not one that is published). On the employees table is a true false declaring if the user's password needs changed. The default value is true. So when I create a new record (add an employee to the table) he is given an unguessable (but not actually random) password and the tables marks his password as needing changed.

Now, on the login form, the command button checks if that user's password is marked as needing changed. If it is, it closes the login form and opens the change password form. What I need the command button on the change password form to do is change the value if the user's password (from the auto-calculated one) to the one he entered in the change password form AND to change the true/false value on that user's require change password box to false. Make sense?

So

1. How do I make the default password = to a formula (like the date the employee was added and their initials, etc) and

2. How do I code the command button on the change password form do the saving if the info change like I described earlier? Any tips?
Jan 23 '11 #1
7 4373
Jesse,

I understand exactly what you're trying to do, and I know how to do it, but unfortunately I don't know the code for it. You want to concatenate your fields. Concatenate means to "add" your fields together. So basically it'll look like this:

"date" + "initials"

that will show up as 010811ml

something like that. Now as I've said, I don't know the code for it, but that's the concept that you need.

Sorry I couldn't be of more help.
Jan 26 '11 #2
Thanks, Marty. How would you do it? The only reason I think I don't actually need code to originate the password.

Also, do you know the code that changes the value of a field in another table? (On my employee table, there is a yes/no that decides if the employee needs to be forced to change their password. If it says yes, they are redirected to a password change form. What I need is for the command button on that password change form to 1. set the password in employees = the password they just entered on the change form and 2. change the value of that yes/no to no.) Anyone have any suggestion?
Jan 29 '11 #3
munkee
374 256MB
I am unsure if this is the answer you are looking for but it is what I do for my database and it runs a lot smoother than trying to generate random/unique passwords.

Whenever I add a new person to my database the default password is set to "Password".

In my login form I check the entered password (as you do). If this password is = to Password I redirect the person t the "change password" form. I use a simple message box to display "Since this is the first time you have entered the databse, using the default password you are now required to change this." or similar.

It saves a lot of headaches generating new passwords etc when realisticly it is easier to let people all use 1 password to login for the first time and then ensure they change this to something else.
Jan 29 '11 #4
Okay, munkee, thanks. I used to do it that way, but we had a problem with people overwriting other people's passwords. Not everyone has the same permissions in the database. So when I hire someone into database development with near total access, I don't want people in communications to be able to change the new guys password. Make sense?

Thank you for your thought. You could be a huge help to me though by perhaps sharing with me what you have done with you password change form. I assume its a modal form with a command button...? What is the coding on that button that changes the users password? I mean, how do you automatically save their new password?

Any help would be greatly appreciated. I am basically a novice in this.
Jan 29 '11 #5
munkee
374 256MB
I'll post some code in the morning
Jan 29 '11 #6
Rabbit
12,516 Expert Mod 8TB
As far as security goes, you may want to take a look at this thread. http://bytes.com/topic/access/insigh...atabase-access

For a default password, I assume you have an add employee form. I would put a button on there that sets the password.

As for the password change, when they click the log in, I would use a dloopup to check if they need to change their password. If they do, I would open up a modal form for them to change their password. When they click a change password button, it would run an update SQL.
Jan 29 '11 #7
munkee
374 256MB
Here are the two sets of code I use.

The first is to validate a user login and to check if they have their password set to "Password" to redirect them to the change password form.

Expand|Select|Wrap|Line Numbers
  1. Private Sub cmdOk_Click()
  2. On Error GoTo Err_cmdOk_Click
  3. '-----------------------------------------------------------------------------------------------------------------------------
  4. ' This code is used to validate users found in the tblSecurity table. If the wrong user name or password is
  5. ' provided access is denied.
  6. '-----------------------------------------------------------------------------------------------------------------------------
  7.     Dim db As DAO.Database
  8.     Dim rst As DAO.Recordset
  9.     Dim rstV As Recordset
  10.     Dim stDocName As String
  11.     Dim stLinkCriteria As String
  12.  
  13.     Set db = CurrentDb()
  14.     Set rst = db.OpenRecordset("tblSecurity", dbOpenDynaset)
  15.  
  16.     If Not IsNull(Me.txtUser) And Not IsNull(Me.txtPassword) Then
  17.         rst.FindFirst "Password = '" & Me.txtPassword & "'" & " And UserID = '" & Me.txtUser & "'"
  18.  
  19.         If rst.NoMatch Then
  20.             MsgBox "You entered the wrong User Name or Password." & Chr(13) & _
  21.             "Please enter the correct User Name and Password or " & Chr(13) & _
  22.             "contact the Database Adminstrator for assistance.", vbOKOnly + vbCritical, "Logon Denied"
  23.         ElseIf Me.txtPassword = "password" Then
  24.             MsgBox "This is the first time using the database or your passowrd has been reset." & Chr(13) & _
  25.             "You must change your password before you can enter the database.", _
  26.             vbOKOnly + vbExclamation, "Change Password"
  27.             stDocName = "frmUserLogonNew"
  28.             stLinkCriteria = "[UserID]=" & "'" & Me![txtUser] & "'"
  29.             DoCmd.OpenForm stDocName, , , stLinkCriteria
  30.         Else
  31.             stDocName = "frmSplashScreen"
  32.             DoCmd.OpenForm stDocName, , , stLinkCriteria
  33.             Me.Visible = False
  34.         End If
  35.     Else
  36.         MsgBox "You left the User Name and/or Password blank." & Chr(13) & _
  37.         "Please enter the correct User Name and Password or " & Chr(13) & _
  38.         "contact the Database Adminstrator for assistance.", vbOKOnly + vbCritical, "Logon Denied"
  39.     End If
  40.  
  41.  
  42.     With Forms!frmhidden
  43.         .txtViewID = rst.Fields("ViewID")
  44.         .txtAccessID = rst.Fields("AccessID")
  45.         .txtActive = rst.Fields("Active")
  46.         .txtPassword = rst.Fields("Password")
  47.         .txtUserID = rst.Fields("UserID")
  48.         .txtSecurityID = rst.Fields("SecurityID")
  49.         .txtFName = rst.Fields("FName")
  50.         .txtSName = rst.Fields("SName")
  51.         .txtEMailAd = rst.Fields("EmailAd")
  52.         .txtUDept = rst.Fields("UDept")
  53.     End With
  54.  
  55.  
  56.  
  57.  
  58. Exit_cmdOk_Click:
  59. rst.Close
  60. Set rst = Nothing
  61. Set db = Nothing
  62.     Exit Sub
  63.  
  64. Err_cmdOk_Click:
  65.     Me.Visible = True
  66.     MsgBox Err.Description
  67.     Resume Exit_cmdOk_Click
  68.  
  69. End Sub

The second part of the code is my change password form allowing users to supply a new password twice and update their info:

Expand|Select|Wrap|Line Numbers
  1. Private Sub cmdOk_Click()
  2. On Error GoTo Err_cmdOk_Click
  3. '-----------------------------------------------------------------------------------------------------------
  4. ' This code is used to change the user password in the 'tblSecurity table.
  5.  
  6.     Dim stDocName As String
  7.     Dim stLinkCriteria As String
  8.  
  9.     If Not IsNull(Me.txtNPassword) And Not IsNull(Me.txtCPassword) Then
  10.         If Me.txtCPassword = Me.txtNPassword Then
  11.             stDocName = "qryUpdateUserPassowrd"
  12.             DoCmd.SetWarnings False
  13.             DoCmd.OpenQuery stDocName, acNormal, acEdit
  14.             DoCmd.SetWarnings True
  15.             MsgBox "Password was successfully change", vbOKOnly + vbInformation, "Password Changed"
  16.             stDocName = "frmSplashScreen"
  17.             DoCmd.OpenForm stDocName, , , stLinkCriteria
  18.         Else
  19.             MsgBox "New password and confirmation do not match." & _
  20.             Chr(13) & "Please enter the correct password and confirm", vbOKOnly + vbInformation, "Incorrect Password"
  21.         End If
  22.     Else
  23.         MsgBox "You left the User Name and/or Password blank." & Chr(13) & _
  24.         "Please enter the correct User Name and Password or " & Chr(13) & _
  25.         "contact the Database Adminstrator for assistance.", vbOKOnly + vbCritical, "Change Failed"
  26.     End If
  27.  
  28. Exit_cmdOk_Click:
  29.     Exit Sub
  30.  
  31. Err_cmdOk_Click:
  32.     MsgBox Err.Description
  33.     Resume Exit_cmdOk_Click
  34.  
  35. End Sub
The query the above references to has the following sql:

Expand|Select|Wrap|Line Numbers
  1. UPDATE tblSecurity SET tblSecurity.[Password] = Forms!frmUserLogonNew!txtCPassword
  2. WHERE (((tblSecurity.UserID)=[Forms]![frmUserLogonNew]![txtUser]));
  3.  
Jan 31 '11 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: MLH | last post by:
What's the simplest way to allow a user of an A97 app to change password?
10
by: Fabrizio | last post by:
(Sorry for the crosspost, but I really don't know which is the right newsgroup!) Hi all, I try to change the password to a user that as to change the password at first logon: try {
5
by: Ram | last post by:
Hey, I'v managed to set the "User Must Change Password At Next Logon" flag on the LDAP protocol, Using the - "pwdLastSet" property - by setting it to - "0" (for on) or - "-1" (for off). The...
0
by: Pavan | last post by:
Hi All, I am using Password Recovery control in order to reset my hashed passwords in ASP .Net 2.0 Beta 2. The system generated password is too difficult to remember, so i am giving Change...
6
by: a_hartmann_andersen | last post by:
Hi Guys Here is the problem: Im bored changing the local administrator password for a set of servers in a domain. So I though that I would write myself a little tool in C# to do that. I found...
4
by: arad | last post by:
I'm adding some pages to a website for a client and one of the options the client wants is for his employees to be able to login into a separate page for employees only, where they can retrieve...
1
by: roshina | last post by:
Hi Iam facing a problem in my project, developing a web site for online shopping in ASP on windows XP using IIS server. All the validations are ok but the new password is not upadated in the data...
7
parshupooja
by: parshupooja | last post by:
Hi I have created a login page which has user name n password. After entering values it authenticate from SQL Server and if it is correct, it forwards to designated page otherwise shows invalid...
10
matheussousuke
by: matheussousuke | last post by:
Hi, guys, I'm developing a script and it's almost done, just left two little things: Forgot password option Change password option About forgot password: The user can use as many user names...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.