/*
 * Created on 30.03.2005
 *
 * $Id$
 */
package web;

import java.io.IOException;
import java.util.Properties;

public class Account {
    
    static private Properties passwords = new Properties();
    private String user = null;
    
    static {
        try {
            passwords.load(Account.class
                    .getResourceAsStream("/passwd.properties"));
        } catch (IOException e) {
            System.err.println("can't read passwd.properties");
        }
    }
    
    public Account(String loginName) {
        this.user = loginName;
    }
    
    public String getName() {
        return this.user;
    }
    
    public boolean isValid(String password) {
        if (password == null) {
            return false;
        } else {
            return password.equals(passwords.getProperty(user));
        }
    }
    
    public String toString() {
        return user;
    }

}
