Exemplo n.º 1
0
        public ActionResult ConfirmSignup(String token)
        {
            if (String.IsNullOrEmpty(token))
            {
                return(RedirectToAction("Index", "Home"));
            }
            else
            {
                Member _member = rpMember.FindFirst(m => m.confirm_token == token && m.is_active == false);
                if (_member != null)
                {
                    string decryptedText = Security.Decrypt(token, true);

                    string password = decryptedText.Split('*')[3];

                    if (!string.IsNullOrEmpty(password))
                    {
                        string public_id = Security.GenerateMd5(_member.id + "_" + _member.username);
                        _member.is_active     = true;
                        _member.confirm_token = null;
                        _member.public_id     = public_id;
                        rpMember.Edit(_member);

                        NotifyMember.LoginInformation(_member.email, _member.username, password);

                        Directory.CreateDirectory(Server.MapPath("~/App_Data") + "\\" + public_id);
                        return(View("Success", new MessageView()
                        {
                            Message = "Your account has been activated successfully"
                        }));
                    }
                    else
                    {
                        return(View("Success", new MessageView()
                        {
                            Message = "Please try this link later"
                        }));
                    }
                }
            }
            return(RedirectToAction("Index", "Home"));
        }