public bool UserMailExists(string Email) { DALUsers dalUsers = new DALUsers(connectionString); User user = dalUsers.GetByEmail(Email); if (user is null) { return(false); } else { return(true); } }
public bool RecoverUserPassword(string Email) { if (!IsValidEmail(Email)) { return(false); } DALUsers dalUsers = new DALUsers(connectionString); User user = dalUsers.GetByEmail(Email); if (user is null) { return(false); } else { MailMessage email = new MailMessage(); email.From = new MailAddress("*****@*****.**"); email.To.Add(new MailAddress(user.Email.ToString())); email.Subject = "Wizball - Password Recover"; email.Body = "Dear " + user.Username + "," + Environment.NewLine + Environment.NewLine; email.Body += "You recently filed a password recovery request." + Environment.NewLine + Environment.NewLine; email.Body += "As requested, we send your account information and strongly recommend you to change your password." + Environment.NewLine + Environment.NewLine + Environment.NewLine; email.Body += "Account information:" + Environment.NewLine; email.Body += " - Username: "******" - Password: "******" - Email: " + user.Email + Environment.NewLine + Environment.NewLine + Environment.NewLine; email.Body += "If you did not requested this information, we highly recommend you to change your password." + Environment.NewLine; email.Body += "You can also contact us to solve the problem." + Environment.NewLine + Environment.NewLine; email.Body += "We work hard every day so you can always have the results you want in your bets." + Environment.NewLine + Environment.NewLine; email.Body += "Our best regards," + Environment.NewLine; email.Body += "Wizball support team"; SendEmail(email); return(true); } }