/// <summary> /// GetBasicUserProfile function, returns basic user profile data for user. /// </summary> /// <returns>returns BasicUserLoginRadiusUserProfile</returns> public BasicUserLoginRadiusUserProfile GetBasicUserProfile() { BasicUserLoginRadiusUserProfile userprofile = (BasicUserLoginRadiusUserProfile)Newtonsoft.Json.JsonConvert.DeserializeObject(Resonse, typeof(BasicUserLoginRadiusUserProfile)); SetIsAuthenticated(userprofile); return(userprofile); }
private static void LoginRadiusLogin(BasicUserLoginRadiusUserProfile userprofile) { //genarate password string password = Guid.NewGuid().ToString(); //create user Membership.CreateUser(userprofile.ID, password, userprofile.Email[0].Value); //roles Roles.AddUserToRole(userprofile.ID, "Commentor"); //user profile var pf = AuthorProfile.GetProfile(userprofile.ID) ?? new AuthorProfile(userprofile.ID); DateTime birthdate = new DateTime(); DateTime.TryParse(userprofile.BirthDate ?? "", out birthdate); pf.Birthday = birthdate; pf.DisplayName = userprofile.ProfileName ?? ""; pf.EmailAddress = userprofile.Email[0].Value ?? ""; pf.FirstName = userprofile.FirstName ?? ""; pf.LastName = userprofile.LastName ?? ""; pf.MiddleName = userprofile.MiddleName ?? ""; pf.Save(); //set logged in user Security.AuthenticateUser(userprofile.ID, password, false); FormsAuthentication.SetAuthCookie(userprofile.ID, false /* createPersistentCookie */); }
protected void btn_submitemail_click(object sender, EventArgs e) { if (Page.IsValid) { if (!string.IsNullOrEmpty(txt_email.Text)) { var userprofile = new BasicUserLoginRadiusUserProfile(); userprofile.ID = hdID.Value; userprofile.BirthDate = hdBirthDate.Value; userprofile.Email = new List<LoginRadiusEmail>(); userprofile.Email.Add(new LoginRadiusEmail() { Type = "Primary", Value = txt_email.Text }); userprofile.FirstName = hdFirstName.Value; userprofile.LastName = hdLastName.Value; userprofile.MiddleName = hdMiddleName.Value; userprofile.ProfileName = hdProfileName.Value; LoginRadiusLogin(userprofile); PopupVisiblity(false); } } else { PopupVisiblity(true); } }