fixed bug that made registering a new user impossible
This commit is contained in:
parent
163141e3a3
commit
3079ee8346
@ -120,13 +120,16 @@ public class LoginCredentialProcessor implements ObjectProcessor<LoginCredential
|
|||||||
* @since Envoy Server Standalone v0.1-alpha
|
* @since Envoy Server Standalone v0.1-alpha
|
||||||
*/
|
*/
|
||||||
private envoy.server.data.User newUser(LoginCredentials credentials, long socketId, ObjectWriteProxy writeProxy) throws IOException {
|
private envoy.server.data.User newUser(LoginCredentials credentials, long socketId, ObjectWriteProxy writeProxy) throws IOException {
|
||||||
// Checking that no user already has this identifier TODO change to identifier once implemented
|
try {
|
||||||
if (PersistenceManager.getPersistenceManager().getUserByName(credentials.getIdentifier()) != null)
|
// Checking that no user already has this identifier
|
||||||
|
PersistenceManager.getPersistenceManager().getUserByName(credentials.getIdentifier());
|
||||||
|
// this code only gets executed if this user already exists
|
||||||
writeProxy.write(socketId, new HandshakeRejectionEvent(HandshakeRejectionEvent.USER_EXISTS_ALREADY));
|
writeProxy.write(socketId, new HandshakeRejectionEvent(HandshakeRejectionEvent.USER_EXISTS_ALREADY));
|
||||||
|
return null;
|
||||||
|
} catch (NoResultException e) {
|
||||||
// Creation of a new user
|
// Creation of a new user
|
||||||
envoy.server.data.User user;
|
envoy.server.data.User user;
|
||||||
user = new envoy.server.data.User();
|
user = new envoy.server.data.User();
|
||||||
//TODO needs to be replaced later on
|
|
||||||
user.setName(credentials.getIdentifier());
|
user.setName(credentials.getIdentifier());
|
||||||
user.setLastSeen(new Date());
|
user.setLastSeen(new Date());
|
||||||
user.setStatus(User.UserStatus.ONLINE);
|
user.setStatus(User.UserStatus.ONLINE);
|
||||||
@ -136,3 +139,4 @@ public class LoginCredentialProcessor implements ObjectProcessor<LoginCredential
|
|||||||
return user;
|
return user;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user