feat: implement unauthorized error handling and login popup
Some checks failed
Deploy Miniplan / build (push) Failing after 42s
Some checks failed
Deploy Miniplan / build (push) Failing after 42s
This commit is contained in:
@@ -59,7 +59,7 @@ fun Payload.mid() = getClaim("id").asInt()
|
||||
|
||||
|
||||
object Security {
|
||||
fun DEFAULT_EXPIRY() = Date(System.currentTimeMillis() + 1000 * 60 * 60);
|
||||
fun DEFAULT_EXPIRY() = Date(System.currentTimeMillis() + 1000 * 60 * 60 * 24 * 14);
|
||||
|
||||
suspend fun authenticateUser(application: Application, username: String, password: String): Ministrant? {
|
||||
println("Username $username password $password")
|
||||
|
||||
@@ -3,6 +3,7 @@ package de.walamana.views
|
||||
import de.walamana.models.GottesdienstGroup
|
||||
import de.walamana.models.GottesdienstGroupDao
|
||||
import de.walamana.models.GottesdienstGroups
|
||||
import de.walamana.plugins.getJWTEnvironment
|
||||
import de.walamana.service.PlanDao
|
||||
import io.ktor.server.application.*
|
||||
import io.ktor.server.auth.*
|
||||
@@ -14,12 +15,14 @@ import io.ktor.server.util.*
|
||||
|
||||
fun Route.configurePlanRoutes() {
|
||||
route("/plan") {
|
||||
get {
|
||||
val principal = call.principal<JWTPrincipal>()
|
||||
val isAnonymous = principal == null
|
||||
val id = call.parameters.getOrFail("id").toInt()
|
||||
val plan = PlanDao.constructPlan(id, isAnonymous = isAnonymous);
|
||||
call.respond(plan)
|
||||
authenticate {
|
||||
get {
|
||||
val principal = call.principal<JWTPrincipal>()
|
||||
val isAnonymous = principal == null
|
||||
val id = call.parameters.getOrFail("id").toInt()
|
||||
val plan = PlanDao.constructPlan(id, isAnonymous = isAnonymous);
|
||||
call.respond(plan)
|
||||
}
|
||||
}
|
||||
}
|
||||
route("/groups") {
|
||||
|
||||
Reference in New Issue
Block a user