Skip to content

Instantly share code, notes, and snippets.

@adamw
Created July 16, 2019 14:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save adamw/382c3fc37f6d0acb03be33dd72f37634 to your computer and use it in GitHub Desktop.
Save adamw/382c3fc37f6d0acb03be33dd72f37634 to your computer and use it in GitHub Desktop.
def changePassword(userId: Id @@ User,
currentPassword: String,
newPassword: String): ConnectionIO[Unit] =
for {
user <- userOrNotFound(UserModel.findById(userId))
_ <- verifyPassword(user, currentPassword)
_ = logger.debug(s"Changing password for user: $userId")
_ <- UserModel.updatePassword(userId, User.hashPassword(newPassword))
} yield ()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment