lab 3
This commit is contained in:
60
lab3/cs_lab3/myWebApplication/Account/ChangePassword.aspx
Normal file
60
lab3/cs_lab3/myWebApplication/Account/ChangePassword.aspx
Normal file
@ -0,0 +1,60 @@
|
||||
<%@ Page Title="Change Password" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true"
|
||||
CodeBehind="ChangePassword.aspx.cs" Inherits="myWebApplication.Account.ChangePassword" %>
|
||||
|
||||
<asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">
|
||||
</asp:Content>
|
||||
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
|
||||
<h2>
|
||||
Change Password
|
||||
</h2>
|
||||
<p>
|
||||
Use the form below to change your password.
|
||||
</p>
|
||||
<p>
|
||||
New passwords are required to be a minimum of <%= Membership.MinRequiredPasswordLength %> characters in length.
|
||||
</p>
|
||||
<asp:ChangePassword ID="ChangeUserPassword" runat="server" CancelDestinationPageUrl="~/" EnableViewState="false" RenderOuterTable="false"
|
||||
SuccessPageUrl="ChangePasswordSuccess.aspx">
|
||||
<ChangePasswordTemplate>
|
||||
<span class="failureNotification">
|
||||
<asp:Literal ID="FailureText" runat="server"></asp:Literal>
|
||||
</span>
|
||||
<asp:ValidationSummary ID="ChangeUserPasswordValidationSummary" runat="server" CssClass="failureNotification"
|
||||
ValidationGroup="ChangeUserPasswordValidationGroup"/>
|
||||
<div class="accountInfo">
|
||||
<fieldset class="changePassword">
|
||||
<legend>Account Information</legend>
|
||||
<p>
|
||||
<asp:Label ID="CurrentPasswordLabel" runat="server" AssociatedControlID="CurrentPassword">Old Password:</asp:Label>
|
||||
<asp:TextBox ID="CurrentPassword" runat="server" CssClass="passwordEntry" TextMode="Password"></asp:TextBox>
|
||||
<asp:RequiredFieldValidator ID="CurrentPasswordRequired" runat="server" ControlToValidate="CurrentPassword"
|
||||
CssClass="failureNotification" ErrorMessage="Password is required." ToolTip="Old Password is required."
|
||||
ValidationGroup="ChangeUserPasswordValidationGroup">*</asp:RequiredFieldValidator>
|
||||
</p>
|
||||
<p>
|
||||
<asp:Label ID="NewPasswordLabel" runat="server" AssociatedControlID="NewPassword">New Password:</asp:Label>
|
||||
<asp:TextBox ID="NewPassword" runat="server" CssClass="passwordEntry" TextMode="Password"></asp:TextBox>
|
||||
<asp:RequiredFieldValidator ID="NewPasswordRequired" runat="server" ControlToValidate="NewPassword"
|
||||
CssClass="failureNotification" ErrorMessage="New Password is required." ToolTip="New Password is required."
|
||||
ValidationGroup="ChangeUserPasswordValidationGroup">*</asp:RequiredFieldValidator>
|
||||
</p>
|
||||
<p>
|
||||
<asp:Label ID="ConfirmNewPasswordLabel" runat="server" AssociatedControlID="ConfirmNewPassword">Confirm New Password:</asp:Label>
|
||||
<asp:TextBox ID="ConfirmNewPassword" runat="server" CssClass="passwordEntry" TextMode="Password"></asp:TextBox>
|
||||
<asp:RequiredFieldValidator ID="ConfirmNewPasswordRequired" runat="server" ControlToValidate="ConfirmNewPassword"
|
||||
CssClass="failureNotification" Display="Dynamic" ErrorMessage="Confirm New Password is required."
|
||||
ToolTip="Confirm New Password is required." ValidationGroup="ChangeUserPasswordValidationGroup">*</asp:RequiredFieldValidator>
|
||||
<asp:CompareValidator ID="NewPasswordCompare" runat="server" ControlToCompare="NewPassword" ControlToValidate="ConfirmNewPassword"
|
||||
CssClass="failureNotification" Display="Dynamic" ErrorMessage="The Confirm New Password must match the New Password entry."
|
||||
ValidationGroup="ChangeUserPasswordValidationGroup">*</asp:CompareValidator>
|
||||
</p>
|
||||
</fieldset>
|
||||
<p class="submitButton">
|
||||
<asp:Button ID="CancelPushButton" runat="server" CausesValidation="False" CommandName="Cancel" Text="Cancel"/>
|
||||
<asp:Button ID="ChangePasswordPushButton" runat="server" CommandName="ChangePassword" Text="Change Password"
|
||||
ValidationGroup="ChangeUserPasswordValidationGroup"/>
|
||||
</p>
|
||||
</div>
|
||||
</ChangePasswordTemplate>
|
||||
</asp:ChangePassword>
|
||||
</asp:Content>
|
17
lab3/cs_lab3/myWebApplication/Account/ChangePassword.aspx.cs
Normal file
17
lab3/cs_lab3/myWebApplication/Account/ChangePassword.aspx.cs
Normal file
@ -0,0 +1,17 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
|
||||
namespace myWebApplication.Account
|
||||
{
|
||||
public partial class ChangePassword : System.Web.UI.Page
|
||||
{
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
26
lab3/cs_lab3/myWebApplication/Account/ChangePassword.aspx.designer.cs
generated
Normal file
26
lab3/cs_lab3/myWebApplication/Account/ChangePassword.aspx.designer.cs
generated
Normal file
@ -0,0 +1,26 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace myWebApplication.Account
|
||||
{
|
||||
|
||||
|
||||
public partial class ChangePassword
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// ChangeUserPassword control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.ChangePassword ChangeUserPassword;
|
||||
}
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
<%@ Page Title="Change Password" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true"
|
||||
CodeBehind="ChangePasswordSuccess.aspx.cs" Inherits="myWebApplication.Account.ChangePasswordSuccess" %>
|
||||
|
||||
<asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">
|
||||
</asp:Content>
|
||||
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
|
||||
<h2>
|
||||
Change Password
|
||||
</h2>
|
||||
<p>
|
||||
Your password has been changed successfully.
|
||||
</p>
|
||||
</asp:Content>
|
@ -0,0 +1,17 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
|
||||
namespace myWebApplication.Account
|
||||
{
|
||||
public partial class ChangePasswordSuccess : System.Web.UI.Page
|
||||
{
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
17
lab3/cs_lab3/myWebApplication/Account/ChangePasswordSuccess.aspx.designer.cs
generated
Normal file
17
lab3/cs_lab3/myWebApplication/Account/ChangePasswordSuccess.aspx.designer.cs
generated
Normal file
@ -0,0 +1,17 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace myWebApplication.Account
|
||||
{
|
||||
|
||||
|
||||
public partial class ChangePasswordSuccess
|
||||
{
|
||||
}
|
||||
}
|
49
lab3/cs_lab3/myWebApplication/Account/Login.aspx
Normal file
49
lab3/cs_lab3/myWebApplication/Account/Login.aspx
Normal file
@ -0,0 +1,49 @@
|
||||
<%@ Page Title="Log In" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true"
|
||||
CodeBehind="Login.aspx.cs" Inherits="myWebApplication.Account.Login" %>
|
||||
|
||||
<asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">
|
||||
</asp:Content>
|
||||
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
|
||||
<h2>
|
||||
Log In
|
||||
</h2>
|
||||
<p>
|
||||
Please enter your username and password.
|
||||
<asp:HyperLink ID="RegisterHyperLink" runat="server" EnableViewState="false">Register</asp:HyperLink> if you don't have an account.
|
||||
</p>
|
||||
<asp:Login ID="LoginUser" runat="server" EnableViewState="false" RenderOuterTable="false">
|
||||
<LayoutTemplate>
|
||||
<span class="failureNotification">
|
||||
<asp:Literal ID="FailureText" runat="server"></asp:Literal>
|
||||
</span>
|
||||
<asp:ValidationSummary ID="LoginUserValidationSummary" runat="server" CssClass="failureNotification"
|
||||
ValidationGroup="LoginUserValidationGroup"/>
|
||||
<div class="accountInfo">
|
||||
<fieldset class="login">
|
||||
<legend>Account Information</legend>
|
||||
<p>
|
||||
<asp:Label ID="UserNameLabel" runat="server" AssociatedControlID="UserName">Username:</asp:Label>
|
||||
<asp:TextBox ID="UserName" runat="server" CssClass="textEntry"></asp:TextBox>
|
||||
<asp:RequiredFieldValidator ID="UserNameRequired" runat="server" ControlToValidate="UserName"
|
||||
CssClass="failureNotification" ErrorMessage="User Name is required." ToolTip="User Name is required."
|
||||
ValidationGroup="LoginUserValidationGroup">*</asp:RequiredFieldValidator>
|
||||
</p>
|
||||
<p>
|
||||
<asp:Label ID="PasswordLabel" runat="server" AssociatedControlID="Password">Password:</asp:Label>
|
||||
<asp:TextBox ID="Password" runat="server" CssClass="passwordEntry" TextMode="Password"></asp:TextBox>
|
||||
<asp:RequiredFieldValidator ID="PasswordRequired" runat="server" ControlToValidate="Password"
|
||||
CssClass="failureNotification" ErrorMessage="Password is required." ToolTip="Password is required."
|
||||
ValidationGroup="LoginUserValidationGroup">*</asp:RequiredFieldValidator>
|
||||
</p>
|
||||
<p>
|
||||
<asp:CheckBox ID="RememberMe" runat="server"/>
|
||||
<asp:Label ID="RememberMeLabel" runat="server" AssociatedControlID="RememberMe" CssClass="inline">Keep me logged in</asp:Label>
|
||||
</p>
|
||||
</fieldset>
|
||||
<p class="submitButton">
|
||||
<asp:Button ID="LoginButton" runat="server" CommandName="Login" Text="Log In" ValidationGroup="LoginUserValidationGroup"/>
|
||||
</p>
|
||||
</div>
|
||||
</LayoutTemplate>
|
||||
</asp:Login>
|
||||
</asp:Content>
|
17
lab3/cs_lab3/myWebApplication/Account/Login.aspx.cs
Normal file
17
lab3/cs_lab3/myWebApplication/Account/Login.aspx.cs
Normal file
@ -0,0 +1,17 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
|
||||
namespace myWebApplication.Account
|
||||
{
|
||||
public partial class Login : System.Web.UI.Page
|
||||
{
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
RegisterHyperLink.NavigateUrl = "Register.aspx?ReturnUrl=" + HttpUtility.UrlEncode(Request.QueryString["ReturnUrl"]);
|
||||
}
|
||||
}
|
||||
}
|
35
lab3/cs_lab3/myWebApplication/Account/Login.aspx.designer.cs
generated
Normal file
35
lab3/cs_lab3/myWebApplication/Account/Login.aspx.designer.cs
generated
Normal file
@ -0,0 +1,35 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace myWebApplication.Account
|
||||
{
|
||||
|
||||
|
||||
public partial class Login
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// RegisterHyperLink control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.HyperLink RegisterHyperLink;
|
||||
|
||||
/// <summary>
|
||||
/// LoginUser control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.Login LoginUser;
|
||||
}
|
||||
}
|
75
lab3/cs_lab3/myWebApplication/Account/Register.aspx
Normal file
75
lab3/cs_lab3/myWebApplication/Account/Register.aspx
Normal file
@ -0,0 +1,75 @@
|
||||
<%@ Page Title="Register" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true"
|
||||
CodeBehind="Register.aspx.cs" Inherits="myWebApplication.Account.Register" %>
|
||||
|
||||
<asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">
|
||||
</asp:Content>
|
||||
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
|
||||
<asp:CreateUserWizard ID="RegisterUser" runat="server" EnableViewState="false" OnCreatedUser="RegisterUser_CreatedUser">
|
||||
<LayoutTemplate>
|
||||
<asp:PlaceHolder ID="wizardStepPlaceholder" runat="server"></asp:PlaceHolder>
|
||||
<asp:PlaceHolder ID="navigationPlaceholder" runat="server"></asp:PlaceHolder>
|
||||
</LayoutTemplate>
|
||||
<WizardSteps>
|
||||
<asp:CreateUserWizardStep ID="RegisterUserWizardStep" runat="server">
|
||||
<ContentTemplate>
|
||||
<h2>
|
||||
Create a New Account
|
||||
</h2>
|
||||
<p>
|
||||
Use the form below to create a new account.
|
||||
</p>
|
||||
<p>
|
||||
Passwords are required to be a minimum of <%= Membership.MinRequiredPasswordLength %> characters in length.
|
||||
</p>
|
||||
<span class="failureNotification">
|
||||
<asp:Literal ID="ErrorMessage" runat="server"></asp:Literal>
|
||||
</span>
|
||||
<asp:ValidationSummary ID="RegisterUserValidationSummary" runat="server" CssClass="failureNotification"
|
||||
ValidationGroup="RegisterUserValidationGroup"/>
|
||||
<div class="accountInfo">
|
||||
<fieldset class="register">
|
||||
<legend>Account Information</legend>
|
||||
<p>
|
||||
<asp:Label ID="UserNameLabel" runat="server" AssociatedControlID="UserName">User Name:</asp:Label>
|
||||
<asp:TextBox ID="UserName" runat="server" CssClass="textEntry"></asp:TextBox>
|
||||
<asp:RequiredFieldValidator ID="UserNameRequired" runat="server" ControlToValidate="UserName"
|
||||
CssClass="failureNotification" ErrorMessage="User Name is required." ToolTip="User Name is required."
|
||||
ValidationGroup="RegisterUserValidationGroup">*</asp:RequiredFieldValidator>
|
||||
</p>
|
||||
<p>
|
||||
<asp:Label ID="EmailLabel" runat="server" AssociatedControlID="Email">E-mail:</asp:Label>
|
||||
<asp:TextBox ID="Email" runat="server" CssClass="textEntry"></asp:TextBox>
|
||||
<asp:RequiredFieldValidator ID="EmailRequired" runat="server" ControlToValidate="Email"
|
||||
CssClass="failureNotification" ErrorMessage="E-mail is required." ToolTip="E-mail is required."
|
||||
ValidationGroup="RegisterUserValidationGroup">*</asp:RequiredFieldValidator>
|
||||
</p>
|
||||
<p>
|
||||
<asp:Label ID="PasswordLabel" runat="server" AssociatedControlID="Password">Password:</asp:Label>
|
||||
<asp:TextBox ID="Password" runat="server" CssClass="passwordEntry" TextMode="Password"></asp:TextBox>
|
||||
<asp:RequiredFieldValidator ID="PasswordRequired" runat="server" ControlToValidate="Password"
|
||||
CssClass="failureNotification" ErrorMessage="Password is required." ToolTip="Password is required."
|
||||
ValidationGroup="RegisterUserValidationGroup">*</asp:RequiredFieldValidator>
|
||||
</p>
|
||||
<p>
|
||||
<asp:Label ID="ConfirmPasswordLabel" runat="server" AssociatedControlID="ConfirmPassword">Confirm Password:</asp:Label>
|
||||
<asp:TextBox ID="ConfirmPassword" runat="server" CssClass="passwordEntry" TextMode="Password"></asp:TextBox>
|
||||
<asp:RequiredFieldValidator ControlToValidate="ConfirmPassword" CssClass="failureNotification" Display="Dynamic"
|
||||
ErrorMessage="Confirm Password is required." ID="ConfirmPasswordRequired" runat="server"
|
||||
ToolTip="Confirm Password is required." ValidationGroup="RegisterUserValidationGroup">*</asp:RequiredFieldValidator>
|
||||
<asp:CompareValidator ID="PasswordCompare" runat="server" ControlToCompare="Password" ControlToValidate="ConfirmPassword"
|
||||
CssClass="failureNotification" Display="Dynamic" ErrorMessage="The Password and Confirmation Password must match."
|
||||
ValidationGroup="RegisterUserValidationGroup">*</asp:CompareValidator>
|
||||
</p>
|
||||
</fieldset>
|
||||
<p class="submitButton">
|
||||
<asp:Button ID="CreateUserButton" runat="server" CommandName="MoveNext" Text="Create User"
|
||||
ValidationGroup="RegisterUserValidationGroup"/>
|
||||
</p>
|
||||
</div>
|
||||
</ContentTemplate>
|
||||
<CustomNavigationTemplate>
|
||||
</CustomNavigationTemplate>
|
||||
</asp:CreateUserWizardStep>
|
||||
</WizardSteps>
|
||||
</asp:CreateUserWizard>
|
||||
</asp:Content>
|
32
lab3/cs_lab3/myWebApplication/Account/Register.aspx.cs
Normal file
32
lab3/cs_lab3/myWebApplication/Account/Register.aspx.cs
Normal file
@ -0,0 +1,32 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.Security;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
|
||||
namespace myWebApplication.Account
|
||||
{
|
||||
public partial class Register : System.Web.UI.Page
|
||||
{
|
||||
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
RegisterUser.ContinueDestinationPageUrl = Request.QueryString["ReturnUrl"];
|
||||
}
|
||||
|
||||
protected void RegisterUser_CreatedUser(object sender, EventArgs e)
|
||||
{
|
||||
FormsAuthentication.SetAuthCookie(RegisterUser.UserName, false /* createPersistentCookie */);
|
||||
|
||||
string continueUrl = RegisterUser.ContinueDestinationPageUrl;
|
||||
if (String.IsNullOrEmpty(continueUrl))
|
||||
{
|
||||
continueUrl = "~/";
|
||||
}
|
||||
Response.Redirect(continueUrl);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
35
lab3/cs_lab3/myWebApplication/Account/Register.aspx.designer.cs
generated
Normal file
35
lab3/cs_lab3/myWebApplication/Account/Register.aspx.designer.cs
generated
Normal file
@ -0,0 +1,35 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace myWebApplication.Account
|
||||
{
|
||||
|
||||
|
||||
public partial class Register
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// RegisterUser control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.CreateUserWizard RegisterUser;
|
||||
|
||||
/// <summary>
|
||||
/// RegisterUserWizardStep control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.CreateUserWizardStep RegisterUserWizardStep;
|
||||
}
|
||||
}
|
18
lab3/cs_lab3/myWebApplication/Account/Web.config
Normal file
18
lab3/cs_lab3/myWebApplication/Account/Web.config
Normal file
@ -0,0 +1,18 @@
|
||||
<?xml version="1.0"?>
|
||||
<configuration>
|
||||
|
||||
<location path="Register.aspx">
|
||||
<system.web>
|
||||
<authorization>
|
||||
<allow users="*"/>
|
||||
</authorization>
|
||||
</system.web>
|
||||
</location>
|
||||
|
||||
<system.web>
|
||||
<authorization>
|
||||
<deny users="?"/>
|
||||
</authorization>
|
||||
</system.web>
|
||||
|
||||
</configuration>
|
Reference in New Issue
Block a user