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 SendPermanentBanEmail(Context context) { if (Email == null) { Email = new EmailStruct(context, Id); } var hours = AppConfigurations.PermanentBanTimeHours; var minutes = AppConfigurations.PermanentBanTimeMinutes; var seconds = AppConfigurations.PermanentBanTimeSeconds; var unlocktime = DateTime.Now.Add(new TimeSpan(hours, minutes, seconds)); var body = "Your account was permanently locked. Please, wait " + hours + "h " + minutes + "m " + seconds + "s and try login again.\n" + "Your account will be unlocked at " + unlocktime + "."; Mail.Send(Email.Email, body); }