forked from SteamWar/SteamWar
Refactor password check and add cache clearance.
This commit is contained in:
@@ -335,7 +335,7 @@ public class SteamwarUser {
|
||||
|
||||
public boolean verifyPassword(String password) {
|
||||
try {
|
||||
if (this.password == null) {
|
||||
if (!hasPassword()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -48,6 +48,7 @@ fun main() {
|
||||
while (true) {
|
||||
Thread.sleep(1000 * 10)
|
||||
ResponseUser.clearCache()
|
||||
SteamwarUser.clear()
|
||||
}
|
||||
}.start()
|
||||
embeddedServer(Netty, port = 1337, host = "127.0.0.1", module = Application::module)
|
||||
|
||||
@@ -61,6 +61,7 @@ fun Route.configureAuth() {
|
||||
post {
|
||||
val request = call.receive<UsernamePassword>()
|
||||
|
||||
SteamwarUser.clear()
|
||||
val user = SteamwarUser.get(request.name)
|
||||
val valid = user?.verifyPassword(request.password) ?: false
|
||||
|
||||
|
||||
Reference in New Issue
Block a user