Skip to content

Commit

Permalink
[minor]Replaced { in objects with :
Browse files Browse the repository at this point in the history
  • Loading branch information
amorfis committed Jan 22, 2025
1 parent c7b7fdf commit a150f93
Showing 1 changed file with 2 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ case class User(name: String)
case class LoggedInUser(user: User, csrfToken: UUID)

// Simple in-memory users database. Do not keep passwords in clear text in real projects!
object Users {
object Users:
private val usersToPassword = Map(
User("adam") -> "Scala Rulez!",
User("pawel") -> "Long live tAPIr!",
Expand All @@ -35,9 +35,8 @@ object Users {

def checkPassword(user: User, password: String): Boolean =
usersToPassword.get(user).contains(password)
}

object SessionManager {
object SessionManager:
private var sessions = Map.empty[UUID, LoggedInUser]

def createSession(user: User): UUID =
Expand All @@ -47,7 +46,6 @@ object SessionManager {
sessionId

def getLoggedInUser(sessionId: UUID): Option[LoggedInUser] = sessions.get(sessionId)
}

@main def csrfTokens(): Unit =
val SessionCookie = "SESSIONID"
Expand Down

0 comments on commit a150f93

Please sign in to comment.