Beispiel #1
0
 public ActionResult ChangePassword(string oldPassword, string newPassword, string confPassword)
 {
     try
     {
         if (newPassword != confPassword)
         {
             throw new Exception("Password does not match.");
         }
         atriumBE.atriumManager           atmng = Helper.Atmng();
         lmDatasets.SecurityDB.secUserRow sur   = atmng.SecurityManager.CurrentUser;
         atmng.SecurityManager.GetsecUser().ChangeSQLPassword(sur, newPassword, oldPassword);
         return(RedirectToAction("Index", "Search"));
     }
     catch (Exception x)
     {
         ViewBag.Error = x.Message;
         return(View());
     }
 }
Beispiel #2
0
        public void Init(atSecurity.SecurityManager sm, lmDatasets.officeDB.OfficerRow or)
        {
            mySM = sm;
            myOr = or;

            secUserBindingSource.DataSource = mySM.DB;
            secUserBindingSource.DataMember = "secUser";;

            if (!or.IsUserNameNull())
            {
                sur = mySM.GetsecUser().Load(or.UserName);
            }
            else
            {
                sur = null;
            }

            if (sur == null)
            {
                isNew = true;
                sur   = mySM.DB.secUser.NewsecUserRow();
                if (!or.IsUserNameNull())
                {
                    sur.UserName = or.UserName;
                }

                mySM.DB.secUser.AddsecUserRow(sur);
                //mySM.GetsecMembership().Add(sur);
                btnDeleteOfficerAccount.Enabled = false;
            }
            else
            {
                bool NotEnabled = true;
                if (sur.AuthType == 0)
                {
                    bool SQLAccountExists = mySM.GetsecUser().DoesSQLUserExist(sur.UserName);
                    if (!SQLAccountExists)
                    {
                        secUserExistsWithoutSQLAccount = true;
                        NotEnabled = false;
                    }
                }

                if (NotEnabled)
                {
                    isNew = false;
                    userNameEditBox.Enabled = false;
                    uiRadioButton1.Enabled  = false;
                    uiRadioButton2.Enabled  = false;
                }
                else
                {
                    //handle out of sync issue with atrium and sql accounts
                    MessageBox.Show("We're sorry, but something's gone wrong. It seems this user has an Atrium security account, but does not have a SQL account. Please rectify this immediately.");
                }
            }


            mySM.GetsecGroup().Load();
            mySM.GetsecMembership().LoadByUserId(sur.UserId);

            secMembershipGridEX.DropDowns["ddGroup"].SetDataBinding(mySM.DB.secGroup, "");
            secUserBindingSource.Filter = "UserId=" + sur.UserId;
        }