Exemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            hMailServerNetRemote.IApplication app = RemoteActivation.GetAuthenticatedRemotehMailServerApplication();
            if (app == null)
            {
                Response.End();
            }

            hMailServerNetRemote.IDomain dom = app.Domains.ItemByDBID(Convert.ToInt32(Request.QueryString["ID"]));

            if (!IsPostBack)
            {
                DomainName.Text               = dom.Name;
                Enabled.Checked               = dom.Active;
                AccountLink.NavigateUrl       = "~/Admin/Accounts.aspx?ID=" + Request.QueryString["ID"];
                Aliases.NavigateUrl           = "~/Admin/DomainAliases.aspx?ID=" + Request.QueryString["ID"];
                DistributionLists.NavigateUrl = "~/Admin/DistributionLists.aspx?ID=" + Request.QueryString["ID"];
            }
            else
            {
                dom.Name   = DomainName.Text;
                dom.Active = Enabled.Checked;
                dom.Save();
            }
        }
Exemplo n.º 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                hMailServerNetRemote.IApplication app = RemoteActivation.GetAuthenticatedRemotehMailServerApplication();
                if (app == null)
                {
                    Response.End();
                }

                hMailServerNetRemote.IDomain dom = app.Domains.ItemByDBID(Convert.ToInt32(Request.QueryString["ID"]));

                DomainName.Text = dom.Name;

                List <hMailServerNetRemote.IDistributionList> dls = new List <hMailServerNetRemote.IDistributionList>();
                hMailServerNetRemote.IDistributionLists       d   = dom.DistributionLists;
                int c = d.Count;

                for (int i = 0; i < c; i++)
                {
                    dls.Add(d[i]);
                }

                DistributionList.DataSource = dls;
                DistributionList.DataBind();
            }
        }
Exemplo n.º 3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            hMailServerNetRemote.IApplication app = RemoteActivation.GetAuthenticatedRemotehMailServerApplication();
            if (app == null)
            {
                Response.End();
            }

            Version.Text = app.Version;
        }
Exemplo n.º 4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            hMailServerNetRemote.IApplication app = RemoteActivation.GetAuthenticatedRemotehMailServerApplication();
            if (app == null)
            {
                Response.End();
            }

            string[] sp = Request.QueryString["Address"].Split(new Char[] { '@' });
            if (sp.Length != 2)
            {
                Response.StatusCode = 404;
                Response.End();
            }

            hMailServerNetRemote.IDomain domain = app.Domains.ItemByName(sp[1]);
            if (domain == null)
            {
                Response.StatusCode = 404;
                Response.End();
            }

            hMailServerNetRemote.IDistributionList ds = domain.DistributionLists.ItemByAddress(Request.QueryString["Address"]);
            if (ds == null)
            {
                Response.StatusCode = 404;
                Response.End();
            }

            hMailServerNetRemote.IDistributionListRecipients re = ds.Recipients;

            if (!IsPostBack)
            {
                DistributionListName.Text = ds.Address;

                List <hMailServerNetRemote.IDistributionListRecipient> addys = new List <hMailServerNetRemote.IDistributionListRecipient>();
                int c = re.Count;
                for (int i = 0; i < c; i++)
                {
                    addys.Add(re[i]);
                }

                AddressList.DataSource = addys;
                AddressList.DataBind();
            }
        }
        //
        // MembershipProvider.ValidateUser
        //

        public override bool ValidateUser(string username, string password)
        {
            bool isValid = false;


            hMailServerNetRemote.IApplication app     = RemoteActivation.GetRemotehMailServerApplication();
            hMailServerNetRemote.IAccount     account = app.Authenticate(username, password);

            if (account != null)
            {
                isValid = true;
            }
            else
            {
                UpdateFailureCount(username, "password");
            }

            return(isValid);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                hMailServerNetRemote.IApplication app = RemoteActivation.GetAuthenticatedRemotehMailServerApplication();
                if (app == null)
                {
                    Response.End();
                }
                List <hMailServerNetRemote.IDomain> domains = new List <hMailServerNetRemote.IDomain>();
                int c = app.Domains.Count;
                hMailServerNetRemote.IDomains ds = app.Domains;

                for (int i = 0; i < c; i++)
                {
                    domains.Add(ds[i]);
                }

                DomainList.DataSource = domains;
                DomainList.DataBind();
            }
        }
        //
        // System.Web.Security.MembershipProvider methods.
        //

        //
        // MembershipProvider.ChangePassword
        //

        public override bool ChangePassword(string username, string oldPwd, string newPwd)
        {
            if (!ValidateUser(username, oldPwd))
            {
                return(false);
            }

            ValidatePasswordEventArgs args =
                new ValidatePasswordEventArgs(username, newPwd, true);

            OnValidatingPassword(args);

            if (args.Cancel)
            {
                if (args.FailureInformation != null)
                {
                    throw args.FailureInformation;
                }
                else
                {
                    throw new MembershipPasswordException("Change password canceled due to new password validation failure.");
                }
            }

            string[] sp = username.Split(new Char[] { '@' });

            if (sp.Length != 2)
            {
                return(false);
            }

            hMailServerNetRemote.IApplication app     = RemoteActivation.GetRemotehMailServerApplication();
            hMailServerNetRemote.IDomain      domain  = app.Domains.ItemByName(sp[1]);
            hMailServerNetRemote.IAccount     account = domain.Accounts[username];
            account.Password = newPwd;
            account.Save();

            return(true);
        }
        //
        // GetUserFromReader
        //    A helper function that takes the current row from the MySqlDataReader
        // and hydrates a MembershiUser from the values. Called by the
        // MembershipUser.GetUser implementation.
        //

        private hMailServerNetRemote.IAccount GetAccount(string email)
        {
            hMailServerNetRemote.IApplication app = RemoteActivation.GetRemotehMailServerApplication();
            string[] sp = email.Split(new Char[] { '@' });

            if (sp.Length != 2)
            {
                return(null);
            }

            hMailServerNetRemote.IDomain domain = app.Domains.ItemByName(sp[1]);
            if (domain == null)
            {
                return(null);
            }

            hMailServerNetRemote.IAccount account = domain.Accounts.ItemByAddress(email);
            if (account == null)
            {
                return(null);
            }

            return(account);
        }