esme-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rhir...@apache.org
Subject svn commit: r887795 - /incubator/esme/trunk/server/src/main/scala/org/apache/esme/model/UserAuth.scala
Date Sun, 06 Dec 2009 23:06:46 GMT
Author: rhirsch
Date: Sun Dec  6 23:06:46 2009
New Revision: 887795

URL: http://svn.apache.org/viewvc?rev=887795&view=rev
Log:
[ESME-111] OpenID login/signon is broken
Patch from Ethan Jewett applied


Modified:
    incubator/esme/trunk/server/src/main/scala/org/apache/esme/model/UserAuth.scala

Modified: incubator/esme/trunk/server/src/main/scala/org/apache/esme/model/UserAuth.scala
URL: http://svn.apache.org/viewvc/incubator/esme/trunk/server/src/main/scala/org/apache/esme/model/UserAuth.scala?rev=887795&r1=887794&r2=887795&view=diff
==============================================================================
--- incubator/esme/trunk/server/src/main/scala/org/apache/esme/model/UserAuth.scala (original)
+++ incubator/esme/trunk/server/src/main/scala/org/apache/esme/model/UserAuth.scala Sun Dec
 6 23:06:46 2009
@@ -213,7 +213,8 @@
               RedirectResponse(from, S responseCookies :_*)
 
             case (Full(id), _) =>
-              S.error(S.?("base_user_err_openid_not_reg",id.getIdentifier()))
+              findOrCreate(id.getIdentifier())
+              //S.error(S.?("base_user_err_openid_not_reg",id.getIdentifier()))
               RedirectResponse(from, S responseCookies :_*)
 
 
@@ -245,11 +246,12 @@
   }
   
   def findOrCreate(openId: String): User =
-  UserAuth.find(By(UserAuth.authType, moduleName), By(UserAuth.authKey, openId)).flatMap(_.user.obj)
match {
-    case Full(user) => user
-    case _ => val user = User.createAndPopulate
-      UserAuth.create.authType(moduleName).user(user).authKey(openId).save
-      user
+    UserAuth.find(By(UserAuth.authType, moduleName), By(UserAuth.authKey, openId)).flatMap(_.user.obj)
match {
+      case Full(user) => user
+      case _ => val user = User.createAndPopulate.nickname(openId).saveMe
+        UserAuth.create.authType(moduleName).user(user).authKey(openId).save
+        User.logUserIn(user)
+        user
   }
 
   def unapply(openId: Identifier): Option[User] =



Mime
View raw message