[FIX] Username case

This commit is contained in:
Gravit 2020-08-22 23:21:21 +07:00
parent e3da81bc85
commit 17bce5dff0
No known key found for this signature in database
GPG key ID: 98A079490768CCE5
4 changed files with 7 additions and 5 deletions

View file

@ -1,6 +1,7 @@
package pro.gravit.launchserver.auth.handler;
import pro.gravit.launchserver.dao.User;
import pro.gravit.utils.helper.LogHelper;
import java.util.UUID;
@ -9,7 +10,7 @@ public class HibernateAuthHandler extends CachedAuthHandler {
protected Entry fetchEntry(String username) {
User user = srv.config.dao.userDAO.findByUsername(username);
if (user == null) return null;
return new Entry(user.getUuid(), username, user.getAccessToken(), user.getServerID());
return new Entry(user.getUuid(), user.getUsername(), user.getAccessToken(), user.getServerID());
}
@Override
@ -22,6 +23,7 @@ protected Entry fetchEntry(UUID uuid) {
@Override
protected boolean updateAuth(UUID uuid, String username, String accessToken) {
User user = srv.config.dao.userDAO.findByUUID(uuid);
LogHelper.debug("UpdateAuth: %s: %s", uuid == null ? "null" : uuid.toString(), user == null ? "null" : user.getUsername());
user.setAccessToken(accessToken);
srv.config.dao.userDAO.update(user);
return true;

View file

@ -26,7 +26,7 @@ public AuthProviderResult auth(String login, AuthRequest.AuthPasswordInterface p
if (user == null) throw new AuthException("Username incorrect");
else throw new AuthException("Username or password incorrect");
}
return new AuthProviderDAOResult(login, SecurityHelper.randomStringToken(), user.getPermissions(), user);
return new AuthProviderDAOResult(user.getUsername(), SecurityHelper.randomStringToken(), user.getPermissions(), user);
}
@Override

View file

@ -81,8 +81,8 @@ public void execute(ChannelHandlerContext ctx, Client clientData) throws Excepti
clientData.permissions = aresult.permissions;
clientData.auth_id = auth_id;
clientData.updateAuth(server);
if (result.playerProfile != null)
clientData.username = result.playerProfile.username;
if (aresult.username != null)
clientData.username = aresult.username;
else
clientData.username = login;
if(aresult instanceof AuthProviderDAOResult)

View file

@ -5,7 +5,7 @@
id 'org.openjfx.javafxplugin' version '0.0.8' apply false
}
group = 'pro.gravit.launcher'
version = '5.1.7'
version = '5.1.8-SNAPSHOT'
apply from: 'props.gradle'