protected void btnChangePassword_Click(object sender, EventArgs e) { try { if (checkValues()) { string status = new UserBL().ChangePassword(User.Identity.Name, txtPassword.Text, txtNewPassword.Text); divStatus.Visible = true; lblStatus.Text = status; divStatus.Attributes["class"] = "status success"; } else { divStatus.Visible = true; lblStatus.Text = "Morate uneti podatke. Polje 'Nova šifra' i 'Nova šifra ponovo' moraju da budu identična."; divStatus.Attributes["class"] = "status danger"; } } catch (BLException ex) { divStatus.Visible = true; lblStatus.Text = ex.Message; divStatus.Attributes["class"] = "status danger"; } }
private bool validToken(string token) { User user = new UserBL().GetUserFromToken(token); if (user != null) { txtUsername.Text = user.Username; lblUserID.Value = user.UserID.ToString(); return true; } return false; }
public static string CheckEmail(string email) { bool exists = new UserBL().UserExists(email); return JsonConvert.SerializeObject(exists); }