예제 #1
0
        public ActionResult SimpleRegistrationFinish(SimpleRegistration model)
        {
            if (!ModelState.IsValid)
            {
                return(View("SimpleRegistration", model));
            }

            try
            {
                var user = UserService.CreateUser(model.Name, model.LastName, model.Email, model.Password,
                                                  model.TimeShiftFromUtc);

                FormsAuthentication.SetAuthCookie(model.Email, true);
                //store user data
                SessionStorage.User = new UserSessionInfo
                {
                    Id                 = user.Id,
                    UserName           = user.Name,
                    HoursOffsetFromUtc = user.HoursOffsetFromUtc,
                    AccountType        = user.AccountType
                };

                //create first default workspace
                new WorkspaceService().Create(user.Email + "-workspace", user);

                TempData["SuccessMessage"] = "Your account has been created!";
                return(RedirectToAction("Index", "Workspace"));
            }
            catch (Exception ex)
            {
                TempData["ErrorMessage"] = ex.Message;
                return(View("SimpleRegistration", model));
            }
        }
예제 #2
0
        protected void OpenIDButtonClick(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(this.TxtOpenID.Text))
            {
                OpenIdClient openID = new OpenIdClient();
                openID.Identity            = this.TxtOpenID.Text;
                UserProfile.Current.OpenID = openID.Identity;
                UserProfile.Current.Save();

                SimpleRegistration simpleRegistration = new SimpleRegistration(openID);
                simpleRegistration.RequiredFields = "nickname,email";
                simpleRegistration.OptionalFields = "fullname,gender";

                openID.CreateRequest(false, true);
            }
            else
            {
                LitOpenIDMsg.Text = language.GetString("MessageOpenIDMissing");
            }
        }
예제 #3
0
        public void SimpleRegistrationExecution()
        {
            var cut = new SimpleRegistration();

            cut.ExecuteExample();
        }