Nearing feature complete for driver auth

This commit is contained in:
2013-01-09 21:33:57 -05:00
parent 0b4c7914b3
commit bc019923d2
49 changed files with 609 additions and 335 deletions
+19 -7
View File
@@ -12,11 +12,13 @@ namespace MileageTraker.Web.Email
{
//private static readonly ILog _logger = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private readonly string _resetPasswordBody;
private readonly string _resetPasswordFromAddress;
private readonly string _emaialFromAddress;
private readonly string _resetPasswordSubject;
private readonly string _resetPasswordBody;
private readonly SmtpClient _smtpClient;
private string _initializePasswordSubject;
private string _initializePasswordBody;
/// <summary>
/// Initializes a new instance of the <see cref="T:System.Object"/> class.
@@ -26,9 +28,13 @@ namespace MileageTraker.Web.Email
{
_smtpClient = new SmtpClient();
_resetPasswordBody = ConfigurationManager.AppSettings["ResetPasswordBody"];
_resetPasswordFromAddress = ConfigurationManager.AppSettings["ResetPasswordFromAddress"];
_emaialFromAddress = ConfigurationManager.AppSettings["EmailFromAddress"];
_resetPasswordSubject = ConfigurationManager.AppSettings["ResetPasswordSubject"];
_resetPasswordBody = ConfigurationManager.AppSettings["ResetPasswordBody"];
_initializePasswordSubject = ConfigurationManager.AppSettings["InitializePasswordSubject"];
_initializePasswordBody = ConfigurationManager.AppSettings["InitializetPasswordBody"];
}
/// <summary>
@@ -36,10 +42,16 @@ namespace MileageTraker.Web.Email
/// </summary>
/// <param name="user">To this user.</param>
/// <param name="url">Reset url</param>
public void NotifyResetPassword(User user, string url)
public void SendResetPassword(User user, string url)
{
var body = string.Format(_resetPasswordBody, url);
_smtpClient.Send(new MailMessage(_resetPasswordFromAddress, user.Email, _resetPasswordSubject, body));
_smtpClient.Send(new MailMessage(_emaialFromAddress, user.Email, _resetPasswordSubject, body));
}
public void SendInitializePassword(User user, string url)
{
var body = string.Format(_initializePasswordBody, url, user.FullName);
_smtpClient.Send(new MailMessage(_emaialFromAddress, user.Email, _initializePasswordSubject, body));
}
}
}