mirror of
https://github.com/GravitLauncher/Launcher
synced 2024-11-15 11:39:11 +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;
|
package pro.gravit.launchserver.auth.handler;
|
||||||
|
|
||||||
import pro.gravit.launchserver.dao.User;
|
import pro.gravit.launchserver.dao.User;
|
||||||
|
import pro.gravit.utils.helper.LogHelper;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
|
@ -9,7 +10,7 @@ public class HibernateAuthHandler extends CachedAuthHandler {
|
||||||
protected Entry fetchEntry(String username) {
|
protected Entry fetchEntry(String username) {
|
||||||
User user = srv.config.dao.userDAO.findByUsername(username);
|
User user = srv.config.dao.userDAO.findByUsername(username);
|
||||||
if (user == null) return null;
|
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
|
@Override
|
||||||
|
@ -22,6 +23,7 @@ protected Entry fetchEntry(UUID uuid) {
|
||||||
@Override
|
@Override
|
||||||
protected boolean updateAuth(UUID uuid, String username, String accessToken) {
|
protected boolean updateAuth(UUID uuid, String username, String accessToken) {
|
||||||
User user = srv.config.dao.userDAO.findByUUID(uuid);
|
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);
|
user.setAccessToken(accessToken);
|
||||||
srv.config.dao.userDAO.update(user);
|
srv.config.dao.userDAO.update(user);
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -26,7 +26,7 @@ public AuthProviderResult auth(String login, AuthRequest.AuthPasswordInterface p
|
||||||
if (user == null) throw new AuthException("Username incorrect");
|
if (user == null) throw new AuthException("Username incorrect");
|
||||||
else throw new AuthException("Username or password 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
|
@Override
|
||||||
|
|
|
@ -81,8 +81,8 @@ public void execute(ChannelHandlerContext ctx, Client clientData) throws Excepti
|
||||||
clientData.permissions = aresult.permissions;
|
clientData.permissions = aresult.permissions;
|
||||||
clientData.auth_id = auth_id;
|
clientData.auth_id = auth_id;
|
||||||
clientData.updateAuth(server);
|
clientData.updateAuth(server);
|
||||||
if (result.playerProfile != null)
|
if (aresult.username != null)
|
||||||
clientData.username = result.playerProfile.username;
|
clientData.username = aresult.username;
|
||||||
else
|
else
|
||||||
clientData.username = login;
|
clientData.username = login;
|
||||||
if(aresult instanceof AuthProviderDAOResult)
|
if(aresult instanceof AuthProviderDAOResult)
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
id 'org.openjfx.javafxplugin' version '0.0.8' apply false
|
id 'org.openjfx.javafxplugin' version '0.0.8' apply false
|
||||||
}
|
}
|
||||||
group = 'pro.gravit.launcher'
|
group = 'pro.gravit.launcher'
|
||||||
version = '5.1.7'
|
version = '5.1.8-SNAPSHOT'
|
||||||
|
|
||||||
apply from: 'props.gradle'
|
apply from: 'props.gradle'
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue