public string UpdateUser(string email, string password, string firstName, string lastName, string gender, string country) { mCurrentUser = (UserBase)Session["CurrentUser"]; if (mCurrentUser == null) { return("Please Reload Page"); } UserBaseBO userBaseBO = new UserBaseBO(); ECountry eCountry = (ECountry)Int32.Parse(country.Substring(("ECountry_").Length)); EGender eGender = (EGender)Int32.Parse(gender.Substring(("EGender_").Length)); mCurrentUser.Email = email; mCurrentUser.FirstName = firstName; mCurrentUser.LastName = lastName; mCurrentUser.Gender = eGender; if (!mCurrentUser.Location.IsLoaded()) { ObjectLocationBO objectLocationBO = new ObjectLocationBO(); objectLocationBO.Load(mCurrentUser.Location); } mCurrentUser.Location.Country = eCountry; userBaseBO.Save(mCurrentUser); LoginManagerBO loginManagerBO = new LoginManagerBO(); if (password.Length < 6) { loginManagerBO.UpdateUserLoginInfo(mCurrentUser.UniqueID, email); } else { loginManagerBO.UpdateUserLoginInfo(mCurrentUser.UniqueID, email, password); } Session["CurrentUser"] = mCurrentUser; return("Success"); }
protected void Page_Load(object sender, EventArgs e) { mLoginManagerBO = new LoginManagerBO(); mCurrentUser = (UserBase)Session["CurrentUser"]; if (mCurrentUser == null) { CreateCurrentUser(); } else if (!mCurrentUser.IsNull) { Response.Redirect("EventBrief.aspx"); //InvalidMessage = "Hello " + mCurrentUser.FirstName + " " + mCurrentUser.LastName + " From " + mCurrentUser.Location.Country.GetStringValue(); } else { CreateCurrentUser(); } }
protected void Page_Load(object sender, EventArgs e) { mLoginManagerBO = new LoginManagerBO(); mEventBaseBO = new EventBaseBO(); mUserBaseBO = new UserBaseBO(); mItemBaseBO = new ItemBaseBO(); mUserNameImageListBO = new UserNameImageListBO(); Session["NewItemsListLoaded"] = false; mCurrentUser = (UserBase)Session["CurrentUser"]; if (mCurrentUser == null) { Signout(); } else if (!mCurrentUser.IsNull) { mCurrentEvent = (EventBase)Session["CurrentEvent"]; if (mCurrentEvent == null) { GoToBrief(); } if (mCurrentEvent.IsNull) { GoToBrief(); } if (mCurrentUser.UniqueID != mCurrentEvent.Admin.UniqueID) { Response.Redirect("EventView.aspx"); } lblName.Text = "Hello " + mCurrentUser.FirstName + " " + mCurrentUser.LastName; PopulatePage(); } else { Signout(); } }
public string SendEmailReminder(string email) { if (email == string.Empty) { return("Email box is empty"); } if (!mEmailRegex.IsMatch(email)) { return("Not a valid email string"); } StringBuilder builder = new StringBuilder(); Random random = new Random(); char ch; for (int i = 0; i < 6; i++) { ch = Convert.ToChar(Convert.ToInt32(Math.Floor(26 * random.NextDouble() + 65))); builder.Append(ch); } string newPassword = builder.ToString().ToUpper(); string subject = "MyEasyPotluck password reset"; string body = "A new password has been assigned to your login name in www.myeasypotluck.com\nPlease sign-in with your email and use the following password:\n" + newPassword + "\n\nThank You\nMyEasyPotluck\n"; body = body.Replace("www.myeasypotluck.com", "<a href=\"http://www.myeasypotluck.com/\">www.myeasypotluck.com</a>").Replace("\n", "<br/>"); try { EmailSender.SendEmail(EmailSender.EEmailAccount.eEmailReminder, email, subject, body); LoginManagerBO loginManagerBO = new LoginManagerBO(); loginManagerBO.UpdatePassword(email, newPassword); } catch { return("Failed to send email"); } return("success"); }
public string LoginUser(string email, string password) { if ((email == string.Empty) && (password == string.Empty)) { return("Email and Password missing"); } if (email == string.Empty) { return("Email box is empty"); } if (!mEmailRegex.IsMatch(email)) { return("Not a valid email string"); } if (password == string.Empty) { return("Password box is empty"); } LoginManagerBO loginManagerBO = new LoginManagerBO(); if (!loginManagerBO.EmailExists(email)) { return("Password or Email dont match"); } UserBase currentUser = new UserBase(); if (loginManagerBO.GetUser(currentUser, email, password) == false) { return("Password or Email dont match"); } Session["CurrentUser"] = currentUser; return("success"); }
public string CreateUser(string email, string password, string fullName, string gender, string country) { LoginManagerBO loginManagerBO = new LoginManagerBO(); CreateCurrentUser(); ECountry eCountry = (ECountry)Int32.Parse(country.Substring(("ECountry_").Length)); EGender eGender = (EGender)Int32.Parse(gender.Substring(("EGender_").Length)); string firstName; string lastName = ""; string[] fullNameSplit = fullName.Split(' '); firstName = fullNameSplit[0]; for (int i = 1; i < fullNameSplit.Length; i++) { if (i > 1) { lastName += " " + fullNameSplit[i]; } else { lastName += fullNameSplit[i]; } } if (loginManagerBO.EmailExists(email)) { return(email + " already taken"); } // Create User loginManagerBO.CreateUser(mCurrentUser, password, email, firstName, lastName, eGender, eCountry); //loginManagerBO.CreateSampleEvent(mCurrentUser); Session["CurrentUser"] = mCurrentUser; return("success"); }
protected void Page_Load(object sender, EventArgs e) { mLoginManagerBO = new LoginManagerBO(); mEventBaseBO = new EventBaseBO(); mUserBaseBO = new UserBaseBO(); mItemBaseBO = new ItemBaseBO(); mUserNameImageListBO = new UserNameImageListBO(); mCurrentUser = (UserBase)Session["CurrentUser"]; if (mCurrentUser == null) { Signout(); } else if (!mCurrentUser.IsNull) { lblName.Text = "Hello " + mCurrentUser.FirstName + " " + mCurrentUser.LastName; mCurrentEvent = (EventBase)Session["CurrentEvent"]; if (mCurrentEvent == null) { GoToBrief(); } if (mCurrentEvent.IsNull) { GoToBrief(); } PopulatePage(); } else { Signout(); } }
protected void Page_Load(object sender, EventArgs e) { mLoginManagerBO = new LoginManagerBO(); mEventBaseBO = new EventBaseBO(); mUserBaseBO = new UserBaseBO(); mCurrentUser = (UserBase)Session["CurrentUser"]; Session["CurrentEvent"] = null; if (mCurrentUser == null) { Signout(); } else if (!mCurrentUser.IsNull) { lblName.Text = "Hello " + mCurrentUser.FirstName + " " + mCurrentUser.LastName; PopulatePage(IsPostBack); } else { Signout(); } }