Created
January 18, 2012 20:02
-
-
Save joegaudet/1635207 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def setSession(user: User) = setCookie(generateSessionString(user), SessionValidity.inSeconds) | |
def setSession(userOption: Option[User]) = userOption.map(user => setCookie(generateSessionString(user), SessionValidity.inSeconds)) | |
def clearSession = cookies.delete("MatygoSession") | |
private def setCookie(cookieString: String, expiry: Int) = { | |
println("Setting cookie"); | |
try { | |
cookies.update("MatygoSession", params(cookieString))(CookieOptions(maxAge = expiry, path = "/")) | |
} | |
catch { | |
case e => e.printStackTrace() | |
} | |
cookieString | |
println("Cookie String: " + cookieString); | |
cookieString | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment