public void SendConstantBanEmail(Context context) { var query = (from code in context.VerificationCodes where code.UserId == Id orderby code.CodeId descending select code.CodeId).ToList()[0]; if (Email == null) { Email = new EmailStruct(context, Id); } var otp = new Cryptography(); var password = new PasswordStruct() { UserId = Id, Password = otp.Key, Temporary = true, }; password.Save(context); var body = "Your account was locked and your password was reset.\n\n" + "Your new one-time password: "******"\n\n" + "Use it to enter the system again."; Mail.Send(Email.Email, body); }
/// <summary> /// Fetch all valid data for user's login. /// </summary> /// <param name="context"></param> /// <param name="login"></param> public UserStruct(Context context, string login) { Login = login; GetUserItem(context); Password = new PasswordStruct(context, Id); Email = new EmailStruct(context, Id); }
public void SaveNewPassword(Context context, PasswordStruct password) { Password.UserId = Id; Password.Save(context); }