Пример #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!String.IsNullOrEmpty(Request.QueryString["code"]))
        {
            fb = new FacebookCode(siteDefaults.FbClientId, siteDefaults.FbClientSecret, fbUrl);
            using (MySqlConnection conn = new MySqlConnection(siteDefaults.ConnStr))
            {
                if (fb != null && fb.fbUser != null)
                {
                    conn.Open();
                    int loginID = LoginUser.InsertUpdateLoginUser(fb, conn);
                    Session["login"]          = "******";
                    Session["userId"]         = loginID;
                    Session["Logged"]         = "Yes";
                    Session["LoggedUserMail"] = fb.fbUser.email;

                    conn.Close();
                    Page.ClientScript.RegisterStartupScript(GetType(), "closePopup", "window.opener.socialLogin('" + fb.fbUser.id + "','" + fb.fbUser.picture + "','" + fb.fbUser.first_name + "'); window.close();", true);
                }
                else
                {
                    Response.Write("has no fb user");
                }
            }
        }
        else
        {
            fb = new FacebookCode(siteDefaults.FbClientId, siteDefaults.FbClientSecret);
            fb.LoginClick(fbUrl, "user_hometown,email,user_location");
        }
    }
Пример #2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!String.IsNullOrEmpty(Request.QueryString["code"]))
        {
            fb = new FacebookCode(siteDefaults.FbClientId, siteDefaults.FbClientSecret, fbUrl);
            using (MySqlConnection conn = new MySqlConnection(siteDefaults.ConnStr))
            {
                if (fb != null && fb.fbUser != null)
                {
                    conn.Open();
                    //int loginID = LoginUser.InsertUpdateLoginUser(fb, conn); // Talal - you need to change the method so it will insert all the details requiered.
                    Session["login"]  = "******";
                    Session["userId"] = fb.fbUser.id;
                    Session["token"]  = fb.fbUser.tmpToken;

                    //Response.Write(fb.fbUser.id);

                    //Session["userId"] = loginID;
                    Session["Logged"] = "Yes";
                    conn.Close();

                    Page.ClientScript.RegisterStartupScript(GetType(), "closePopup", "window.opener.socialLoginAdmin('" + fb.fbUser.tmpToken + "'); window.close();", true);
                }
                else
                {
                    Response.Write("has no fb user");
                }
            }
        }
        else
        {
            fb = new FacebookCode(siteDefaults.FbClientId, siteDefaults.FbClientSecret);
            fb.LoginClick(fbUrl, "user_hometown,email,user_location,manage_pages,publish_stream,read_insights");
        }
    }
Пример #3
0
    protected void RegisterFBLinkButton_Click(object sender, EventArgs e)
    {
        Session["login"] = null;
        Session["id"]    = null;
        if (!String.IsNullOrEmpty(Request.QueryString["special"]) && Request.QueryString["special"] == "true")
        {
            Session["SanFransisco"] = "true";
        }

        if (Request.QueryString != null && Request.QueryString["grp"] != null && Request.QueryString["grp"] != "")
        {
            HttpCookie cookieGrp = new HttpCookie("JoinUsGroup");
            cookieGrp.Value   = Request.QueryString["grp"];
            cookieGrp.Expires = DateTime.Now.AddMinutes(2.5);
            Response.SetCookie(cookieGrp);
        }

        if (Session["login"] == null && Session["id"] == null)
        {
            fb = new FacebookCode(siteDefaults.FbClientId, siteDefaults.FbClientSecret);

            //Response.Redirect("http://comstar.co/?aa=aaa");

            fb.LoginClick(fbUrl, "user_hometown,email,user_location");
        }
    }
Пример #4
0
 protected void SignByFaceLinkButton_Click(object sender, EventArgs e)
 {
     using (MySqlConnection conn = new MySqlConnection(cmstrDefualts.ConnStr))
     {
         conn.Open();
         fb = new FacebookCode(siteDefaults.FbClientId, siteDefaults.FbClientSecret);
         fb.LoginClick(fbUrl, "user_hometown,email,user_location");
         Badge.AddBadge(BadgTypeEnum.Join, conn, Session["LoggedUserMail"].ToString());
     }
 }
Пример #5
0
    protected void RegisterFBLinkButton_Click(object sender, EventArgs e)
    {
        Session["login"] = null;
        Session["id"]    = null;

        if (Session["login"] == null && Session["id"] == null)
        {
            fb = new FacebookCode(siteDefaults.FbClientId, siteDefaults.FbClientSecret);

            //Response.Redirect("http://comstar.co/?aa=aaa");

            fb.LoginClick(fbUrl, "user_hometown,email,user_location");
        }
    }
Пример #6
0
 protected void RegisterFBLinkButton_Click(object sender, EventArgs e)
 {
     fb = new FacebookCode(siteDefaults.FbClientId, siteDefaults.FbClientSecret);
     fb.LoginClick(fbUrl, "user_hometown,email,user_location");
 }