|
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Login.aspx.cs" Inherits="Login" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script src="http://code.jquery.com/jquery-1.7.1.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function () {
//on Button click event
$('#btnSubmit').click(function () {
validate($('#txtPassword').val());
});
});
var error = "Password must use a combination of these:<br />I.Atleast 1 upper case letters (A – Z)<br />II.Lower case letters (a – z)<br />III.Atleast 1 number (0 – 9)<br />IV.Atleast 1 non-alphanumeric symbol (e.g. @ ‘$%£!’)";
function validate(val) {
$('#TDStatus').html('');
$.ajax({
type: "POST",
url: "Login.aspx/ValidatePassword",
data: "{'password':'" + val + "'}",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (msg) {
if (msg.d.length > 0) {
if (msg.d == "success") {
$('#TDStatus').html('Congratulations! Your password is strong.');
}
else if (msg.d == "fail") {
$('#TDStatus').html(error);
}
}
},
async: false,
error: function (xhr, status, error) {
//alert(xhr.statusText);
$('#TDStatus').html('<center>Error occured!</center>');
}
});
}
</script>
<style>
.error
{
color: Red;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<br />
<br />
<font face="verdana,arial" size="-1">
<center>
<table cellpadding='2' cellspacing='0' border='0' id='ap_table'>
<tr>
<td bgcolor="blue">
<table cellpadding='0' cellspacing='0' border='0' width='100%'>
<tr>
<td bgcolor="blue" align="center" style="padding: 2; padding-bottom: 4">
<b><font size="-1" color="white" face="verdana,arial"><b>Register User</b></font>
</td>
</tr>
<tr>
<td bgcolor="white" style="padding: 5">
<table style="width: 425px">
<tr>
<td>
<font face="verdana,arial" size="-1">User Name:</font>
</td>
<td>
<asp:TextBox ID="txtUsername" runat="server" Width="197px"></asp:TextBox>
</td>
</tr>
<tr>
<td>
<font face="verdana,arial" size="-1">Password:</font>
</td>
<td>
<asp:TextBox ID="txtPassword" TextMode="Password" runat="server" Width="197px"></asp:TextBox>
</td>
</tr>
<tr>
<td colspan="2" id="TDStatus" class="error">
</td>
</tr>
<tr>
<td colspan="2" align="right">
<input type="button" id="btnSubmit" value="Register" height="26px" width="71px" />
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</center>
</font>
</form>
</body>
</html>
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.