private void customRoomLogin(ISFSEvent event) throws SFSLoginException { trace("Game Login by session"); DBCollection users = AuthorizeExtension.users; BasicDBObject query = new BasicDBObject(); query.put("session", generateSession); DBCursor cursor = users.find(query); if (!cursor.hasNext()) { trace("Game Login User not found!", generateSession); SFSErrorData data = new SFSErrorData(SFSErrorCode.LOGIN_BAD_PASSWORD); data.addParameter(userName); throw new SFSLoginException("Login failed for user: "******"Game Login User logged in!", generateSession); document = cursor.next(); ISFSObject outData = (ISFSObject) event.getParameter(SFSEventParam.LOGIN_OUT_DATA); outData.putUtfString(SFSConstants.NEW_LOGIN_NAME, document.get("nickname").toString()); Boolean isGuest = (Boolean) document.get("is_guest"); if (isGuest == null) { isRegistered = true; } else { isRegistered = false; } } }
private void lobbyLoginAsGuestOrRegistered(ISFSEvent event) throws SFSLoginException { try { generateSession = MungPass(userName + session); } catch (NoSuchAlgorithmException err) { trace(err.getMessage()); } if (cryptedPass.isEmpty()) { handleGuest(event); } else { handleUser(event); if (document == null) { SFSErrorData data = new SFSErrorData(SFSErrorCode.LOGIN_BAD_PASSWORD); data.addParameter(userName); throw new SFSLoginException("Login failed for user: " + userName, data); } } }