@Override
	public int authorized(String email, String password)
	{
		int ret = -1;
/*

SELECT id, password, group_id
FROM b_user AS bu
RIGHT JOIN b_user_group AS bug ON bu.id = bug.user_id
WHERE login = ? AND group_id = 1 AND active = 'Y'
*/
		String q =
			"SELECT id, password, group_id\n" +
				"FROM b_user AS bu\n" +
				"RIGHT JOIN b_user_group AS bug ON bu.id = bug.user_id\n" +
				"WHERE login = ? AND group_id = 1 AND active = 'Y'";
		Object[] params = {email};
		if(email != null && password != null)
			try
			(
				Connection con = Db.ds.getConnection();
				PreparedStatement ps = Helpers.createStatement(con, q, params);
				ResultSet rs = ps.executeQuery()
			)
			{
				if(rs.next())
				{
					String saltnhash = rs.getString("password");
					String salt = saltnhash.substring(0, 8);
					String hash_string = saltnhash.substring(8);
					byte[] hash = Hex.decodeHex(hash_string.toCharArray());
					boolean match = Arrays.equals(hash, (md.digest((salt + password).getBytes(StandardCharsets.UTF_8))));
					if(match)
						ret = rs.getInt("id");
				}
				else
					log.info("No such user {}", email);
			}
			catch(Exception e)
			{
				log.error(e.toString(), e);
			}
		else
			log.info("Not enough credentials to check authorization");

		return ret;
	}