Add password reset URL generation and backend validation

This commit is contained in:
2025-02-17 17:48:26 +01:00
parent 6aeecd444e
commit 8ec12603b6
4 changed files with 24 additions and 11 deletions
@@ -31,7 +31,6 @@ import de.steamwar.util.type
import io.ktor.http.*
import io.ktor.server.application.*
import io.ktor.server.auth.*
import io.ktor.server.http.*
import io.ktor.server.plugins.*
import io.ktor.server.request.*
import io.ktor.server.response.*
@@ -64,7 +63,7 @@ fun Route.configureNewAuth() {
route("/auth") {
route("/enroll") {
post("/{userId}") {
if (call.request.headers.contains("X-Forwarded-For")) {
if (call.request.headers.contains("X-Forwarded-For") || call.request.header("Host") != "localhost:1337") {
SWException.log("Request to /auth/register from", "Invalid IP")
call.respond(HttpStatusCode.Forbidden, ResponseError("Invalid IP", "F_U"))
return@post