コード例 #1
0
        public ActionResult AccountEdit(SwimomaticMVC.Models.AccountEdit model)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    SystemUser su = new SystemUser();
                    su.City = model.City;
                    su.Email = model.Email;
                    su.FirstName = model.FirstName;
                    su.LastName = model.LastName;
                    su.ModifiedDate = DateTime.Now;
                    su.Password = model.Password; //new password
                    su.RegionID = model.RegionID;
                    su.SystemUserID = model.SystemUserID;
                    su.UserName = model.UserName;
                    BizMgr.SaveAccountEdit(su);

                    //get updated values from db
                    SwimomaticMVC.Models.AccountEdit ae = GetAccountEdit(su.SystemUserID);
                    return View("AccountEditSuccess", ae);
                }
            }
            catch (Exception ex)
            {
                LogController.LogError(ex, LogEntryType.NormalError, "", "", "", "UserName=" + model.UserName.ToString());
            }
            return View(model);
        }
コード例 #2
0
 public CurrentUserBase(SystemUser systemUser)
 {
     base.CreateDate = systemUser.CreateDate;
     base.City = systemUser.City;
     base.Email = systemUser.Email;
     base.IsActive = systemUser.IsActive;
     base.Password = systemUser.Password;
     base.RegionID = systemUser.RegionID;
     base.RegistrationKey = systemUser.RegistrationKey;
     base.ResetPassword = systemUser.ResetPassword;
     base.SystemUserID = systemUser.SystemUserID;
     base.UserName = systemUser.UserName;
     base.LastName = systemUser.LastName;
     base.FirstName = systemUser.FirstName;
     base.RegionAbbrev = systemUser.RegionAbbrev;
 }
コード例 #3
0
        public MembershipCreateStatus CreateUser(string City, string Email, string FirstName, string LastName, string Password, int RegionID)
        {
            int newSystemUserID = 0;
            if (SystemUserExists(Email) == MembershipCreateStatus.Success)
            {
                Guid registrationKey = Guid.NewGuid();
                SystemUser su = new SystemUser();
                su.IsActive = false;
                su.RegistrationKey = registrationKey;
                su.FirstName = FirstName;
                su.LastName = LastName;
                su.Email = Email;
                su.City = City;
                su.Password = GetMd5Hash(Password);
                su.RegionID = RegionID;
                su.UserName = Email;
                su.CreateDate = DateTime.Now;
                newSystemUserID = Ctx.SystemUserManager.SystemUserSave(su);

                SendConfirmationEmail(Email, registrationKey);
                return (newSystemUserID > 0) ? MembershipCreateStatus.Success : MembershipCreateStatus.ProviderError;
            }
            else
            {
                return MembershipCreateStatus.DuplicateEmail;
            }
        }
コード例 #4
0
        public SystemUser SavePasswordEdit(SystemUser su)
        {
            SystemUser systemUser = Ctx.SystemUserManager.SystemUserGet(su.SystemUserID);
            if (systemUser.TemporaryPassword.Equals(su.TemporaryPassword))
            {
                systemUser.Password = GetMd5Hash(su.Password);
                systemUser.ModifiedDate = DateTime.Now;
                systemUser.ResetPassword = false;

                //reset registration key so user doesn't accidentally reset again
                systemUser.RegistrationKey = new Guid("00000000-0000-0000-0000-000000000001");
                systemUser.TemporaryPassword = "";

                Ctx.SystemUserManager.SystemUserSave(systemUser);
                return systemUser;
            }
            return su;
        }
コード例 #5
0
 public void SaveAccountEdit(SystemUser su)
 {
     SystemUser systemUser = Ctx.SystemUserManager.SystemUserGet(su.SystemUserID);
 }
コード例 #6
0
 public ActionResult ResetPasswordSuccess(SystemUser su)
 {
     ViewBag.Email = su.Email;
     return View("ResetPasswordSuccess");
 }
コード例 #7
0
        public ActionResult PasswordEdit(PasswordEdit model)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    SystemUser su = new SystemUser();
                    su.ModifiedDate = DateTime.Now;
                    su.Password = model.NewPassword; //new password
                    su.TemporaryPassword = model.TemporaryPassword; //new password
                    su.SystemUserID = model.SystemUserID;
                    su = BizMgr.SavePasswordEdit(su);

                    FormsService.SignIn(su.UserName, false);
                    SetCurrentUser(su);

                    return RedirectToAction("PasswordEditSuccess","Account");
                }
            }
            catch (Exception ex)
            {
                LogController.LogError(ex, LogEntryType.NormalError, "", "", "", "SystemUserID=" + model.SystemUserID.ToString());
            }
            return View(model);
        }
コード例 #8
0
ファイル: ControllerBase.cs プロジェクト: kdmerkle/Swimomatic
 protected void SetCurrentUser(SystemUser su)
 {
     try
     {
         this.CurrentUser = new CurrentUserBase(su);
         //UserLeagueCollection uls = BizMgr.GetUserLeaguesBySystemUserID(su.SystemUserID);
         //foreach (UserLeague ul in uls)
         //{
         //    League l = BizMgr.GetLeague(ul.LeagueID);
         //    if (!this.CurrentUser.Leagues.Contains(l))
         //    {
         //        this.CurrentUser.Leagues.Add(l);
         //    }
         //}
         //UserTeamCollection uts = BizMgr.GetUserTeamsBySystemUserID(su.SystemUserID);
         //foreach (UserTeam ut in uts)
         //{
         //    Team t = BizMgr.GetTeam(ut.TeamID);
         //    if (!this.CurrentUser.Teams.Contains(t))
         //    {
         //        this.CurrentUser.Teams.Add(t);
         //    }
         //}
         //UserSwimmerCollection uss = BizMgr.GetUserSwimmersBySystemUserID(su.SystemUserID);
         //foreach (UserSwimmer us in uss)
         //{
         //    Swimmer s = BizMgr.GetSwimmer(us.SwimmerID);
         //    if (!this.CurrentUser.Swimmers.Contains(s))
         //    {
         //        this.CurrentUser.Swimmers.Add(s);
         //    }
         //}
         //UserSwimMeetCollection usms = BizMgr.GetUserSwimMeetsBySystemUserID(su.SystemUserID);
         //foreach (UserSwimMeet usm in usms)
         //{
         //    SwimMeet sm = BizMgr.GetSwimMeet(usm.SwimMeetID);
         //    if (!this.CurrentUser.SwimMeets.Contains(sm))
         //    {
         //        this.CurrentUser.SwimMeets.Add(sm);
         //    }
         //}
     }
     catch (Exception ex)
     {
         LogController.LogError(ex, LogEntryType.NormalError, "", "", "", "UserID=" + su.SystemUserID.ToString());
     }
 }