src/main/java/edu/kit/informatik/pcc/webinterface/datamanagement/AccountDataManager.java
/**
     * This method checks if the password is correct and then changes the account data
     * via the ServerProxy.
     *
     * @param mailNew new mail address
     * @param passwordNew new password
     * @param password password
     * @return true on success false else
     */
This method checks if the password is correct and then changes the account data
via the ServerProxy.

@param mailNew new mail address
@param passwordNew new password
@param password password
@return true on success false else
This method checks if the password is correct and then changes the account data via the ServerProxy . @param mailNew new mail address @param passwordNew new password @param password password @return true on success false else
public static boolean changeAccount(String password, String mailNew,
                                        String passwordNew, VaadinSession session) {
        if (passwordNew.length() == 0 && mailNew.length() == 0) {
            MessageBox.createInfo()
                    .withMessage(errors.getString("noChanges"))
                    .open();
            return false;
        }
        Account account = (Account) session.getAttribute("account");
        Account newAccount = new Account(mailNew, passwordNew);
        if (passwordNew.length() == 0) {
            newAccount = new Account(mailNew, account.getPassword());
        } else if (mailNew.length() == 0) {
            newAccount = new Account(account.getMail(), passwordNew);
        }
        if (!MailService.isValidEmailAddress(newAccount.getMail())) {
            MessageBox.createInfo()
                    .withMessage(errors.getString("noLegitMail"))
                    .open();
            return false;
        }
        if (newAccount.getPassword().length() < PASSWORDMIN) {
            MessageBox.createInfo()
                    .withMessage(errors.getString("toShortPassword"))
                    .open();
            return false;
        }
        if (!password.equals(account.getPassword())) {
            MessageBox.createInfo()
                    .withMessage(errors.getString("wrongPassword"))
                    .open();
            return false;
        }
        String ret = ServerProxy.changeAccount(account, newAccount);
        session.setAttribute("account", newAccount);
        switch (ret) {
            case WRONGACCOUNT:
                MessageBox.createInfo()
                        .withMessage(errors.getString("wrongAccount"))
                        .open();
                break;
            case SUCCESS:
                MessageBox.createInfo()
                        .withMessage(errors.getString("accountChanged"))
                        .open();
                return true;
            case FAILURE:
            default:
                MessageBox.createInfo()
                        .withMessage(errors.getString("changeFail"))
                        .open();
                break;
        }
        return true;
    }
public static boolean changeAccount ( String password , String mailNew , String passwordNew , VaadinSession session ) { if ( passwordNew . length ( ) == 0 && mailNew . length ( ) == 0 ) { MessageBox . createInfo ( ) . withMessage ( errors . getString ( "noChanges" ) ) . open ( ) ; return false ; } Account account = ( Account ) session . getAttribute ( "account" ) ; Account newAccount = new Account ( mailNew , passwordNew ) ; if ( passwordNew . length ( ) == 0 ) { newAccount = new Account ( mailNew , account . getPassword ( ) ) ; } else if ( mailNew . length ( ) == 0 ) { newAccount = new Account ( account . getMail ( ) , passwordNew ) ; } if ( ! MailService . isValidEmailAddress ( newAccount . getMail ( ) ) ) { MessageBox . createInfo ( ) . withMessage ( errors . getString ( "noLegitMail" ) ) . open ( ) ; return false ; } if ( newAccount . getPassword ( ) . length ( ) < PASSWORDMIN ) { MessageBox . createInfo ( ) . withMessage ( errors . getString ( "toShortPassword" ) ) . open ( ) ; return false ; } if ( ! password . equals ( account . getPassword ( ) ) ) { MessageBox . createInfo ( ) . withMessage ( errors . getString ( "wrongPassword" ) ) . open ( ) ; return false ; } String ret = ServerProxy . changeAccount ( account , newAccount ) ; session . setAttribute ( "account" , newAccount ) ; switch ( ret ) { case WRONGACCOUNT : MessageBox . createInfo ( ) . withMessage ( errors . getString ( "wrongAccount" ) ) . open ( ) ; break ; case SUCCESS : MessageBox . createInfo ( ) . withMessage ( errors . getString ( "accountChanged" ) ) . open ( ) ; return true ; case FAILURE : default : MessageBox . createInfo ( ) . withMessage ( errors . getString ( "changeFail" ) ) . open ( ) ; break ; } return true ; }
This method checks if the password is correct and then changes the account data
 via the ServerProxy.
This method checks if the password is correct and then changes the account data via the ServerProxy .