Пример #1
0
        /// <summary>
        /// Commit the content and exits out of edit mode
        /// </summary>
        public void Save()
        {
            //Make sure the current password is correct
            //TODO: This will come from the real back-end store of this user password
            //      or via the web server to confirm it
            var storePassword = "******";

            //Confirm current password is match
            //NOTE: Typically this isn't done here, it's done on the server
            if (storePassword != CurrentPassword.Unsecure())
            {
                //Let us know
                IoC.UI.ShowMessage(new MessageBoxDialogViewModel
                {
                    Title   = "Wrong password",
                    Message = "The current password is invalid",
                });

                return;
            }

            //Now check the new and confirm password match
            //NOTE: Typically this isn't done here, it's done on the server
            if (NewPassword.Unsecure() != ConfirmPassword.Unsecure())
            {
                //Let us know
                IoC.UI.ShowMessage(new MessageBoxDialogViewModel
                {
                    Title   = "Password mismatch",
                    Message = "The new and confirm password do not match",
                });

                return;
            }

            //Check we actually have a password
            if (NewPassword.Unsecure().Length == 0)
            {
                //Let us know
                IoC.UI.ShowMessage(new MessageBoxDialogViewModel
                {
                    Title   = "Password too short",
                    Message = "You must enter a password!",
                });

                return;
            }

            //Set the edited password to the current value
            CurrentPassword = new SecureString();
            foreach (var c in NewPassword.Unsecure().ToCharArray())
            {
                CurrentPassword.AppendChar(c);
            }


            Editing = false;
        }
        public void Save()
        {
            // TODO:  Current password check from real back-end
            var storedPassword = "******";

            // For test, placeholder of call to back-end
            if (storedPassword != CurrentPassword.Unsecure())
            {
                IoC.UI.ShowMessage(new MessageBoxDialogViewModel
                {
                    Title   = "Wrong password",
                    Message = "The current password is invalid"
                });

                return;
            }

            if (NewPassword.Unsecure() != ConfirmPassword.Unsecure())
            {
                IoC.UI.ShowMessage(new MessageBoxDialogViewModel
                {
                    Title   = "Password mismatch",
                    Message = "The new and the old password do not match."
                });

                return;
            }

            if (NewPassword.Unsecure().Length == 0)
            {
                IoC.UI.ShowMessage(new MessageBoxDialogViewModel
                {
                    Title   = "Password too short",
                    Message = "You must enter a password!"
                });

                return;
            }

            CurrentPassword = new SecureString();

            foreach (var c in NewPassword.Unsecure().ToCharArray())
            {
                CurrentPassword.AppendChar(c);
            }

            Editing = false;
        }
        /// <summary>
        /// Commits the content and exits out of edit mode
        /// </summary>
        public void Save()
        {
            // TODO: Save content

            //double check password for integrity
            // TODO: This will come from the backend store
            var storedPassword = "******";

            //NOTE: typically done serverside not client side
            if (storedPassword != CurrentPassword.Unsecure())
            {
                IoC.UI.ShowMessage(new MessageBoxDialogViewModel
                {
                    Title   = "Wrong Password",
                    Message = "The current password is invalid",
                });
            }

            //check new and confirm password match
            if (NewPassword.Unsecure() != ConfirmPassword.Unsecure())
            {
                IoC.UI.ShowMessage(new MessageBoxDialogViewModel
                {
                    Title   = "Password Mismatch",
                    Message = "The new and confirm password do not match",
                });
            }

            //check new and confirm password match
            if (NewPassword.Unsecure().Length == 0)
            {
                IoC.UI.ShowMessage(new MessageBoxDialogViewModel
                {
                    Title   = "Password Too Short",
                    Message = "You must enter a password!",
                });
            }

            //set the edited password to the current value
            CurrentPassword = new SecureString();
            foreach (var c in NewPassword.Unsecure().ToCharArray())
            {
                CurrentPassword.AppendChar(c);
            }

            Editing = false;
        }
        private void Save()
        {
            //TODO actual password checking with remote web server
            var storedPassword = "******";

            if (storedPassword != OriginalPassword.Unsecure())
            {
                Container.UI.ShowMessage(new MessageBoxViewModel
                {
                    Title   = "Error",
                    Message = "Invalid password"
                });
                return;
            }

            if (EditedPassword.Unsecure() != ConfirmPassword.Unsecure())
            {
                Container.UI.ShowMessage(new MessageBoxViewModel
                {
                    Title   = "Error",
                    Message = "Password mismatch"
                });
                return;
            }

            if (EditedPassword.Unsecure().Length == 0)
            {
                Container.UI.ShowMessage(new MessageBoxViewModel
                {
                    Title   = "Error",
                    Message = "You must enter a password"
                });

                return;
            }

            OriginalPassword = new SecureString();

            foreach (var c in EditedPassword.Unsecure().ToCharArray())
            {
                OriginalPassword.AppendChar(c);
            }

            IsEditing = false;
        }
        public void Save()
        {
            var storedPassword = "******";

            if (storedPassword != CurrentPassword.Unsecure())
            {
                IoC.UI.ShowMessage(new MessageBoxDialogViewModel
                {
                    Title   = "Wrong password",
                    Message = "The current password is invalid",
                });
                return;
            }

            if (NewPassword.Unsecure() != ConfirmPassword.Unsecure())
            {
                IoC.UI.ShowMessage(new MessageBoxDialogViewModel
                {
                    Title   = "Password mismatch",
                    Message = "The new and confirm password do not match",
                });
                return;
            }

            if (NewPassword.Unsecure().Length == 0)
            {
                IoC.UI.ShowMessage(new MessageBoxDialogViewModel
                {
                    Title   = "Password too short",
                    Message = "You must enter a password!",
                });
                return;
            }

            CurrentPassword = new SecureString();

            foreach (var c in NewPassword.Unsecure().ToCharArray())
            {
                CurrentPassword.AppendChar(c);
            }
            Editing = false;
        }