Package org.apache.struts.apps.mailreader.dao

Examples of org.apache.struts.apps.mailreader.dao.User


    public String intercept(ActionInvocation actionInvocation) throws Exception {

        Map session = actionInvocation.getInvocationContext().getSession();

        User user = (User) session.get(Constants.USER_KEY);

        boolean isAuthenticated = (null!=user) && (null!=user.getDatabase());

        if (!isAuthenticated) {
            return Action.LOGIN;           
        }
        else {
View Full Code Here


        // FIXME: Stupid testing hack to compensate for inadequate DAO layer
        if (Constants.EXPIRED_PASSWORD_EXCEPTION.equals(username)) {
            throw new ExpiredPasswordException(Constants.EXPIRED_PASSWORD_EXCEPTION);
        }

        User user = getDatabase().findUser(username);
        if ((user != null) && !user.getPassword().equals(password)) {
            user = null;
        }
        if (user == null) {
            this.addFieldError(Constants.PASSWORD_MISMATCH_FIELD,
                    getText("error.password.mismatch"));
View Full Code Here

            throw new Exception(message, e);
        }
    }

    public void createInputUser() {
        User user = new MemoryUser(null, null);
        setUser(user);
    }
View Full Code Here

     *         Errors if create fails
     */
    public User createUser(String username, String password) {

        UserDatabase database = getDatabase();
        User user;

        try {
            user = database.findUser(username);
         }

View Full Code Here

     *
     * @param _username User username
     * @param _password User password
     */
    public void copyUser(String _username, String _password) {
        User input = getUser();
        input.setPassword(_password);
        User user = createUser(_username, _password);
        if (null != user) {
            copyUser(input,user);
            setUser(user);
        }
    }
View Full Code Here

     * <p>Double check that there is not a valid User login. </p>
     *
     * @return True if there is not a valid User login
     */
    private boolean isCreating() {
        User user = getUser();
        return (null == user) || (null == user.getDatabase());
    }
View Full Code Here

        boolean creating = Constants.CREATE.equals(getTask());
        creating = creating && isCreating(); // trust but verify

        if (creating) {

            User user = findUser(getUsername(), getPassword());
            boolean haveUser = (user != null);

            if (haveUser) {
                addActionError(getText("error.username.unique"));
                return INPUT;
View Full Code Here

    public String intercept(ActionInvocation actionInvocation) throws Exception {

        Map session = actionInvocation.getInvocationContext().getSession();

        User user = (User) session.get(Constants.USER_KEY);

        boolean isAuthenticated = (null!=user) && (null!=user.getDatabase());

        if (!isAuthenticated) {
            return Action.LOGIN;           
        }
        else {
View Full Code Here

*/
public final class Login extends MailreaderSupport {

    public String execute() throws ExpiredPasswordException  {

        User user = findUser(getUsername(), getPassword());

        if (user != null) {
            setUser(user);
        }

View Full Code Here

    public String save() {

        State state = getState();
        UserDatabase database = getUserDatabase();
        String mode = state.getMode();
        User user = state.getUser();
        org.apache.struts.apps.mailreader.dao.Subscription subscription =
                user.findSubscription(state.getHost());

        if ("CREATE".equals(mode)) {

            // Verify that the proposed hostname is not already taken
            if (user.findSubscription(host) != null) {
                // FIXME - localization
                getFacesContext().addMessage("subscription:host",
                        new FacesMessage("That hostname is already defined"));
                return null;
            }

            // Create a new subscription
            subscription = user.createSubscription(host);
            Registration registration = (Registration)getBean("registration");
            user = getState().getUser();
            registration.setFromAddress(user.getFromAddress());
            registration.setFullName(user.getFullName());
            registration.setPassword(user.getPassword());
            registration.setPassword2(user.getPassword());
            registration.setReplyToAddress(user.getReplyToAddress());
            registration.setSubscriptions(user.getSubscriptions());
            registration.setUsername(user.getUsername());

        } else if ("DELETE".equals(mode)) {

            user.removeSubscription(subscription);
            try {
                database.save();
            } catch (Exception e) {
                getFacesContext().addMessage(null,
                        new FacesMessage(e.getMessage()));
View Full Code Here

TOP

Related Classes of org.apache.struts.apps.mailreader.dao.User

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.