mirror of
https://github.com/GravitLauncher/Launcher
synced 2024-11-15 03:31:15 +03:00
Merge branch 'dev' of github.com:GravitLauncher/Launcher into dev
This commit is contained in:
commit
9a748f0ea3
4 changed files with 7 additions and 5 deletions
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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'
|
||||
|
||||
|
|
Loading…
Reference in a new issue