Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Kasun 8 posts 77 karma points
    Apr 29, 2016 @ 02:08
    Kasun
    0

    Facebook Login For Members

    Hi,

    I have created a custom login for users to log using their facebook credentials. After I get the details, send them to a custom Action Method "RegisterFacebookTemplate" in my MVC application. Then I save the member using umbraco Member API.

    My problem is after I save the new member to the Database, It will not update the site with logged member.

    my action method is as below,

    [HttpPost]
        public ActionResult RegisterFacebookTemplate(string Oid)
        {
            if (Member.GetMemberFromEmail("[email protected]") == null)
            {
                MemberType memberType = MemberType.GetByAlias("customMember");
    
                Member newMember = Member.MakeNew("yohan", memberType, new umbraco.BusinessLogic.User(0));
    
                newMember.Email = "[email protected]";
                newMember.Password = "12345678";
                newMember.LoginName = "yohan";
    
                newMember.getProperty("gender").Value = "Male"; //set value of property with alias 
                newMember.getProperty("age").Value = "31"; //set value of property with alias 
    
                newMember.Save();
    
                Response.Cookies.Remove(FormsAuthentication.FormsCookieName);
                FormsAuthentication.SetAuthCookie("yohan", false);
            }
            return RedirectToRoute("/");
        }
    
Please Sign in or register to post replies

Write your reply to:

Draft