Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Changing Password using Hyper link?

Status
Not open for further replies.

shearak

Programmer
Aug 22, 2001
9
0
0
US
I am trying to use a link to allow users to change their password after they login. I am putting this in a footer include. But how do you pass the users password/Username onto the Change_password.cfm(action page). It works but it does pass the current login users info. Please advice

Thanks,
Ahmad

This is the Links page:

<cfquery name = &quot;main&quot; datasource = &quot;MIP&quot; username = &quot;MIP&quot; password = &quot;MIPadmin&quot;>
SELECT UserGroup, pwd_lastmod, UserID
FROM Users
ORDER BY User_Name ASC
</CFquery>

<CFoutput query=&quot;main&quot;><a href=&quot;Change_password.cfm?id=#UserID#&quot;></cfoutput> Change Password</a>


The Change_password.cfm page:

<CFIF IsDefined(&quot;action&quot;)>
<cfquery name = &quot;main&quot; datasource = &quot;MIP&quot; username = &quot;MIP&quot; password = &quot;MIPadmin&quot;>
SELECT COUNT(*)
AS nUser
FROM Users
WHERE User_Name = '#Form.password#'
AND UserID <> #id#
</CFquery>
<!--- <CFIF #main.nUser# GT 0>
<CFLocation url = &quot;modify_user.cfm?error=1&quot;>
</CFIF> --->
<cfquery name = &quot;updato&quot; datasource = &quot;MIP&quot; username = &quot;MIP&quot; password = &quot;MIPadmin&quot;>
UPDATE Users
SET
User_Name = '#Form.login_name#',
Password = '#Form.password#',
Active = 'Y'
WHERE UserID = #id#
</CFquery>
<CFLocation url = &quot;index.cfm&quot;>
</CFIF>


<cfquery name = &quot;main&quot; datasource = &quot;MIP&quot; username = &quot;MIP&quot; password = &quot;MIPadmin&quot;>
SELECT UserID, User_name, Password, UserGroup
FROM Users
WHERE UserID = #id#
ORDER BY User_Name ASC
</CFquery>


<CFform name = &quot;mod_form&quot; method=&quot;POST&quot; action=&quot;change_password.cfm?action=add&id=#id#&quot;>

Username: <input type=&quot;text&quot; name=&quot;login_name&quot; value=&quot;#user_name#&quot; size=&quot;20&quot; maxlength=&quot;15&quot; onFocus=&quot;this.blur()&quot;>

Password:
<input type = &quot;password&quot; name = &quot;password&quot; maxlength = &quot;15&quot; size = &quot;20&quot; value = &quot;#password#&quot; >
Re-type Passwor:
<input value = &quot;#password#&quot; type = &quot;password&quot; name = &quot;reword&quot; maxlength = &quot;15&quot; size = &quot;20&quot;>
<input type = &quot;button&quot; value = &quot;Change&quot; onClick = &quot;JavaScript: var hForm = new IMipForm(); hForm.Validate
<input type = &quot;button&quot; onClick = &quot;window.location = 'index.cfm';&quot; value = &quot;CANCEL&quot;>


 
Sorry on the last line.
I am trying to use a link to allow users to change their password after they login. I am putting this in a footer include. But how do you pass the users password/Username onto the Change_password.cfm(action page). It works but it does not pass the current login users info. Please advice
 
You could put the id and the action (from the action= in the query part of the form action) in a hidden filed on the form. ie
<input type=hidden name=id value=<cfoutput>#id#</cfoutput>>
<input type=hidden name=action value=add>
then on the page you submit to just use #form.id# to get the uers id.
Hope this helps.
Leslie
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top