Created
August 17, 2016 17:08
-
-
Save piercelamb/aa4443834997633ff7c24cbff9022fd0 to your computer and use it in GitHub Desktop.
This file contains 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 addNewAccount(email: String, password: String, firstName: String, role: Role)(implicit s: DBSession = auto) { | |
val id = withSQL { | |
val pass = BCrypt.hashpw(password, BCrypt.gensalt()) | |
QueryDSL.insert.into(Account).namedValues( | |
ac.email -> email, | |
ac.password -> pass, | |
ac.name -> firstName, | |
ac.role -> role.toString() | |
) | |
}.updateAndReturnGeneratedKey.apply() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment