Click here to Skip to main content
15,909,440 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
In GUI, we have a condition that during fisrt time login we have to change password.
In GUI. we have two buttons :
1- cancel
2- change

I want cancel button should be in disabled state when we are trying to login first time ?

Please find the below piece of code :
HTML
<TR>
<TD><B>$SPAuthentication_Username</B></TD>
<TD COLSPAN="2">$name<INPUT TYPE="hidden" NAME="Username" VALUE="$name"></TD>
</TD></TR>

<TR><TD><B>$SPAuthentication_Old_Password</B></TD>
<TD COLSPAN="2"><INPUT TYPE="password" NAME="OldPassword" SIZE=22 MAXLENGTH=40 VALUE="">
</TD></TR>

<TR><TD><B>$SPAuthentication_New_Password</B></TD>
<TD COLSPAN="2"><INPUT TYPE="password" NAME="Password" SIZE=22 MAXLENGTH=40 VALUE="">
</TD></TR>

<TR><TD><B>$SPAuthentication_Confirm_Password</B></TD>
<TD COLSPAN="2"><INPUT TYPE="password" NAME="ConfirmPassword" SIZE=22 MAXLENGTH=40 VALUE="">
</TD></TR>
</TABLE>
</FIELDSET>
<P ALIGN="RIGHT">
    #reference("$SO_Button_Cancel", "$Request.ServletPath/Services/ListServices$csrfTokenWithQuestionMark", "$General_Cancel", "button")
&nbsp;
   	<input name="save" type="submit" class="submitButton" value="$SO_Button_Change"/>

$General_Cancel = Cancel //value
$SO_Button_Change ='Change' //value


What I have tried:

Can you please tell me how will i disable cancel button during first time login ?
Posted
Updated 7-Jul-16 2:31am
v2
Comments
Richard MacCutchan 7-Jul-16 8:24am    
How do you decide that it is first time?
Member 12539934 7-Jul-16 8:29am    
As soon as we are login to the GUI, if you are first user , this password change page will come first . U have to amndatory change the password then able to do any operations.

1 solution

This is the full authentication code file :
webmacro
## Authentication/SPAuthentication.wm 
## Copyright (c) 2002 First Hop Ltd
##
## Edit authentication information
##
#include as macro "functions.wm" 
#parse "CSRFTokenUtil.wm"
#set $title="Service Manager ::: Authentication"
#set $helplink="changing_passwords.html#sp_authentication"
#set $menuname="Authentication"
#set $provider = $database.getProfile($Session.Value.provider)

#if(!$Session.Value.provider || $Session.Value.provider == null) {

	#set $principal = $Request.getUserPrincipal()
	
	#if ($principal != null) {
		#set $provider = $operator.getServiceProviderByUser($principal.getName())
		$Session.putValue("provider", $provider.Key )
	}
}

#if($Form.targetId){
#set $modifiedprovider = $Session.Value.modifiedprovider
} #else {
#set $modifiedprovider = $provider.modify()
$Session.putValue("modifiedprovider",$modifiedprovider)
}

#set $lengthCheckRequired=$modifiedprovider.isLengthCheckRequired()
#set $complexityCheckRequired=$modifiedprovider.isComplexityCheckRequired()

#set $name = $provider.getUsername()

#parse "SPHeader.wm"
<h1>#help_link("$SPAuthentication_Authentication_Help_link", "$SPAuthentication_Authentication_Help_ttip") $SPAuthentication_Authentication</h1>

<p>$SPAuthentication_Change_authentication</p>
<fieldset>
<legend>#help_link("$SPAuthentication_SP_info_Help_link", "$SPAuthentication_SP_info_Help_ttip") $SPAuthentication_SP_info</legend>
#if(!$isLogout) {
<form action="$Request.ServletPath/Authentication/SPAuthentication$csrfTokenWithQuestionMark">
method=post ACCEPT-CHARSET="UTF-8" ONSUBMIT="return passwordValidate(this,'$lengthCheckRequired','$complexityCheckRequired')">
<input type="hidden" name="targetId" value="S:modifiedprovider">
<input type="hidden" name="savePage" value="/Authentication/SPAuthentication">
<input type="hidden" name="saveObject" value="modifiedprovider">
<input type="hidden" name="CheckHistory" value="true">
<input type="hidden" name="isChangePasswordRequest" value="true">
<table>
<tr>
<td>$SPAuthentication_Username</td>
<td colspan="2">$name<input type="hidden" name="Username" value="$name"></input></td>
</tr>

<tr><td>$SPAuthentication_Old_Password</td>
<td colspan="2"><input type="password" name="OldPassword" size="22" maxlength="40" value="">
</input></td></tr>

<tr><td>$SPAuthentication_New_Password</td>
<td colspan="2"><input type="password" name="Password" size="22" maxlength="40" value="">
</input></td></tr>

<tr><td>$SPAuthentication_Confirm_Password</td>
<td colspan="2"><input type="password" name="ConfirmPassword" size="22" maxlength="40" value="">
</input></td></tr>
</table>
</input></input></input></input></input></form></fieldset>
<p align="RIGHT">
    ##reference("$SO_Button_Cancel", "$Request.ServletPath/Services/ListServices$csrfTokenWithQuestionMark", "$General_Cancel", "button")
 
	<input name="save" type="submit" class="submitButton" value="$General_Cancel" />
   	<input name="save" type="submit" class="submitButton" value="$SO_Button_Change" />

</p>


} #else {
<table cellpadding="2" border="0" cellspacing="0" width="350">
<tr><td nowrap="">Username</td><td>$name</td></tr>
</table>
}

 <script type="text/javascript">
    if (localStorage.getItem("AG_SP_USER_TEMP") != null ) {
	localStorage.setItem("AG_SP_USER",localStorage.getItem("AG_SP_USER_TEMP"));
	localStorage.removeItem("AG_SP_USER_TEMP");
	}
 </script>

#parse "SPFooter.wm"


As soon as we login we are directly going to this authentication file ?
 
Share this answer
 
v2
Comments
Member 12539934 7-Jul-16 10:19am    
How can I disabled "cancel" button on first login. It is not html so i am not sure whether onsubmit =button.'disabled.true" will work or not ? You have any idea ?
Member 12539934 8-Jul-16 5:50am    
#if($okmessage != "Your password was expired") {
#reference("$SO_Button_Cancel", "$Request.ServletPath/Services/ListServices$csrfTokenWithQuestionMark", "$General_Cancel", "button")
}
 
<input name="save" type="submit" class="submitButton" value="$SO_Button_Change"/>

In this way I am able to do this but I have to do this for 4 conditions when I m trying to use or condition like this , it is not working :
#if(($okmessage != "You should change predefined password") ||(($okmessage != "Your password was expired")) {
#reference("$SO_Button_Cancel", "$Request.ServletPath/Services/ListServices$csrfTokenWithQuestionMark", "$General_Cancel", "button")
}

It is not working. I am not sure why "or" condition is not working . Any idea ?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900