package smprot;

public class Auther {
	public static boolean auth(String pName, String pPasswd) {
		boolean userok = false;
		for (String pAuth : smserve_main.SMserve.users) {
			if (pAuth.equals(pName)) {
				userok = true;
			}
			if (pAuth.equals(pPasswd) && userok == true) {
				return true;
			}
		}
		return false;
	}
	
	public static boolean chpw(String pUser, String pPw) {
		boolean ret = false;
		for (int i=0; i < smserve_main.SMserve.users.size(); i+=2) {
			if (smserve_main.SMserve.users.get(i).equals(pUser) || pUser.equals("")) {
				smserve_main.SMserve.users.set(i+1, pPw);
				ret = true;
			}
		}
		return ret;
	}
}
