Exemplo n.º 1
0
 protected void Button2_Click(object sender, EventArgs e)
 {
     CMSUser user = new CMSUser();
     if (TypedPassword == TypedPassword2)
     {
         user.FirstName = txtFName.Text;
         user.LastName = txtLName.Text;
         user.Username = txtUsername.Text;
         user.Password = TypedPassword.GetHashCode().GetHashCode();
         user.Role = "Registered User";
         user.DateOfBirth = Calendar1.SelectedDate;
         user.Email = txtEmail.Text;
         user.FacebookId = txtFacebook.Text;
         user.TwitterId = txtTwitter.Text;
         user.CreateUserinDb();
         lblConfrm.Text = "";
         Response.Redirect("home.aspx");
     }
     else
         lblConfrm.Text = "Passwords does not match";
 }
Exemplo n.º 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //detect if password was changed. if filled and not equal to mask, it is new
            if (txtPassword.Text.Trim().Length > 0 && txtPassword.Text != PasswordMask)
            {
                TypedPassword = txtPassword.Text;
                txtPassword.Attributes.Add("value", PasswordMask);
                TypedPassword2 = txtConfirmPassword.Text;
                txtConfirmPassword.Attributes.Add("value", PasswordMask);
            }
            txtPassword.Attributes.Add("onclick", "Clear_Password('" + txtPassword.ClientID + "')");
            txtConfirmPassword.Attributes.Add("onclick", "Clear_Password('" + txtConfirmPassword.ClientID + "')");

            if (!ClientScript.IsClientScriptBlockRegistered("Clear_Password"))
            {
                ClientScript.RegisterClientScriptBlock(typeof(string), "Clear_Password", "function Clear_Password(id){ try{document.getElementById(id).value = '';} catch(ex){/* do nothing */} }", true);
            }
            if (IsPostBack)
                return;
            HttpCookie cookie = Request.Cookies["ejas_login"];

            if (cookie != null)
            {
                userid = Convert.ToInt32(cookie["userid"]);
                //btnLoginb.Text = "Logout";
            }
            user=new CMSUser();
            user.GetUserbyId(userid);
            txtUsername.Text = user.Username;
            txtFName.Text = user.FirstName;
            txtLName.Text = user.LastName;
            txtEmail.Text = user.Email;
            txtFacebook.Text = user.FacebookId;
            txtTwitter.Text = user.TwitterId;
            txtDob.Text = user.DateOfBirth.ToString();
        }