Now I have issue with authentication mechanism. I have entered the following code:
package code
package snippet
import net.liftweb.http._
import scala.xml.{NodeSeq, Text}
import net.liftweb.util._
import net.liftweb.common._
import code.lib._
import Helpers._
import code.model.User
class Authentication {
var user: User = new User
var email: String = _
var password: String = _
def authform(xhtml: NodeSeq): NodeSeq = {
bind("auth", xhtml,
"email" --> S.text(S.param("email").openOr(""), email = _) %
("size" -> "10") % ("id" -> "email"),
"password" --> S.password("", password = _) % ("size" -> "10") %
("id" -> "password"),
"submit" --> S.submit(S.?("Send"), ignore => authenticate)
)
}
def authenticate = {
User.find(By(User.email, email)) match {
case Full(dbuser) if (dbuser.password.match_?(password)) => User.logUserIn(dbuser)
case Full(dbuser) => error("wrong password")
case Empty => notice("sending verification mail")
}
}
}
[info] Source analysis: 1 new/modified, 0 indirectly invalidated, 0 removed.
[info] Compiling main sources...
[error] C:\Users\WYG\Desktop\lift_basic\src\main\scala\code\snippet\Authentication.scala:19: value t
ext is not a member of object net.liftweb.http.S
[error] "email" --> S.text(S.param("email").openOr(""), email = _) %
[error] ^
[error] C:\Users\WYG\Desktop\lift_basic\src\main\scala\code\snippet\Authentication.scala:28: not fou
nd: value By
[error] User.find(By(User.email, email)) match {
[error] ^
[error] C:\Users\WYG\Desktop\lift_basic\src\main\scala\code\snippet\Authentication.scala:29: value p
assword is not a member of Any
[error] case Full(dbuser) if (dbuser.password.match_?(password)) => User.logUserIn(dbuser)
[error] ^
[error] C:\Users\WYG\Desktop\lift_basic\src\main\scala\code\snippet\Authentication.scala:29: type mi
smatch;
[error] found : Any
[error] required: code.model.User.TheUserType
[error] case Full(dbuser) if (dbuser.password.match_?(password)) => User.logUserIn(dbuser)
[error] ^
[error] C:\Users\WYG\Desktop\lift_basic\src\main\scala\code\snippet\Authentication.scala:31: not fou
nd: value notice
[error] case Empty => notice("sending verification mail")
[error] ^
[error] 5 errors found
[info] == compile ==
[info]
[info] == copy-resources ==
[info] == copy-resources ==
[error] Error running compile: Compilation failed
[info]
Any hint what I'm doing wrong and how to fix it?