PageRenderTime 69ms CodeModel.GetById 64ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 0ms

/BaliEnterpriseSystems/BaliEnterpriseSystems/UserPreferences.aspx.cs

https://github.com/sirivedula/BEST
C# | 46 lines | 41 code | 5 blank | 0 comment | 4 complexity | 563fecc3749ee2f3a73a99e1a29f00f4 MD5 | raw file
 1using System;
 2using System.Collections;
 3using System.Configuration;
 4using System.Data;
 5using System.Linq;
 6using System.Web;
 7using System.Web.Security;
 8using System.Web.UI;
 9using System.Web.UI.WebControls;
10using System.Web.UI.WebControls.WebParts;
11using System.Web.UI.HtmlControls;
12using System.Xml.Linq;
13
14namespace BaliEnterpriseSystems
15{
16    public partial class UserPreferences : System.Web.UI.Page
17    {
18        protected void Page_LoadComplete(object sender, EventArgs e)
19        {
20            if (HttpContext.Current.Session["CurrentUser"] == null)
21            {
22                Response.Redirect("Logout.aspx");
23            }
24
25            if (Request.Form.Count > 0)
26            {
27                string newPassword = Request.Form["newpassword"];
28                var cUser = Utils.User;
29
30                cUser.BestUser.password = Utils.GetMD5Hash(newPassword);
31                cUser.BestUser.initialPassword = false;
32                cUser.BestUser.passwordExpiration = DateTime.Today.AddDays(365);
33
34                if (!cUser.BestUser.CurrentRow.Save())
35                {
36                    this.ChangePasswordMessage.Text = "<div class=\"err\">There was a problem changing your password.  Please try again.</div>";
37                }
38                else
39                {
40                    Response.Redirect("BestWelcome.aspx");
41                }
42            }
43
44        }
45    }
46}