当前位置: 动力学知识库 > 问答 > 编程问答 >

scala - securesocial (2.1.X): how to save username/password to a database?

问题描述:

I'd like to save the user information to a database, such as username, email, password (or even hash value if I can't get the password). Then I checked the sample app below, but there is no password information. If no password, then how to save it to database?

https://github.com/jaliss/securesocial/blob/2.1.x/samples/scala/demo/app/service/InMemoryUserService.scala

网友答案:

Finally I found the hashed password is stored in Identity, we could catch it in the function of save() when change the password or create a new user. We could add the logic to store them in database. BTW, I am using email/password to do authorization, not facebook or google OAuth.

def save(user: Identity): Identity = {
    // first see if there is a user with this Identity already.
    val pwd:String=user.passwordInfo.get.password
    val hasher:String=user.passwordInfo.get.hasher
    val salt:Option[String]=user.passwordInfo.get.salt
分享给朋友:
您可能感兴趣的文章:
随机阅读: