You must go to the Google reCaptcha website and register your domain and get a data site-key
https://www.google.com/recaptcha/
* Need to first edit this page: c:\Windows\web\RDWeb\Pages\en-US\login.aspx
This page needs a few customizations
Search for <HTMLMainContent> and add the following lines after it
<HTMLMainContent>
<script src="https://www.google.com/recaptcha/api.js"></script>
<script type="text/javascript">
function callValidation(){
if(grecaptcha.getResponse().length == 0){
alert('Please click the reCAPTCHA checkbox');
return false;
}
return onLoginFormSubmit();
return true;
}
</script>
Search for this piece of code.
<form id="FrmLogin" name="FrmLogin" action="login.aspx<%=SecurityElement.Escape(strReturnUrl)%>" method="post" onsubmit="return onLoginFormSubmit();">
Change onLoginFormSubmit to callValidation
<form id="FrmLogin" name="FrmLogin" action="login.aspx<%=SecurityElement.Escape(strReturnUrl)%>" method="post" onsubmit="return callValidation();">
Search for this line of code. Easiest to do a search for this phrase: btnSignIn
<td align="right"><label><input type="submit" class="formButton" id="btnSignIn" value="<%=L_SignInLabel_Text%> " /></label>
Immediately after this line, add this line
(Enter your site key that you got from the Google reCaptcha website)
<div class="g-recaptcha" data-sitekey="ENTER YOUR GOOGLE SiteID here"></div>
Save your file. Now you must do the next step
To ensure all the browsers (especially IE and EDGE) work, you must change the default compatability mode from IE 9 standards to IE 11.
** If you do not, reCaptcha will hang and not work in IE and EDGE
* Edit this file: c:\windows\web\RDWeb\Pages\Site.xsl
Search for this line. Easiest to search for phrase IE=9
Change IE=9 to IE=11
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
Save your file. This should now work for you in all browsers
default.aspx
<RDWAPage
helpurl="<%=sHelpSourceServer%>"
domainuser="<%=SecurityElement.Escape(strDomainUserName)%>"
workspacename="<%=AntiXssEncoder.XmlAttributeEncode(strWorkspaceName)%>"
userexpiration="<%=GetPasswordExpirationDate(strDomainUserName)%>"
userexpirationdaysleft="<%=GetPasswordExpirationNumDays(strDomainUserName)%>"
userdisplayname="<%=GetDisplayName(strDomainUserName)%>"
baseurl="<%=SecurityElement.Escape(baseUrl.AbsoluteUri)%>"
privacyurl="<%=AntiXssEncoder.XmlAttributeEncode(strPrivacyUrl)%>"
public static string GetPasswordExpirationNumDays(string strUserName)
{
string strLDAPPath = "LDAP://dc=snet,dc=crouse,dc=org";
string strFilter = string.Empty;
if(strUserName.Contains("\\")){strUserName = strUserName.Substring(1 + strUserName.IndexOf("\\"));}
strFilter = "(SAMAccountName=" + strUserName + ")";
if(strUserName.Contains("@")){strFilter = "(UserPrincipalName=" + strUserName + ")";}
System.DirectoryServices.DirectoryEntry de = new System.DirectoryServices.DirectoryEntry(strLDAPPath);
System.DirectoryServices.DirectorySearcher ds = new System.DirectoryServices.DirectorySearcher(de);
ds.Filter = strFilter;
ds.PropertiesToLoad.Add("displayName");
ds.PropertiesToLoad.Add("pwdLastSet");
ds.PropertiesToLoad.Add("maxPwdAge");
ds.PropertiesToLoad.Add("AccountExpirationDate");
//ds.PropertiesToLoad.Add("sAMAccountname");
System.DirectoryServices.SearchResultCollection results = ds.FindAll();
long maxDays = 90;
long lastChangedTicks;
System.DirectoryServices.ResultPropertyValueCollection pwdLastSetProp;
pwdLastSetProp = results[0].Properties["pwdLastSet"];
//Int64 maxPwdAge=(Int64)results[0].Properties["maxPwdAge"][0];
// maxDays = maxPwdAge/-864000000000;
long daysLeft=0;
if ((pwdLastSetProp != null) &&
(pwdLastSetProp.Count > 0) &&
long.TryParse(pwdLastSetProp[0].ToString(), out lastChangedTicks))
{
var lastChanged = results[0].Properties["pwdLastSet"][0];
daysLeft = maxDays - DateTime.Today.Subtract(
DateTime.FromFileTime((long)lastChanged)).Days *1;
return daysLeft.ToString();
}
//return "Expires: " + System.DateTime.FromFileTime(lastChangedTicks).AddDays(90).ToString("MM/dd/yyyy H:mm");
// if ((pwdLastSetProp != null) &&
// (pwdLastSetProp.Count > 0) &&
// long.TryParse(pwdLastSetProp[0].ToString(), out lastChangedTicks))
// return "Expires: " + System.DateTime.FromFileTime(lastChangedTicks).AddDays(90).ToString("MM/dd/yyyy H:mm");
return "nope.";
//return (DateTime)results.InvokeGet("PasswordExpirationDate");
// return (results != null && results.Count > 0) ? (DateTime)results.InvokeGet("PasswordExpirationDate") : string.Empty;
//return (results != null && results.Count > 0) ? results[0].Properties["displayName"][0].ToString() : string.Empty;
}
site.xsl
<xsl:variable name="userexpirationdaysleft" select="/RDWAPage/@userexpirationdaysleft"/><xsl:if test="$userexpiration"> (<xsl:value-of select="$userexpiration"/>)</xsl:if><BR />
<xsl:if test="$userexpirationdaysleft"> (<xsl:value-of select="$userexpirationdaysleft"/> Day(s) Left)</xsl:if>