Jump to content
hcl

Resovled: Reset password with checking old password

Recommended Posts

Dear all,

Goal: Reset the password (contact_num) after checking old password.

Note:

1. PIN authentication (contact_num) type is using .

2. Password update is working fine without checking old pasword.

What i have done is:

Created one link in home.htmpl of emp page as

<PDM_LINK class=analyst ID="btn001" font-size:0.7em NAME="My Profile" OP=UPDATE PERSID=cnt:$cst.id HTMPL=detail_cnt_edit.htmpl>Change Password</PDM_LINK>

My detail_cnt_edit.htmpl is:

<PDM_IF 0>
detail_cnt_edit.htmpl
WHEN PRESENTED:
When the app needs input to create a new Contact or update an
existing one.
INTENT:
Capture user input for a new Contact, create/update a Contact
when submitted.
VARIABLES:
string image The location of the image directory as
specified in the config file.
object cnt args The arguments from the 'last' form
See $NX_ROOT/bopcfg/majic/base.maj for the
definition of attributes for 'OBJECT cnt'
int logged_in A flag to say we have a user login object.
object cst cst A cst object (customer) that is the logged in user.
</PDM_IF>
<HTML>
<HEAD>
<PDM_INCLUDE FILE=styles.htmpl>
<script LANGUAGE="JavaScript">
var propKey = "$args.last_name";
if ( "$args.first_name" != "" )
propKey += ", $args.first_name $args.middle_name";
else if ( "$args.middle_name" != "" )
propKey += ", $args.middle_name";
</SCRIPT>
<PDM_INCLUDE FILE=std_head.htmpl filename="Contact">
<script LANGUAGE="JavaScript" SRC="$CAisd/scripts/arrow_button.js"></SCRIPT>
<script LANGUAGE="JavaScript" SRC="$CAisd/scripts/check_submit.js"></SCRIPT>
<script LANGUAGE="JavaScript" SRC="$CAisd/scripts/fid_gen.js"></SCRIPT>
<script LANGUAGE="JavaScript" SRC="$CAisd/scripts/check_submit.js"></SCRIPT>
<script LANGUAGE="JavaScript" SRC="$CAisd/scripts/popup.js"></SCRIPT>
<script LANGUAGE="JavaScript" SRC="$CAisd/scripts/val_type.js"></SCRIPT>
<script LANGUAGE="JavaScript" SRC="$CAisd/scripts/sitemods.js"></SCRIPT>
<script LANGUAGE="JavaScript" SRC="$CAisd/scripts/detail_form.js"></SCRIPT>
<script LANGUAGE="JavaScript" SRC="$CAisd/scripts/role.js"></SCRIPT>
<script LANGUAGE="JavaScript" SRC="$CAisd/scripts/update_lrel.js"></SCRIPT>
<script LANGUAGE="JavaScript">

<!-- Entered By Saran start -->
var z_old_pwd;
z_old_pwd = document.frm001.z_old_pwd.value;
var z_old_pwd1 = '$args.contact_num';

function zflag_count()
{
var z_flag
z_flag = document.frm001.z_flag.value = 0;
return true
}
function zchk_oldpsw()
{
var z_old_pwd;
z_old_pwd = document.frm001.z_old_pwd.value;
var z_old_pwd1 = '$args.contact_num';
if(z_old_pwd != z_old_pwd1)
{
alert("Wrong Old Password")
document.frm001.z_old_pwd.focus()
window.location.reload();
return false;
}
else
{
return true;
}
}

function zchk_pwd()
{
var z_pwd
z_pwd = document.frm001.z_pwd.value
z_pwd1 = document.frm001.z_pwd1.value
if(z_pwd == "")
{
alert("Password cannot be blank.")
document.frm001.z_pwd.focus()
window.location.reload();
return false;
}
if(z_pwd != z_pwd1)
{
alert("Password and ReType Password do not match. Please check.")
document.frm001.z_pwd.focus()
window.location.reload();
return false;
}
if(z_pwd.toLowerCase() == "servicedesk")
{
alert("Password can not be \"servicedesk\".")
document.frm001.z_pwd.focus()
window.location.reload();
return false;
}


return true
}
</SCRIPT>
</HEAD>
<BODY class=editform>
<PDM_INCLUDE FILE=std_header.htmpl>
<CENTER>
<IMG SRC=$CAisd/img/bar.gif WIDTH=90% HEIGHT=4 ALT=Bar>
<PDM_FORM NAME="frm001" ONSUBMIT="return check_submit() && zchk_oldpsw() &&zchk_pwd()">
<INPUT TYPE=hidden NAME=FACTORY VALUE=cnt>
<PDM_IF $args.id>
<INPUT TYPE=hidden NAME=SET.id VALUE="$args.id">
</PDM_IF>
<INPUT TYPE=hidden NAME=OP VALUE="UPDATE">
<script LANGUAGE="JavaScript">
ImgBtnCreate("btnSave", "Update", "pdm_submit('frm001','UPDATE')","defer", 120);
</SCRIPT>

