public static void LoadParameters(IContext context) { var parameterRepository = new ParameterRepository(context); APP_NAME = parameterRepository.GetValueByKey(APP_NAME_KEY); FILE_STORAGE = parameterRepository.GetValueByKey(FILE_STORAGE_KEY); DAEMON_USER = parameterRepository.GetValueByKey(DAEMON_USER_KEY); BASE_URL = parameterRepository.GetValueByKey(BASE_URL_KEY); }
public void SendRecoverPasswordNotification(string email, string recoveredPassword) { var userRepository = new UserRepository(_context); var user = userRepository.GetByEmail(email); var parameterRepository = new ParameterRepository(_context); var body = Resource.PasswordRecoveryEmailBody .Replace("{username}", user.Name) .Replace("{login}", email) .Replace("{password}", recoveredPassword) .Replace("{link}", Parameter.BASE_URL); var message = new MailMessage(); message.To.Add(email); message.From = new MailAddress(parameterRepository.GetValueByKey(Parameter.EMAIL_FROM_KEY), Parameter.APP_NAME); message.Subject = Resource.PasswordRecoveryEmailSubject; message.IsBodyHtml = true; message.Body = body; _sender.Send(message); }
internal void SendCreatingUserNotiication(User user, string password) { var parameterRepository = new ParameterRepository(_context); var body = Resource.CreatingUserNotificationEmailBody .Replace("{username}", user.Name) .Replace("{login}", user.Login) .Replace("{password}", password) .Replace("{link}", Parameter.BASE_URL); var message = new MailMessage(); message.To.Add(user.Email); message.From = new MailAddress(parameterRepository.GetValueByKey(Parameter.EMAIL_FROM_KEY), Parameter.APP_NAME); message.Subject = Resource.CreatingUserNotificationEmailSubject; message.IsBodyHtml = true; message.Body = body; //var client = new SmtpClient(parameterRepository.GetValueByKey(Parameter.SMTP_SERVER_KEY), System.Convert.ToInt32(parameterRepository.GetValueByKey(Parameter.SMTP_PORT_KEY))) //{ // Credentials = new NetworkCredential(parameterRepository.GetValueByKey(Parameter.EMAIL_FROM_KEY), parameterRepository.GetValueByKey(Parameter.SMTP_PASSWORD_KEY)), // EnableSsl = true //}; //client.Send(parameterRepository.GetValueByKey(Parameter.EMAIL_FROM_KEY), user.Email, Resource.CreatingUserNotificationEmailSubject, body); _sender.Send(message); }
public AuthenticationService(IContext context, IMailSender sender) { _context = context; _notificationService = new NotificationService(_context, sender); _crypt = new SymmetricCrypt(SymmetricCryptProvider.TripleDES); var parameterRepository = new ParameterRepository(_context); _crypt.Key = parameterRepository.GetValueByKey(Parameter.CRYPTO_KEY); }
internal void SendCreatingUserNotiication(User user, string password) { var parameterRepository = new ParameterRepository(_context); var body = Resource.CreatingUserNotificationEmailBody .Replace("{username}", user.Name) .Replace("{login}", user.Login) .Replace("{password}", password) .Replace("{link}", Parameter.BASE_URL); var message = new MailMessage(); message.To.Add(user.Email); message.From = new MailAddress(parameterRepository.GetValueByKey(Parameter.EMAIL_FROM_KEY), Parameter.APP_NAME); message.Subject = Resource.CreatingUserNotificationEmailSubject; message.IsBodyHtml = true; message.Body = body; _sender.Send(message); }