473,748 Members | 2,615 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

51 New Member
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 4393
Marty L
8 New Member
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
Jesse Jones
51 New Member
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 Contributor
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
Jesse Jones
51 New Member
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 Contributor
I'll post some code in the morning
Jan 29 '11 #6
Rabbit
12,516 Recognized Expert Moderator MVP
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 Contributor
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
2417
by: MLH | last post by:
What's the simplest way to allow a user of an A97 app to change password?
10
9884
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
20268
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 problem is, I dont know how to check what's the current status of this user - When I try and read this property from the user's DirectoryEntry, I get a "System.ComObject" object, and I cant get any data from this object. Does Anyone has an idea what...
0
1243
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 Password, support to the user. Now my current task is
6
2200
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 bits and pices but the subject, but not anything solid. Ofcause its out there :-) can anybody help me out on this. Thanks!
4
4630
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 information such as monthly schedules, etc. The person who created the website originally had made a link that would take you to that page. When you click on the link it prompts you to enter a password, but when you're entering the password you can...
1
7428
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 base and also showing a error page. the operating system we used is Windows XP, the source code is ASP, front end we used - HTML and javascript and vb script for validations. the inputs we used are : old pasword :
7
5387
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 login message. i have 5000 users in my system, so i opted this way. Now i want ot create a button on login page which shows change password. I want to replace my old password field value with new password field. I don't want to create another column...
10
3478
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 under the same email adress, so the system needs a way to send the password for user email when user type the user name on field of forgot password. I'm running it under php 4, so don't worry if u see a $HTTP_POST_VARS. :)
0
9562
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9386
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9254
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8255
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6799
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4608
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3319
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2791
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2217
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.