protected void btnResetPassword_Click(object sender, EventArgs e) { acc.changePassword(txtPassword.Text); new AccountDataManager().updateAccount(acc); lblMessage.Text = "Reset password successfully. " + "Please login <a href=\"/Account/Signin.aspx\">here</a>"; }
protected void _btnSignup_Click(object sender, EventArgs e) { acc.email = txtEmail.Text; if (!new AccountDataManager().doesEmailExist(acc.email)) { acc.changePassword(txtPassword.Text); acc.id = new AccountDataManager().createAccount(acc); Token token = new Token(); new AccountDataManager().setToken(acc, token); sendActivationEmail(acc.id, token.token); lblMessage.Text = "Signed up successfully. Please check your mailbox to activate your account"; lblMessage.ForeColor = System.Drawing.Color.Blue; Response.Cookies["userid"].Value = acc.id.ToString(); //Response.Redirect("~/TimetablePages/Timetable.aspx"); } else { lblMessage.Text = "This email has already existed. Please try another one."; lblMessage.ForeColor = System.Drawing.Color.Red; } }
protected void btnChangePassword_Click(object sender, EventArgs e) { currentPassword = txtCurPassword.Text; newPassword = txtPassword.Text; DataRow dr = new AccountDataManager().getAccount(acc.id); acc.email = dr["email"].ToString(); acc.hashed_password = dr["password"].ToString(); acc.salt = dr["salt"].ToString(); if (acc.validatePassword(currentPassword)) { acc.changePassword(newPassword); new AccountDataManager().updateAccount(acc); lblMessage.Text = "Changed password successfully"; lblMessage.ForeColor = System.Drawing.Color.Blue; } else { lblMessage.Text = "Incorrect current password"; lblMessage.ForeColor = System.Drawing.Color.Red; } }