I think you could remove the User class/object pair from the app and replace
them with:
object LoginState {
  object primaryKey extends SessionVar[Box[Long]](Empty) // the primary key
of the currently logged in user... change to Box[String] if the PK is a
String
  object currentUser extends
RequestVar[Box[YourUserClass]](primaryKey.is.flatMap(key =>
lookupUser(key)))

  def logUserIn(u: YourUserClass) {
    currentUser.remove()
    primaryKey.set(Full(u.getPrimaryKey))
  }

  def logUserOut() {
    currentUser.remove()
    primaryKey.remove()
    S.request.foreach(_.request.getSession.invalidate)
  }

  def loggedIn_? = primaryKey.is.isDefined
}

On Thu, Aug 6, 2009 at 8:20 PM, turp1twin <turp1t...@gmail.com> wrote:

>
> I am new to Lift and have a "newbie" question. I have searched the
> group and have not really found an answer to my question. I was hoping
> for some pointers on implementing custom Login logic. I am currently
> looking at the MetaMegaProtoUser code and am trying sort out what I
> will need. I have no need for scaffolding, and am using an existing DB
> with client access through Hibernate/JPA classes. I can sort out the
> DB access, etc., I am just getting a bit overwhelmed trying to figure
> what bits I need to replicate from MetaMegaProtoUser, if any. I know
> it does quite a bit... Anyways, it is probably staring me right in the
> face... and I am just being dense... but any pointers would be
> appreciated! I am loving Scala and am really enjoying learning Lift,
> really cool work guys! Cheers!
>
>
> Jeff
>
> >
>


-- 
Lift, the simply functional web framework http://liftweb.net
Beginning Scala http://www.apress.com/book/view/1430219890
Follow me: http://twitter.com/dpp
Git some: http://github.com/dpp

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to