<!-- EDIT TAGS -->
<table>
<tr>
<td>
$args.contact.num
</td>
</tr>
</table>
<TABLE ID="tbl001">
<TH ALIGN=LEFT>
<TABLE ID="tbl002">
<TH ALIGN=LEFT>
<PDM_IF 0 != $args.REQUIRED_last_name>
<SPAN class=requiredlabeltext>Last Name</SPAN>
<PDM_ELSE>
<SPAN class=labeltext>Last Name</SPAN>
</PDM_IF>
</TH>
<TR>
<TD VALIGN=TOP class=detailro>$args.last_name</TD><TDVALIGN=TOP class=detailro>$args.contact_num</TD>
</TR>
</TABLE>
<TABLE ID="tbl003">
<TH ALIGN=LEFT>
<PDM_IF 0 != $args.REQUIRED_contact_num>
<SPAN class=requiredlabeltext>Old Password</SPAN>
<PDM_ELSE>
<SPAN class=labeltext>Old Password</SPAN>
</PDM_IF>
</TH>
<TH ALIGN=LEFT>
<PDM_IF 0 != $args.REQUIRED_contact_num>
<SPAN class=requiredlabeltext>Password</SPAN>
<PDM_ELSE>
<SPAN class=labeltext>Password</SPAN>
</PDM_IF>
</TH>
<TH ALIGN=LEFT>
<PDM_IF 0 != $args.REQUIRED_contact_num>
<SPAN class=requiredlabeltext>ReType Password</SPAN>
<PDM_ELSE>
<SPAN class=labeltext>ReType Password</SPAN>
</PDM_IF>
</TH>
<TH ALIGN=LEFT>
<PDM_IF 0 != $args.REQUIRED_zflag>
<SPAN class=requiredlabeltext>Zflag</SPAN>
</PDM_IF>
</TH>
<TR>
<TD VALIGN=TOP>
<INPUT TYPE=PASSWORD NAME=oldpsw SIZE=15 id="z_old_pwd">
</TD>
<TD VALIGN=TOP>
<INPUT TYPE=PASSWORD NAME=SET.contact_num SIZE=15 id="z_pwd">
</TD>
<TD VALIGN=TOP>
<INPUT TYPE=PASSWORD NAME=RESET.contact_num SIZE=15 id="z_pwd1">
</TD>
<TD VALIGN=TOP>
<INPUT TYPE=HIDDEN NAME=SET.zflag SIZE=15 id="z_flag">
</TD>
</TR>
</TABLE>
<IMG SRC=$CAisd/img/bar.gif WIDTH=100% HEIGHT=4 ALT=Bar>
</PDM_FORM>
<!-- If Cancel Link brings up the form other than main menu, we do not want to
set the TARGET to _top because it will cause the next form to show without
main menu on the side.
-->
<PDM_IF 0 == $args.id>
<PDM_IF "" == "$args.NEXT_PERSID">
<BASE TARGET="_top">
</PDM_IF>
</PDM_IF>
<BASE TARGET="_top">
<PDM_INCLUDE FILE=std_footer.htmpl>
</CENTER>
</BODY>
</HTML>
<PDM_IF 0>
@(#)$Id: detail_cnt_edit.htmpl,v 1.43.1.2 2001/08/09 22:09:05 lauke01 Exp $
</PDM_IF>
<!-- END -->

Problem Faced:

Now checking the old password is fine. Like when i enter wrong old password and click update button, it popup "Wrong old password". fine.

Freshly. if i login and giving correct password and new password, it updates fine. But when i give wrong password, the page is reloaded because of window.location.reload(); given. then if i give correct old password and new password means, it is not updated, showing "Save in progress.." popup. and old password remains.

Pls give solution.

Hope anybody can help me.

Thanks in advance.

Regards,

Saran

Share this post


Link to post
Share on other sites

I'm not sure but why are you reloading the window when there was an error?

You should be able to 'erase' the content of the wrong field and focus back onto it or something, so the user can correct the error.

Or am I missing something here?

Share this post


Link to post
Share on other sites

Hi prohacx,

U r correct. It is solved

Replacing the line <INPUT TYPE=PASSWORD NAME=oldpsw SIZE=15 id="z_old_pwd"> with

<INPUT TYPE=PASSWORD NAME=oldpsw SIZE=15 id="z_old_pwd" onblur="zchk_oldpsw();">

It should not allow to move from old psw text box unless u give correct old psw.

Regards,

Saran

Share this post


Link to post
Share on other sites

Hello,

I am using your customization in our environment for external users, everything is working fine but when i click update button field is update but also giving me below error.

AHD04407:CA Service Desk Manager html generation error. Could not find or process 'detail_cnt_ro.htmpl'.

AHD04714:Unable to open file detail_cnt_ro.htmpl at ?: No such file or directory (2) userid=**********

Kindly help me!

 

Regards,

Naveed Akhter

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...