Ejemplo n.º 1
0
        public HttpResponseMessage PostResetEmail(ResertEmailContact contact)
        {
            EmailHelper         email = new EmailHelper();
            HttpResponseMessage response;

            if (email.SendEmail(contact.name, contact.email, contact.token, EmailHelper.EmailType.resetEmail) == true)
            {
                response = Request.CreateResponse(HttpStatusCode.Created, contact);
            }
            else
            {
                response = Request.CreateErrorResponse(HttpStatusCode.InternalServerError, "Error while sending email");
            }
            response.Headers.Location = new Uri(Url.Link("DefaultApi", new { id = contact.email }));
            return(response);
        }
 public ActionResult Forgot(ForgotModel model)
 {
     if (WebSecurity.GetUserId(model.UserName) > -1 && (WebSecurity.IsConfirmed(model.UserName)))
     {
         string token = WebSecurity.GeneratePasswordResetToken(model.UserName, 1200);
         /* Get IBO Email */
         IBO ibo = IBOVirtualAPI.GetIBOByUId(WebSecurity.GetUserId(model.UserName).ToString());
         /* Set And Send Email Reset Request */
         ResertEmailContact contact = new ResertEmailContact();
         contact.name  = model.UserName;
         contact.email = ibo.email;
         contact.token = token;
         bool result = IBOVirtualAPI.CreateResetEmail(contact);
     }
     else
     {
         ModelState.AddModelError(String.Empty, TextResources.Businesslms.ErrorUserNotFound);
     }
     return(View(model));
 }