Revision: 52
Author: tmyroadctfig
Date: 2006-06-28 04:16:34 -0700 (Wed, 28 Jun 2006)
ViewCVS: http://svn.sourceforge.net/nmailserver/?rev=52&view=rev
Log Message:
-----------
Added task list and password setting via the admin webpage.
Modified Paths:
--------------
NMail/branches/luke-dev/NMail/Authentication/IAuthenticationProvider.cs
NMail/branches/luke-dev/NMail/Authentication/NullAuthentication.cs
NMail/branches/luke-dev/NMail.Administration.Web/Login.aspx.cs
NMail/branches/luke-dev/NMail.Administration.Web/MailDomainDetails.aspx
NMail/branches/luke-dev/NMail.Administration.Web/MasterPage.master
NMail/branches/luke-dev/NMail.Administration.Web/StyleSheet.css
NMail/branches/luke-dev/NMail.Administration.Web/UserDetails.aspx
NMail/branches/luke-dev/NMail.Administration.Web/UserDetails.aspx.cs
NMail/branches/luke-dev/NMail.Administration.Web/ViewFolders.aspx
NMail/branches/luke-dev/NMail.Administration.Web/ViewFolders.aspx.cs
NMail/branches/luke-dev/NMail.Administration.Web/ViewMailDomains.aspx
NMail/branches/luke-dev/NMail.Administration.Web/ViewMailDomains.aspx.cs
NMail/branches/luke-dev/NMail.Administration.Web/ViewUsers.aspx
NMail/branches/luke-dev/NMail.LocalStoreData.MySql/MySqlLocalStoreData.cs
NMail/branches/luke-dev/NMail.Server/RemoteAdministration.cs
Added Paths:
-----------
NMail/branches/luke-dev/NMail.Administration.Web/SetPasswordPanel.ascx
NMail/branches/luke-dev/NMail.Administration.Web/SetPasswordPanel.ascx.cs
NMail/branches/luke-dev/NMail.Administration.Web/TaskList.ascx
NMail/branches/luke-dev/NMail.Administration.Web/TaskList.ascx.cs
Modified: NMail/branches/luke-dev/NMail/Authentication/IAuthenticationProvider.cs
===================================================================
--- NMail/branches/luke-dev/NMail/Authentication/IAuthenticationProvider.cs 2006-06-24 11:21:25 UTC (rev 51)
+++ NMail/branches/luke-dev/NMail/Authentication/IAuthenticationProvider.cs 2006-06-28 11:16:34 UTC (rev 52)
@@ -73,6 +73,14 @@
/// <returns>True if their account is locked out.</returns>
bool IsLockedOut(IAuthenticationToken user);
+ /// <summary>
+ /// Changes the user's password.
+ /// </summary>
+ /// <param name="user">The user to change the password for.</param>
+ /// <param name="newPassword">The new password.</param>
+ /// <returns>True on success, false otherwise.</returns>
+ bool ChangePassword(IAuthenticationToken user, string newPassword);
+
// TODO: reset password & others
}
}
Modified: NMail/branches/luke-dev/NMail/Authentication/NullAuthentication.cs
===================================================================
--- NMail/branches/luke-dev/NMail/Authentication/NullAuthentication.cs 2006-06-24 11:21:25 UTC (rev 51)
+++ NMail/branches/luke-dev/NMail/Authentication/NullAuthentication.cs 2006-06-28 11:16:34 UTC (rev 52)
@@ -50,6 +50,10 @@
public bool IsLockedOut(IAuthenticationToken user) {
return false;
}
+
+ public bool ChangePassword(IAuthenticationToken user, string newPassword) {
+ return true;
+ }
#endregion
}
}
Modified: NMail/branches/luke-dev/NMail.Administration.Web/Login.aspx.cs
===================================================================
--- NMail/branches/luke-dev/NMail.Administration.Web/Login.aspx.cs 2006-06-24 11:21:25 UTC (rev 51)
+++ NMail/branches/luke-dev/NMail.Administration.Web/Login.aspx.cs 2006-06-28 11:16:34 UTC (rev 52)
@@ -33,6 +33,7 @@
{
e.Authenticated = true;
Session["AuthToken"] = authToken;
+ Session["RemoteAdministration"] = ra;
Session["LocalStore"] = ra.NMailServer.LocalStore;
}
}
Modified: NMail/branches/luke-dev/NMail.Administration.Web/MailDomainDetails.aspx
===================================================================
--- NMail/branches/luke-dev/NMail.Administration.Web/MailDomainDetails.aspx 2006-06-24 11:21:25 UTC (rev 51)
+++ NMail/branches/luke-dev/NMail.Administration.Web/MailDomainDetails.aspx 2006-06-28 11:16:34 UTC (rev 52)
@@ -1,4 +1,4 @@
-<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="MailDomainDetails.aspx.cs" Inherits="MailDomainDetails" Title="Untitled Page" %>
+<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="MailDomainDetails.aspx.cs" Inherits="MailDomainDetails" Title="Mail Domain Details" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder" Runat="Server">
<asp:Image ID="StatusImage" runat="server" Visible="false" />
<asp:Label ID="StatusMessage" runat="server"></asp:Label>
Modified: NMail/branches/luke-dev/NMail.Administration.Web/MasterPage.master
===================================================================
--- NMail/branches/luke-dev/NMail.Administration.Web/MasterPage.master 2006-06-24 11:21:25 UTC (rev 51)
+++ NMail/branches/luke-dev/NMail.Administration.Web/MasterPage.master 2006-06-28 11:16:34 UTC (rev 52)
@@ -1,4 +1,5 @@
<%@ Master Language="C#" %>
+<%@ Register Src="TaskList.ascx" TagName="TaskList" TagPrefix="uc1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
@@ -62,6 +63,10 @@
</asp:TreeView>
<asp:SiteMapDataSource ID="SiteMapDataSource" runat="server" />
</div>
+
+ <uc1:TaskList ID="TaskList" runat="server" />
+ <asp:ContentPlaceHolder ID="SiteContentPlaceHolder" runat="server">
+ </asp:ContentPlaceHolder>
</td>
<td style="width: 100%; vertical-align: top;">
<div style="padding: 0.5em">
Added: NMail/branches/luke-dev/NMail.Administration.Web/SetPasswordPanel.ascx
===================================================================
--- NMail/branches/luke-dev/NMail.Administration.Web/SetPasswordPanel.ascx (rev 0)
+++ NMail/branches/luke-dev/NMail.Administration.Web/SetPasswordPanel.ascx 2006-06-28 11:16:34 UTC (rev 52)
@@ -0,0 +1,12 @@
+<%@ Control Language="C#" AutoEventWireup="true" CodeFile="SetPasswordPanel.ascx.cs" Inherits="SetPasswordPanel" %>
+<div class="box">
+ <h3>Set a new password</h3>
+ <asp:Image ID="StatusImg" runat="server" />
+ <asp:Label ID="StatusMessageLbl" runat="server" />
+
+ New Password:
+ <input id="PasswordBox" type="password" runat="server" />
+ <br />
+ <asp:Button ID="OkBtn" runat="Server" Text="Set" OnClick="OkBtn_Click" />
+ <asp:Button ID="CancelBtn" runat="Server" Text="Cancel" OnClick="CancelBtn_Click" />
+</div>
\ No newline at end of file
Added: NMail/branches/luke-dev/NMail.Administration.Web/SetPasswordPanel.ascx.cs
===================================================================
--- NMail/branches/luke-dev/NMail.Administration.Web/SetPasswordPanel.ascx.cs (rev 0)
+++ NMail/branches/luke-dev/NMail.Administration.Web/SetPasswordPanel.ascx.cs 2006-06-28 11:16:34 UTC (rev 52)
@@ -0,0 +1,97 @@
+using System;
+using System.Data;
+using System.Configuration;
+using System.Collections;
+using System.Web;
+using System.Web.Security;
+using System.Web.UI;
+using System.Web.UI.WebControls;
+using System.Web.UI.WebControls.WebParts;
+using System.Web.UI.HtmlControls;
+
+public partial class SetPasswordPanel : System.Web.UI.UserControl
+{
+ protected override void OnInit(EventArgs e)
+ {
+ base.OnInit(e);
+
+ this.OkBtn.Click += new EventHandler(OkBtn_Click);
+ this.CancelBtn.Click += new EventHandler(CancelBtn_Click);
+ }
+
+ protected void OkBtn_Click(object sender, EventArgs e)
+ {
+ if (this.setClicked != null)
+ {
+ this.setClicked(this, e);
+ }
+ }
+
+ protected void CancelBtn_Click(object sender, EventArgs e)
+ {
+ if (this.cancelClicked != null)
+ {
+ this.cancelClicked(this, e);
+ }
+ }
+
+ private event EventHandler setClicked;
+
+ public event EventHandler SetClicked
+ {
+ add
+ {
+ this.setClicked += value;
+ }
+ remove
+ {
+ this.setClicked -= value;
+ }
+ }
+
+ private event EventHandler cancelClicked;
+
+ public event EventHandler CancelClicked
+ {
+ add
+ {
+ this.cancelClicked += value;
+ }
+ remove
+ {
+ this.cancelClicked -= value;
+ }
+ }
+
+ public string Password
+ {
+ get
+ {
+ return this.PasswordBox.Value;
+ }
+ }
+
+ public string StatusMessage
+ {
+ get
+ {
+ return this.StatusMessageLbl.Text;
+ }
+ set
+ {
+ this.StatusMessageLbl.Text = value;
+ }
+ }
+
+ public string StatusImageUrl
+ {
+ get
+ {
+ return this.StatusImg.ImageUrl;
+ }
+ set
+ {
+ this.StatusImg.ImageUrl = value;
+ }
+ }
+}
Modified: NMail/branches/luke-dev/NMail.Administration.Web/StyleSheet.css
===================================================================
--- NMail/branches/luke-dev/NMail.Administration.Web/StyleSheet.css 2006-06-24 11:21:25 UTC (rev 51)
+++ NMail/branches/luke-dev/NMail.Administration.Web/StyleSheet.css 2006-06-28 11:16:34 UTC (rev 52)
@@ -5,7 +5,7 @@
h1
{
- font-size: larger;
+ font-size: large;
}
h2
@@ -15,6 +15,14 @@
margin-top: 1em;
}
+h3
+{
+ font-style: italic;
+ font-size: medium;
+ margin-bottom: 0.25em;
+ margin-top: 0.5em;
+}
+
.box
{
background-color: #eff3fb;
Added: NMail/branches/luke-dev/NMail.Administration.Web/TaskList.ascx
===================================================================
--- NMail/branches/luke-dev/NMail.Administration.Web/TaskList.ascx (rev 0)
+++ NMail/branches/luke-dev/NMail.Administration.Web/TaskList.ascx 2006-06-28 11:16:34 UTC (rev 52)
@@ -0,0 +1,15 @@
+<%@ Control Language="C#" AutoEventWireup="true" CodeFile="TaskList.ascx.cs" Inherits="TaskList" %>
+<div class="box">
+ <asp:Repeater ID="TaskRepeater" runat="server">
+ <HeaderTemplate><ul></HeaderTemplate>
+
+ <ItemTemplate>
+ <li>
+ <asp:Image runat="server" ID="Image" ImageUrl='<%# Eval("ImageUrl") %>' />
+ <asp:LinkButton runat="server" ID="LinkButton" Text='<%# Eval("Text") %>' />
+ </li>
+ </ItemTemplate>
+
+ <FooterTemplate></ul></FooterTemplate>
+ </asp:Repeater>
+</div>
\ No newline at end of file
Added: NMail/branches/luke-dev/NMail.Administration.Web/TaskList.ascx.cs
===================================================================
--- NMail/branches/luke-dev/NMail.Administration.Web/TaskList.ascx.cs (rev 0)
+++ NMail/branches/luke-dev/NMail.Administration.Web/TaskList.ascx.cs 2006-06-28 11:16:34 UTC (rev 52)
@@ -0,0 +1,79 @@
+using System;
+using System.Data;
+using System.Configuration;
+using System.Collections;
+using System.Web;
+using System.Web.Security;
+using System.Web.UI;
+using System.Web.UI.WebControls;
+using System.Web.UI.WebControls.WebParts;
+using System.Web.UI.HtmlControls;
+
+public partial class TaskList : System.Web.UI.UserControl
+{
+ protected override void OnInit(EventArgs e)
+ {
+ base.OnLoad(e);
+ this.TaskRepeater.ItemDataBound += new RepeaterItemEventHandler(TaskRepeater_ItemDataBound);
+ }
+
+ void TaskRepeater_ItemDataBound(object sender, RepeaterItemEventArgs e)
+ {
+ Control control = e.Item.FindControl("LinkButton");
+ Task task = (Task)e.Item.DataItem;
+
+ if (control != null && task != null && task.ClickHandler != null)
+ {
+ // Link this task's button with its click handler
+ LinkButton button = (LinkButton)control;
+ button.Click += task.ClickHandler;
+ }
+ }
+
+ public void SetTaskList(ArrayList taskList)
+ {
+ RepeaterItemCollection dataSource = new RepeaterItemCollection(taskList);
+ this.TaskRepeater.DataSource = dataSource;
+ this.TaskRepeater.DataBind();
+ }
+}
+
+public class Task
+{
+ public Task(string text, string imageUrl, EventHandler clickHandler)
+ {
+ this.text = text;
+ this.imageUrl = imageUrl;
+ this.clickHandler = clickHandler;
+ }
+
+ private string text;
+
+ public string Text
+ {
+ get
+ {
+ return this.text;
+ }
+ }
+
+ private string imageUrl;
+
+ public string ImageUrl
+ {
+ get
+ {
+ return this.imageUrl;
+ }
+ }
+
+ private EventHandler clickHandler;
+
+ public EventHandler ClickHandler
+ {
+ get
+ {
+ return this.clickHandler;
+ }
+ }
+}
\ No newline at end of file
Modified: NMail/branches/luke-dev/NMail.Administration.Web/UserDetails.aspx
===================================================================
--- NMail/branches/luke-dev/NMail.Administration.Web/UserDetails.aspx 2006-06-24 11:21:25 UTC (rev 51)
+++ NMail/branches/luke-dev/NMail.Administration.Web/UserDetails.aspx 2006-06-28 11:16:34 UTC (rev 52)
@@ -1,5 +1,9 @@
<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="UserDetails.aspx.cs" Inherits="UserDetails" Title="Untitled Page" %>
-<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder" Runat="Server">
+
+<%@ Register Src="SetPasswordPanel.ascx" TagName="SetPasswordPanel" TagPrefix="uc1" %>
+<%@ Reference Control="~/TaskList.ascx" %>
+
+<asp:Content ID="Content" ContentPlaceHolderID="ContentPlaceHolder" Runat="Server">
<asp:Image ID="StatusImage" runat="server" Visible="false" />
<asp:Label ID="StatusMessage" runat="server"></asp:Label>
@@ -15,7 +19,7 @@
<asp:Panel ID="MainPanel" runat="server">
<h2>User Details</h2>
<asp:DetailsView ID="UserDetailsView" runat="server" AutoGenerateRows="False" CellPadding="4"
- DataSourceID="UserDataSource" ForeColor="#333333" GridLines="None" OnItemDeleting="UserDetailsView_ItemDeleting">
+ DataSourceID="UserDataSource" ForeColor="#333333" GridLines="None">
<FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
<CommandRowStyle BackColor="#D1DDF1" Font-Bold="True" />
<EditRowStyle BackColor="#2461BF" />
@@ -27,7 +31,6 @@
<asp:BoundField DataField="UserFolderId" HeaderText="User Initial Folder Id" SortExpression="UserFolderId" />
<asp:BoundField DataField="QuotaWarnLimit" HeaderText="Quota Warn Limit" SortExpression="QuotaWarnLimit" />
<asp:BoundField DataField="QuotaHardLimit" HeaderText="Quota Hard Limit" SortExpression="QuotaHardLimit" />
- <asp:CommandField ShowDeleteButton="True" />
</Fields>
<FieldHeaderStyle BackColor="#DEE8F5" Font-Bold="True" />
<HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
@@ -42,7 +45,7 @@
<asp:Parameter Name="userId" Type="Int32" />
</DeleteParameters>
</asp:ObjectDataSource>
-
+
<h2>User's Folders</h2>
<asp:GridView ID="UserFoldersGridView" runat="server" AutoGenerateColumns="False" CellPadding="4"
DataSourceID="UserFolderDataSource" ForeColor="#333333" GridLines="None">
@@ -73,4 +76,7 @@
</asp:ObjectDataSource>
</asp:Panel>
</asp:Content>
+<asp:Content ID="SiteContent" runat="server" ContentPlaceHolderID="SiteContentPlaceHolder">
+ <uc1:SetPasswordPanel ID="SetPasswordPanel" runat="server" Visible="false" />
+</asp:Content>
Modified: NMail/branches/luke-dev/NMail.Administration.Web/UserDetails.aspx.cs
===================================================================
--- NMail/branches/luke-dev/NMail.Administration.Web/UserDetails.aspx.cs 2006-06-24 11:21:25 UTC (rev 51)
+++ NMail/branches/luke-dev/NMail.Administration.Web/UserDetails.aspx.cs 2006-06-28 11:16:34 UTC (rev 52)
@@ -10,9 +10,30 @@
using System.Web.UI.HtmlControls;
using NMail;
+using NMail.Authentication;
+using NMail.Server;
public partial class UserDetails : System.Web.UI.Page
{
+ protected override void OnLoad(EventArgs e)
+ {
+ base.OnLoad(e);
+
+ // Setup the task list
+ ArrayList tasks = new ArrayList();
+ tasks.Add(new Task("Delete User", Request.ApplicationPath + @"/Images/Tango/Delete.png", new EventHandler(DeleteUser_Click)));
+ tasks.Add(new Task("Set Password", string.Empty, new EventHandler(ShowPasswordChanger_Click)));
+
+ TaskList taskList = (TaskList) this.Master.FindControl("TaskList");
+ taskList.SetTaskList(tasks);
+
+ // Setup the password changer
+ this.SetPasswordPanel.CancelClicked += new EventHandler(SetPasswordPanel_CancelClicked);
+ this.SetPasswordPanel.SetClicked += new EventHandler(SetPasswordPanel_SetClicked);
+ }
+
+ #region User Deletion
+
protected void UserDataSource_Deleting(object sender, ObjectDataSourceMethodEventArgs e)
{
e.InputParameters["userId"] = Request.QueryString["UserId"];
@@ -46,6 +67,12 @@
this.StatusImage.Visible = true;
}
+
+ protected void DeleteUser_Click(object sender, EventArgs e)
+ {
+ // Display the confirmation panel and canel the event
+ this.ConfirmPanel.Visible = true;
+ }
protected void noBtn_Click(object sender, EventArgs e)
{
@@ -59,11 +86,41 @@
this.UserDataSource.Delete();
this.ConfirmPanel.Visible = false;
}
+ #endregion
- protected void UserDetailsView_ItemDeleting(object sender, DetailsViewDeleteEventArgs e)
+ #region Password Related Events
+
+ protected void ShowPasswordChanger_Click(object sender, EventArgs e)
{
- // Display the confirmation panel and canel the event
- this.ConfirmPanel.Visible = true;
- e.Cancel = true;
+ this.SetPasswordPanel.Visible = true;
}
+
+ void SetPasswordPanel_CancelClicked(object sender, EventArgs e)
+ {
+ this.SetPasswordPanel.Visible = false;
+ }
+
+ void SetPasswordPanel_SetClicked(object sender, EventArgs e)
+ {
+ RemoteAdministration ra = (RemoteAdministration)Session["RemoteAdministration"];
+ IAuthenticationToken authToken = (IAuthenticationToken)Session["AuthToken"];
+ IAuthenticationProvider authProvider = ra.NMailServer.AuthenticationProvider;
+ string password = this.SetPasswordPanel.Password;
+
+ // Attempt to set the password
+ bool result = authProvider.ChangePassword(authToken, password);
+
+ // Display the result
+ if (result)
+ {
+ this.SetPasswordPanel.StatusMessage = "Password changed successfully.<br /><br />";
+ this.SetPasswordPanel.StatusImageUrl = Request.ApplicationPath + @"/Images/GreenLight.png";
+ }
+ else
+ {
+ this.SetPasswordPanel.StatusMessage = "Failed to set password for the user.<br /><br />";
+ this.SetPasswordPanel.StatusImageUrl = Request.ApplicationPath + @"/Images/Tango/Error.png";
+ }
+ }
+ #endregion
}
Modified: NMail/branches/luke-dev/NMail.Administration.Web/ViewFolders.aspx
===================================================================
--- NMail/branches/luke-dev/NMail.Administration.Web/ViewFolders.aspx 2006-06-24 11:21:25 UTC (rev 51)
+++ NMail/branches/luke-dev/NMail.Administration.Web/ViewFolders.aspx 2006-06-28 11:16:34 UTC (rev 52)
@@ -1,4 +1,4 @@
-<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="ViewFolders.aspx.cs" Inherits="ViewFolders" Title="Untitled Page" %>
+<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="ViewFolders.aspx.cs" Inherits="ViewFolders" Title="Folders" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder" Runat="Server">
<h2>Folders</h2>
<asp:GridView ID="FoldersGridView" runat="server" AutoGenerateColumns="False" CellPadding="4"
@@ -25,7 +25,5 @@
</asp:GridView>
<asp:ObjectDataSource ID="FoldersDataSource" runat="server" SelectMethod="GetFolders"
TypeName="NMail.Administration.Web.FolderDataSource"></asp:ObjectDataSource>
- <br />
- <a href="CreateFolder.aspx">Create new folder</a>
</asp:Content>
Modified: NMail/branches/luke-dev/NMail.Administration.Web/ViewFolders.aspx.cs
===================================================================
--- NMail/branches/luke-dev/NMail.Administration.Web/ViewFolders.aspx.cs 2006-06-24 11:21:25 UTC (rev 51)
+++ NMail/branches/luke-dev/NMail.Administration.Web/ViewFolders.aspx.cs 2006-06-28 11:16:34 UTC (rev 52)
@@ -10,5 +10,21 @@
using System.Web.UI.HtmlControls;
public partial class ViewFolders : System.Web.UI.Page
-{
+{
+ protected override void OnLoad(EventArgs e)
+ {
+ base.OnLoad(e);
+
+ // Setup the task list
+ ArrayList tasks = new ArrayList();
+ tasks.Add(new Task("Create Folder", string.Empty, new EventHandler(CreateFolder_Click)));
+
+ TaskList taskList = (TaskList)this.Master.FindControl("TaskList");
+ taskList.SetTaskList(tasks);
+ }
+
+ protected void CreateFolder_Click(object sender, EventArgs e)
+ {
+ Response.Redirect("CreateFolder.aspx");
+ }
}
Modified: NMail/branches/luke-dev/NMail.Administration.Web/ViewMailDomains.aspx
===================================================================
--- NMail/branches/luke-dev/NMail.Administration.Web/ViewMailDomains.aspx 2006-06-24 11:21:25 UTC (rev 51)
+++ NMail/branches/luke-dev/NMail.Administration.Web/ViewMailDomains.aspx 2006-06-28 11:16:34 UTC (rev 52)
@@ -1,4 +1,4 @@
-<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="ViewMailDomains.aspx.cs" Inherits="ViewMailDomains" Title="Untitled Page" %>
+<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="ViewMailDomains.aspx.cs" Inherits="ViewMailDomains" Title="Mail Domains" %>
<asp:Content ID="Content" ContentPlaceHolderID="ContentPlaceHolder" Runat="Server">
<h2>Mail Domains</h2>
<asp:ObjectDataSource ID="MailDomainDataSource" runat="server" SelectMethod="GetMailDomains" TypeName="NMail.Administration.Web.MailDomainDataSource">
@@ -22,7 +22,5 @@
There are no mail domains currently defined in the system.
</EmptyDataTemplate>
</asp:GridView>
- <br />
- <a href="CreateMailDomain.aspx">Create new mail domain</a>
</asp:Content>
Modified: NMail/branches/luke-dev/NMail.Administration.Web/ViewMailDomains.aspx.cs
===================================================================
--- NMail/branches/luke-dev/NMail.Administration.Web/ViewMailDomains.aspx.cs 2006-06-24 11:21:25 UTC (rev 51)
+++ NMail/branches/luke-dev/NMail.Administration.Web/ViewMailDomains.aspx.cs 2006-06-28 11:16:34 UTC (rev 52)
@@ -16,4 +16,20 @@
public partial class ViewMailDomains : System.Web.UI.Page
{
+ protected override void OnLoad(EventArgs e)
+ {
+ base.OnLoad(e);
+
+ // Setup the task list
+ ArrayList tasks = new ArrayList();
+ tasks.Add(new Task("Create Mail Domain", string.Empty, new EventHandler(CreateMailDomain_Click)));
+
+ TaskList taskList = (TaskList)this.Master.FindControl("TaskList");
+ taskList.SetTaskList(tasks);
+ }
+
+ protected void CreateMailDomain_Click(object sender, EventArgs e)
+ {
+ Response.Redirect("CreateMailDomain.aspx");
+ }
}
Modified: NMail/branches/luke-dev/NMail.Administration.Web/ViewUsers.aspx
===================================================================
--- NMail/branches/luke-dev/NMail.Administration.Web/ViewUsers.aspx 2006-06-24 11:21:25 UTC (rev 51)
+++ NMail/branches/luke-dev/NMail.Administration.Web/ViewUsers.aspx 2006-06-28 11:16:34 UTC (rev 52)
@@ -1,5 +1,24 @@
-<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" Title="Untitled Page" %>
+<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" Title="Users" %>
+<script runat="server">
+ protected override void OnLoad(EventArgs e)
+ {
+ base.OnLoad(e);
+
+ // Setup the task list
+ ArrayList tasks = new ArrayList();
+ tasks.Add(new Task("Create New User", string.Empty, new EventHandler(CreateUser_Click)));
+
+ TaskList taskList = (TaskList)this.Master.FindControl("TaskList");
+ taskList.SetTaskList(tasks);
+ }
+
+ protected void CreateUser_Click(object sender, EventArgs e)
+ {
+ Response.Redirect("CreateUser.aspx");
+ }
+</script>
+
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder" Runat="Server">
<h2>Users</h2>
<asp:GridView ID="GridView1" runat="server" DataSourceID="UserDataSource" AllowPaging="True" AllowSorting="True" AutoGenerateColumns="False" CellPadding="4" ForeColor="#333333" GridLines="None">
@@ -24,7 +43,5 @@
</asp:GridView>
<asp:ObjectDataSource ID="UserDataSource" runat="server" SelectMethod="GetUsers"
TypeName="NMail.Administration.Web.UserDataSource"></asp:ObjectDataSource>
- <br />
- <a href="CreateUser.aspx">Create new user</a>
</asp:Content>
Modified: NMail/branches/luke-dev/NMail.LocalStoreData.MySql/MySqlLocalStoreData.cs
===================================================================
--- NMail/branches/luke-dev/NMail.LocalStoreData.MySql/MySqlLocalStoreData.cs 2006-06-24 11:21:25 UTC (rev 51)
+++ NMail/branches/luke-dev/NMail.LocalStoreData.MySql/MySqlLocalStoreData.cs 2006-06-28 11:16:34 UTC (rev 52)
@@ -1874,6 +1874,19 @@
// TODO: fix this!
return false;
}
+
+ public bool ChangePassword(IAuthenticationToken user, string newPassword) {
+ using (MySqlConnection cnn = GetConnection()) {
+ using (MySqlCommand cmd = cnn.CreateCommand()) {
+ cmd.CommandText = "UPDATE `User` SET Password = ?Password WHERE Username = ?Username";
+ cmd.Parameters.Add("Username", user.Username);
+ cmd.Parameters.Add("Password", newPassword);
+ int count = cmd.ExecuteNonQuery();
+
+ return (count == 1);
+ }
+ }
+ }
#endregion
#region IHashAuthProvider Members
Modified: NMail/branches/luke-dev/NMail.Server/RemoteAdministration.cs
===================================================================
--- NMail/branches/luke-dev/NMail.Server/RemoteAdministration.cs 2006-06-24 11:21:25 UTC (rev 51)
+++ NMail/branches/luke-dev/NMail.Server/RemoteAdministration.cs 2006-06-28 11:16:34 UTC (rev 52)
@@ -21,6 +21,7 @@
using System.Runtime.Remoting;
using System.Runtime.Remoting.Channels;
using System.Runtime.Remoting.Channels.Tcp;
+using System.Runtime.Remoting.Lifetime;
using System.Runtime.Serialization.Formatters;
using System.Security.Cryptography.X509Certificates;
@@ -69,21 +70,37 @@
// Setup the remoting channel
IDictionary props = new Hashtable();
props["port"] = "7877";
-// props["isServer"] = "yes";
-// props["certificate"] = new X509Certificate2("NMail.pfx", "");
-// props["authProvider"] = NMailConfiguration.Current.AuthenticationProvider;
-//#if DEBUG
-// props["useTls"] = false;
-//#endif
channel = new TcpChannel(props, null, provider);
ChannelServices.RegisterChannel(channel, false);
// Register our remote administration interface
RemoteAdministration ra = new RemoteAdministration();
ra.NMailServer = server;
- RemotingServices.Marshal(ra, "RemoteAdministration.rem", typeof(RemoteAdministration));
+ ObjRef obj = RemotingServices.Marshal(ra, "RemoteAdministration.rem", typeof(RemoteAdministration));
+ // Register a sponsor for this remote admin interface to keep it alive
+ ILease lease = (ILease) RemotingServices.GetLifetimeService(ra);
+ remoteAdminSponsor = new RemoteAdminSponsor();
+ lease.Register(remoteAdminSponsor);
+
return ra;
}
+
+ /// <summary>
+ /// A helper object used to keep the remote admin interface alive.
+ /// </summary>
+ private static RemoteAdminSponsor remoteAdminSponsor;
}
+
+ /// <summary>
+ /// A simple helper class used to keep the remote admin interface alive.
+ /// </summary>
+ internal class RemoteAdminSponsor : ISponsor {
+ #region ISponsor Members
+
+ public TimeSpan Renewal(ILease lease) {
+ return TimeSpan.FromHours(24);
+ }
+ #endregion
+ }
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|