예제 #1
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            DB.User user = DB.User.Get(CurrentUser.ID);

            if (user.Email != editEmail.Text)
            {
                DB.User user2 = DB.User.GetByFieldValue <string>("Email", editEmail.Text);
                if (user2 != null)
                {
                    lblMessage.Text    = "Email already registered";
                    lblMessage.Visible = true;
                    return;
                }
            }

            user.Email = editEmail.Text;
            user.Name  = editName.Text;

            if (!string.IsNullOrEmpty(editPassword.Text))
            {
                if (editPassword.Text != editPasswordConfirm.Text)
                {
                    lblMessage.Text    = "Please confirm password";
                    lblMessage.Visible = true;
                    return;
                }

                user.Password = editPassword.Text;
            }

            user = user.Save();
            FormsAuthentication.SetAuthCookie(user.Email, cbRememberMe.Checked);
            Response.Redirect(".");
        }
예제 #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string tokenStr = Request.QueryString["token"];
            Guid   token    = Guid.Parse(tokenStr);

            Object userEmailCacheEntry = Cache["PASSWORD_RESET_TOKEN_" + token.ToString()];

            if (userEmailCacheEntry == null)
            {
                Response.Redirect("Message.aspx?ID=PasswordResetTokenExpired&link=PasswordForgot.aspx");
                return;
            }

            string userEmail = userEmailCacheEntry.ToString();

            user = DB.User.GetByFieldValue("Email", userEmail);
            if (user == null)
            {
                // should not happen
                Response.Redirect("Message.aspx?ID=PasswordResetEmailNotFound&link=PasswordForgot.aspx");
                return;
            }

            lblEmail.Text = user.Email;
        }
예제 #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                DB.User user = DB.User.Get(CurrentUser.ID);

                editEmail.Text = user.Email;
                editName.Text  = user.Name;
            }
        }