private User validateUser() {
        loginStatus = 5;
        updateProgressView();
        User user = null;


        try {

            // Get all users
            Connection conn = (Connection) Controller.dbHandler.initiateSystemDBConn()[0];
            ArrayList<User> users = Controller.dbHandler.initiateUserList(conn);

            // Retrieve login credentials
            String username = textFieldUserName.getText();
            char[] pw = passwordFieldPassword.getPassword();
            String enteredPassword = new String(pw);


            // Iterate through all users and compare credentials
            boolean userFound = false;
            boolean passwordMatch = false;
            int counter = 0;
            while (!userFound && counter < users.size()) {
                if (users.get(counter).getUserName().equals(username)) {
                    userFound = true;
                    String pass = users.get(counter).getPassword();
                    if (pass.equals(enteredPassword)) {
                        passwordMatch = true;

                    }
                }
                counter++;
            }
            if (userFound && passwordMatch) {
                progressBar.setValue(loginStatus);
                setMessage("Success");
                user = users.get(counter - 1); // -1 As it has incremented once and would otherwise create an out of bounds exception

            } else if (!userFound) {
                // User doesnt exist
                setWarningMessage("Brugernavnet kan ikke genkendes");
            } else {
                // Password doesnt match
                setWarningMessage("Passwordet matcher ikke brugernavnet");
            }

        } catch (SQLException ex) {
            // A connection couldnt be established to the database
            setWarningMessage("Der kunne ikke oprettes forbindelse til systemdatabasen");

        } catch (IOException ex) {
            // A connection couldnt be established to the database
            setWarningMessage("Der kunne ikke oprettes forbindelse til systemdatabasen");

//        } catch (ClassNotFoundException ex) {
//            //Mainframe couldnt be initialized
//            setWarningMessage("Programmet kunne ikke starte - Prøv igen..");
//
        }
        //progressBar.setValue(loginStatus);


        return user;
    }