Newer
Older
CactusServer / src / main / java / cactusServer / entities / Account.java
package cactusServer.entities;

import org.apache.commons.lang3.RandomStringUtils;

public class Account {
	private String name, pass, token;
	private boolean login = false;

	public Account(String userName, String userPass) {
		setName(userName);
		setPass(userPass);
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getPass() {
		return pass;
	}

	public void setPass(String pass) {
		this.pass = pass;
	}

	public boolean isLogin() {
		return login;
	}

	public void setLogin(boolean login) {
		this.login = login;
	}

	public String getToken() {
		return token;
	}

	public String formToken() {
		token = RandomStringUtils.random(64, "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz");
		return token;
	}

	public Account getAccount(String token) {
		if (this.token == token) {
			return this;
		} else {
			return null;
		}
	}
}