I have following code in a snippet SignInController as follows that should redirect to a new view. But it only shows "The Requested URL /home was not found on this server"
import code.model.User
import net.liftweb.mapper.By
import net.liftweb.common.Loggable
import scala.xml.NodeSeq
import net.liftweb.common.Full
import net.liftweb.http.S
import net.liftweb.util.PassThru
import net.liftweb._
import http._
import util.Helpers._
object SignInController{
def render = {
var username = ""
var password=""
def process() {
val userList: List[User] = User.findAll(By(User.username, username))
for( u <- userList )
{
if(u.password.equals(password))
{
S.redirectTo("/home")
}
}
}
"name=username" #> SHtml.text(username, username = _) &
"name=password" #> SHtml.password(password, password = _) &
// when the form is submitted, process the variable
"type=submit" #> SHtml.onSubmitUnit(process)
}
}
I dont have idea how to redirect to a view page from snippet in scala liftweb
Is '/home' defined in your menu? If not, it won't be accessible and I believe you'll get that message.
On an unrelated but probably more important note: Are you aware of the significant issues with this approach to password management and authentication?