1

In my model I have

 package models;

 import play.*;
 import play.data.validation.*;
 import play.db.jpa.*;
 import play.libs.*;
 import com.google.gson.JsonObject;
 import javax.persistence.*;
 import java.util.*;
 import play.mvc.*;
 public class User extends Model {
   public static void facebookOAuthCallback(JsonObject data){
    String email = data.get("email").getAsString();
    System.out.println(email);
    if(email!=null){
        Session session = new Session();
        session.put("user", user.email);
    }
 }
 }

When this action action is axecuted it gives the Session cannot be resolved into type. What I am doing wrong :(

Thanks in advance

Zoha Ali Khan
  • 1,659
  • 11
  • 37
  • 56

1 Answers1

5

Have you tried NOT putting this code in your Model, but instead putting it in your controller. Session is a controller concept, and I don't think it is a good idea mixing it with your Model.

Codemwnci
  • 54,176
  • 10
  • 96
  • 129
  • I am using fbconnect module for login with facebook. When the use click on the link he is edirected to facebook but when he returns from facebook with JSON Object which contains the user data it needs to execute this action which is in my model and I want to set the user session how can I pass the loggedin user email to my controller or putting it in a session inside a controller – Zoha Ali Khan Jul 12 '12 at 08:16