示例#1
0
        public ActionResult ForgotPassword(string userName = null)
        {
            Security active;

            if (userName == null)
            {
                active = session("", "False", "False");
            }
            active = session(userName, "False", "False");
            SecurityController Active = new SecurityController(active);
            IVM model = new SecurityVM(active);

            if (userName == null)
            {
                return(View("ForgotPassword", model));
            }

            string          randomPass = genPass().Trim();
            UsersController u          = new UsersController();
            User            user       = u.GetU(userName);

            user.PassHash = u.HashPassword(randomPass, user.PassSalt);
            u.PutUser(user);
            sendEmail(randomPass, userName, user.FName);
            model = new LoginVM(false, active);
            return(View("Index", model));
        }
示例#2
0
        public ActionResult About(string actives, string activeLog, string activeRem)
        {
            Security           active = session(actives, activeLog, activeRem);
            SecurityController Active = new SecurityController(active);

            Active.CheckLogin();
            IVM model = new SecurityVM(active);

            return(View(model));
        }
        private async void Start(Action SecurityLoad)
        {
            await Loading.Show();

            SecurityVM       = new SecurityVM(SecurityLoad);
            currentValid     = new CurrentValid();
            userNameValid    = new UserNameValid();
            passwordValid    = new PasswordValid();
            this.DataContext = SecurityVM;
            InitializeComponent();
            button = modify;
            ConnectValidators();
        }
 private void newSecurityPass_Validate(object sender, ValidationEventArgs e)
 {
     e.IsValid             = false;
     passwordValid.newPass = false;
     if (string.IsNullOrEmpty(e.Value as string))
     {
         e.SetError("Amennyiben üresen hagyja ezt a mezőt, mentés után a jelszó nem fog változni",
                    DevExpress.XtraEditors.DXErrorProvider.ErrorType.Information);
         passwordValid.newPass = null;
     }
     else
     {
         e.ErrorType = DevExpress.XtraEditors.DXErrorProvider.ErrorType.Critical;
         if (e.Value.ToString().Length < 6)
         {
             e.ErrorContent = "A jelszónak legalább 6 karakteresnek kell lennie";
         }
         else if (e.Value.ToString().Where(char.IsLower).Count().Equals(0))
         {
             e.ErrorContent = "A jelszónak legalább 1 kisbetűt kell tartalmaznia";
         }
         else if (e.Value.ToString().Where(char.IsUpper).Count().Equals(0))
         {
             e.ErrorContent = "A jelszónak legalább 1 nagybetűt kell tartalmaznia";
         }
         else if (e.Value.ToString().Where(char.IsDigit).Count().Equals(0))
         {
             e.ErrorContent = "A jelszónak legalább 1 számot kell tartalmaznia";
         }
         else if (SecurityVM.PasswordMatch(e.Value.ToString()))
         {
             e.ErrorContent = "Az új jelszó nem egyezhet meg az aktuálissal";
         }
         else if (SecurityVM.RegSecurityUserCompare(e.Value.ToString()))
         {
             e.ErrorContent = "Az új jelszó nem egyezhet meg az aktuális felhasználónévvel";
         }
         else if (e.Value.ToString().Equals(newSecurityUser.EditValue))
         {
             e.ErrorContent = "Az új jelszó nem egyezhet meg az új felhasználónévvel";
         }
         else
         {
             e.SetError("A mező tartalma megfelelő", DevExpress.XtraEditors.DXErrorProvider.ErrorType.User1);
             passwordValid.newPass = true;
         }
     }
     CallOtherValidateMethod(newSecurityPass, newSecurityUser);
     confSecurityPass.DoValidate();
     modify.IsEnabled = currentValid.Validation(currentValid, userNameValid, passwordValid);
 }
