You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello!
First of all thank you for a great plugin!
I'm trying to implement my own hasher but I'm getting a pretty strange error.
My Hasher:
class MyPasswordHasher(app : Application) extends PasswordHasher {
def hash(plainPassword: String): PasswordInfo = {
PasswordInfo("my_hasher", MD5(plainPassword + "tut"), Some("tut"))
}
def matches(passwordInfo: PasswordInfo, suppliedPassword: String): Boolean = {
val hp = MD5(suppliedPassword + passwordInfo.salt.get)
passwordInfo.password == hp
}
def id: String = "my_hasher"
def MD5(s : String) = {
val bytes = MessageDigest.getInstance("MD5").digest(s.getBytes());
bytes.map{ b => String.format("%02X", new java.lang.Integer(b & 0xff)) }.mkString
}
}
Check the log that the hasher is loaded:
[info] application - [securesocial] loaded user service: class services.MyDbUserService
[info] application - [securesocial] loaded password hasher my_hasher
Then I do the signup flow and I get:
[debug] application - [securesocial] trying sign up with token 3551e792-711e-427a-b819-b649d92646d9
[error] application - [securesocial] can't find password hasher for id bcrypt
[error] play - Cannot invoke the action, eventually got an error: java.util.NoSuchElementException: None.get
[error] application -
! @6dg5l2col - Internal server error, for (POST) [/signup/3551e792-711e-427a-b819-b649d92646d9] ->
play.api.Application$$anon$1: Execution exception[[NoSuchElementException: None.get]]
at play.api.Application$class.handleError(Application.scala:289) ~[play_2.10.jar:2.1.0]
at play.api.DefaultApplication.handleError(Application.scala:383) [play_2.10.jar:2.1.0]
at play.core.server.netty.PlayDefaultUpstreamHandler$$anonfun$handleAction$1$4$$anonfun$apply$28.apply(PlayDefaultUpstreamHandler.scala:391) [play_2.10.jar:2.1.0]
at play.core.server.netty.PlayDefaultUpstreamHandler$$anonfun$handleAction$1$4$$anonfun$apply$28.apply(PlayDefaultUpstreamHandler.scala:391) [play_2.10.jar:2.1.0]
at scala.Option.map(Option.scala:145) [scala-library.jar:na]
at play.core.server.netty.PlayDefaultUpstreamHandler$$anonfun$handleAction$1$4.apply(PlayDefaultUpstreamHandler.scala:391) [play_2.10.jar:2.1.0]
java.util.NoSuchElementException: None.get
at scala.None$.get(Option.scala:313) ~[scala-library.jar:na]
at scala.None$.get(Option.scala:311) ~[scala-library.jar:na]
at securesocial.core.Registry$$anon$1.currentHasher$lzycompute(Registry.scala:60) ~[securesocial_2.10-master-SNAPSHOT.jar:master-SNAPSHOT]
at securesocial.core.Registry$$anon$1.currentHasher(Registry.scala:60) ~[securesocial_2.10-master-SNAPSHOT.jar:master-SNAPSHOT]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.6.0_37]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) ~[na:1.6.0_37]
Hmm why do I get [error] application - [securesocial] can't find password hasher for id bcrypt
Ok let's try to change the name from my_hasher to bcrypt
[info] application - [securesocial] loaded user service: class services.MyDbUserService
[info] application - [securesocial] loaded password hasher bcrypt
[debug] application - [securesocial] trying sign up with token 8c3852fd-fc54-46fb-82bd-efeb1d83a40d
[info] application - Some(PasswordInfo(bcrypt,10B88F75651BD2973904799EB7DCA5A4,Some(tut)))
And it works... The salt, md5 and db save
What am I missing here? Is there something that I have forgotten to implement?
The text was updated successfully, but these errors were encountered:
Did you set the securesocial.userpass.hasher property to "my_hasher"? That property specifies the hasher that will be used in new registrations or password changes. You can add several hashers in the play.plugins file, but the one specified with that property is the default. This allows for easy migration if you need to change the algorithm.
Hello!
First of all thank you for a great plugin!
I'm trying to implement my own hasher but I'm getting a pretty strange error.
My Hasher:
Check the log that the hasher is loaded:
Then I do the signup flow and I get:
Hmm why do I get [error] application - [securesocial] can't find password hasher for id bcrypt
Ok let's try to change the name from my_hasher to bcrypt
And it works... The salt, md5 and db save
What am I missing here? Is there something that I have forgotten to implement?
The text was updated successfully, but these errors were encountered: