Example #1
0
        public ValidEmail()
        {
            var app = new Application("*****@*****.**", "password", "password");
              var result = new Registrator().ApplyForMembership(app);

              _result = new MonkeyFist.Services.Reminders().SendReminderTokenToUser("*****@*****.**");
        }
Example #2
0
 public EmailNotFound()
 {
     _result = new MonkeyFist.Services.Reminders().SendReminderTokenToUser("*****@*****.**");
 }
Example #3
0
        public ReminderResult SendReminderTokenToUser(string email)
        {
            _session = new Session();
              var result = new ReminderResult();
              result.User = GetUserByEmail(email);

              if (result.User != null) {
            result.User.ReminderToken = Guid.NewGuid();
            result.User.ReminderSentAt = DateTime.Now;

            var mailer = GetReminderMailer();
            var link = CreateReminderLink(result.User);
            var message = UserMailerMessage.CreateFromTemplate(mailer,link);

            if (message.Successful) {
              result.User.AddLogEntry("Login", "Reminder email sent at " + DateTime.Now.ToShortDateString());
            } else {
              result.User.AddLogEntry("Login", "Reminder email failed to send  " + DateTime.Now.ToShortDateString());
            }

            result.MailMessage = message.SendTo(result.User);

            _session.SaveChanges();
              } else {
            result.Message = Properties.Resources.EmailNotFound;
              }

              _session.Dispose();

              return result;
        }