示例#5
0
        public ActionResult Registration(string actives, string activeLog, string activeRem)
        {
            Security           active = session(actives, activeLog, activeRem);
            SecurityController Active = new SecurityController(active);
            IVM model = new SecurityVM(active);

            if (IsLoggedIn(Active).CheckLogin())
            {
                model = new InventoryVM(Active.GetID(), Active.GetActive());
                return(View("Inventory", model));
            }

            return(View(model));
        }
 private void newSecurityUser_Validate(object sender, ValidationEventArgs e)
 {
     userNameValid.newUser = false;
     e.IsValid             = false;
     if (string.IsNullOrEmpty(e.Value as string))
     {
         e.SetError("Amennyiben üresen hagyja ezt a mezőt, mentés után a felhasználónév nem fog változni",
                    DevExpress.XtraEditors.DXErrorProvider.ErrorType.Information);
         userNameValid.newUser = null;
     }
     else
     {
         e.ErrorType = DevExpress.XtraEditors.DXErrorProvider.ErrorType.Critical;
         if (e.Value.ToString().Length < 6)
         {
             e.ErrorContent = "A felhasználónévnek legalább 6 karaktert kell tartalmaznia";
         }
         else if (SecurityVM.RegSecurityUserCompare(e.Value.ToString()))
         {
             e.ErrorContent = "Az új felhasználónév nem egyezhet meg a régivel";
         }
         else if (SecurityVM.PasswordMatch(e.Value.ToString()))
         {
             e.ErrorContent = "Az új felhasználónév nem egyezhet meg az aktuális jelszóval";
         }
         else if (e.Value.ToString().Equals(newSecurityPass.EditValue))
         {
             e.ErrorContent = "Az új felhasználónév nem egyezhet meg az új jelszóval";
         }
         else
         {
             e.SetError("A mező tartalma megfelelő", DevExpress.XtraEditors.DXErrorProvider.ErrorType.User1);
             userNameValid.newUser = true;
         }
     }
     CallOtherValidateMethod(newSecurityUser, newSecurityPass);
     confSecurityUser.DoValidate();
     modify.IsEnabled = currentValid.Validation(currentValid, userNameValid, passwordValid);
 }
 private void currSecurityPass_Validate(object sender, ValidationEventArgs e)
 {
     newSecurityUser.IsEnabled = newSecurityPass.IsEnabled = false;
     currentValid.currPass     = false;
     e.IsValid   = false;
     e.ErrorType = DevExpress.XtraEditors.DXErrorProvider.ErrorType.Critical;
     if (string.IsNullOrEmpty(e.Value as string))
     {
         e.ErrorContent = "A jelszót nem lehet üresen hagyni";
     }
     else if (e.Value.ToString().Length < 6)
     {
         e.ErrorContent = "A jelszónak legalább 6 karakteresnek kell lennie";
     }
     else if (e.Value.ToString().Where(char.IsLower).Count().Equals(0))
     {
         e.ErrorContent = "A jelszónak legalább 1 kisbetűt kell tartalmaznia";
     }
     else if (e.Value.ToString().Where(char.IsUpper).Count().Equals(0))
     {
         e.ErrorContent = "A jelszónak legalább 1 nagybetűt kell tartalmaznia";
     }
     else if (e.Value.ToString().Where(char.IsDigit).Count().Equals(0))
     {
         e.ErrorContent = "A jelszónak legalább 1 számot kell tartalmaznia";
     }
     else if (SecurityVM.PasswordMatch(e.Value.ToString()))
     {
         e.SetError("A mező tartalma megfelelő", DevExpress.XtraEditors.DXErrorProvider.ErrorType.User1);
         currentValid.currPass = true;
     }
     else
     {
         e.ErrorContent = "A beírt jelszó nem egyezik meg a biztonsági profil jelszavával";
     }
     modify.IsEnabled          = currentValid.Validation(currentValid, userNameValid, passwordValid);
     newSecurityUser.IsEnabled = newSecurityPass.IsEnabled = currentValid.Validate(currentValid);
 }
示例#8
0
        public ActionResult PostUser(User user)
        {
            Security           active = session(user.ID, "False", "False");
            UsersController    u      = new UsersController();
            SecurityController SC     = new SecurityController(active);
            IVM model = new LoginVM(active.IsLoggedIn, active);

            var getUser = u.GetU(user.ID);

            if (getUser == null)
            {
                if (user.FName == null)
                {
                    user.FName = "";
                }
                if (user.LName == null)
                {
                    user.LName = "";
                }
                if (user.Organization == null)
                {
                    user.Organization = "";
                }
                SC.Login(user.ID);
                Login(SC);
                UController.PostUser(user);
                model = new InventoryVM(SC.GetID(), active);
                return(View("Inventory", model));
            }
            else
            {
                ViewBag.ErrorMessage = "Email already registered";
            }
            model = new SecurityVM(active);
            return(View("Registration", model));
        }
 private void currSecurityUser_Validate(object sender, ValidationEventArgs e)
 {
     newSecurityUser.IsEnabled = newSecurityPass.IsEnabled = false;
     currentValid.currUser     = false;
     if (string.IsNullOrEmpty(e.Value as string))
     {
         e.SetError("A felhasználónevet nem lehet üresen hagyni", DevExpress.XtraEditors.DXErrorProvider.ErrorType.Critical);
     }
     else if (e.Value.ToString().Length < 6)
     {
         e.SetError("A felhasználónévnek legalább 6 karaktert kell tartalmaznia", DevExpress.XtraEditors.DXErrorProvider.ErrorType.Critical);
     }
     else if (SecurityVM.RegSecurityUserCompare(e.Value.ToString()))
     {
         e.SetError("A mező tartalma megfelelő", DevExpress.XtraEditors.DXErrorProvider.ErrorType.User1);
         currentValid.currUser = true;
     }
     else
     {
         e.SetError("A mező tartalma nem megfelelő", DevExpress.XtraEditors.DXErrorProvider.ErrorType.Critical);
     }
     modify.IsEnabled          = currentValid.Validation(currentValid, userNameValid, passwordValid);
     newSecurityUser.IsEnabled = newSecurityPass.IsEnabled = currentValid.Validate(currentValid);
 }
 protected internal bool Dirty()
 {
     return(SecurityVM.VMDirty());
 }
 private void SecurityDatasChangeExecute(object sender, RoutedEventArgs e)
 {
     SecurityVM.ExecuteMethod();
 }