public void changeUserPassword(string oldPassword, string newPassword)
        {
            string currentPassword = hashWorker.getHash(oldPassword, getSultForCurrentUser());

            if (converter.convert(configProxyForLoadDataFromBDAndExecute(
                                      queryConfigurator.checkUser(
                                          currentUser.getLogin(), currentPassword))) == 1)
            {
                configProxyForLoadDataFromBDAndExecute(
                    queryConfigurator.changePassword(currentUser.getLogin(),
                                                     hashWorker.getHash(newPassword, getSultForCurrentUser())));

                currentUser.setPassword(newPassword);

                InformationPopupWindow       view   = new InformationPopupWindow();
                InformationPopupWindowConfig config = new InformationPopupWindowConfig(
                    "Пароль успешно изменен");
                view.setConfig(config);
                view.show();
            }
            else
            {
                throw new IncorrectOldPassword("Exception: old password is not a right");
            }
        }
Beispiel #2
0
        public void changeUserPassword(string oldPassword, string newPassword)
        {
            if (currentUser.isEnterIntoSystem())
            {
                string currentPassword = hashWorker.getHash(oldPassword, getSultForCurrentUser());

                if (DataSetConverter.fromDsToSingle.toInt.convert(
                        SqlLiteSimpleExecute.execute(queryConfigurator.checkUser(
                                                         currentUser.getLogin(), currentPassword))) == 1)
                {
                    SqlLiteSimpleExecute.execute(
                        queryConfigurator.changePassword(currentUser.getLogin(),
                                                         hashWorker.getHash(newPassword, getSultForCurrentUser())));

                    currentUser.setPassword(newPassword);

                    InformationPopupWindow       view   = new InformationPopupWindow();
                    InformationPopupWindowConfig config = new InformationPopupWindowConfig(
                        "Пароль успешно изменен");
                    view.setConfig(config);
                    view.show();
                }
                else
                {
                    throw new IncorrectOldPassword("Exception: old password is not a right");
                }
            }
            else
            {
                throw new InsufficientPermissionsException("This user does not"
                                                           + "have sufficient rights to perform the specified operation");
            }
        }