Skip to content

Instantly share code, notes, and snippets.

@mattroberts297
Last active January 4, 2019 20:07
Show Gist options
  • Save mattroberts297/f10d5c004cec2bc71804a24052638be9 to your computer and use it in GitHub Desktop.
Save mattroberts297/f10d5c004cec2bc71804a24052638be9 to your computer and use it in GitHub Desktop.
SignupInfra.scala
def signup
(request: HttpRequest): Future[HttpResponse] =
for {
r <- parse(request)
_ = info(“Parsed body”)
s <- salt(512)
_ = info(“Created salt”)
h <- hash(r.p, s, 10000)
_ = info(“Created hash”)
u = User(r.e, h, s)
_ <- persist(u)
// JVM crashes because it ran out of memory
_ = info(“Persisted user”)
} yield { HttpResponse(StatusCodes.OK) }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment