Exemplo n.º 1
0
        public async Task <IActionResult> Forgot(Forgot model)
        {
            if (ModelState.IsValid)
            {
                var customer = this._context.Customers.Include(i => i.CustomerClass).Include(i => i.User).Where(c => c.User.UserName == model.Email).FirstOrDefault();
                if (customer != null)
                {
                    model.Customer = customer;
                    var rg = new RijndaelCrypt();
                    model.Url = Url.Action("ResetPwd", new { u = rg.Encrypt(customer.User.UserName) });
                    var htmlToConvert = await RenderViewAsync("MailForgotPwd", model, true);

                    var msg = EmailUtil.sendNotificationEmail(_smtp, customer.Email, "เปลี่ยนรหัสผ่าน", htmlToConvert.ToString());
                    ViewData["Message"] = "ระบบกำลังส่่งการกำหนดรหัสผ่านใหม่ไปยังอีเมลของท่าน";
                    return(View(model));
                }
                ViewData["ErrorMessage"] = "ไม่พบอีเมลในระบบ";
            }
            else
            {
                ViewData["ErrorMessage"] = "โปรดระบุอีเมล";
            }

            return(View(model));
        }
Exemplo n.º 2
0
        public IActionResult Forgot(string email)
        {
            var model = new Forgot();

            model.Email = email;
            return(View(model));
        }
Exemplo n.º 3
0
        public async Task <IActionResult> Forgot(string Email)
        {
            Forgot forg = new Forgot();

            if (Email != null)
            {
                AppUser user = await userManager.FindByEmailAsync(Email);

                if (user != null)
                {
                    // send email to client
                    // Utility.SendEmail(Email, "", "");
                    TempData["message"] = $"A Reset link has been sending to {Email}";
                    forg.Email          = Email;
                }
                else
                {
                    ModelState.AddModelError("", "Email not exists.");
                }
            }
            else
            {
                ModelState.AddModelError("", "Invalid Email.");
            }
            return(View(forg));
        }
Exemplo n.º 4
0
        public async void Login(object sender, EventArgs e)
        {
            Lightl.TranslationY      = -60;
            Lightr.TranslationY      = -30;
            Clock.TranslationY       = -30;
            Logintext.TranslationY   = -20;
            Box.TranslationY         = -20;
            Loginbutton.TranslationY = -20;
            Forgot.TranslationY      = -20;


            Lightl.Opacity      = 0;
            Lightr.Opacity      = 0;
            Clock.Opacity       = 0;
            Logintext.Opacity   = 0;
            Box.Opacity         = 0;
            Loginbutton.Opacity = 0;
            Forgot.Opacity      = 0;

            Lightl.FadeTo(1, 300);
            await Lightl.TranslateTo(0, 0, 300);


            Lightr.FadeTo(1, 300);
            await Lightr.TranslateTo(0, 0, 300);


            Clock.FadeTo(1, 300);
            await Clock.TranslateTo(0, 0, 300);


            Logintext.FadeTo(1, 300);
            await Logintext.TranslateTo(0, 0, 300);


            Box.FadeTo(1, 300);
            await Box.TranslateTo(0, 0, 300);


            Loginbutton.FadeTo(1, 300);
            await Loginbutton.TranslateTo(0, 0, 300);


            Forgot.FadeTo(1, 300);
            await Forgot.TranslateTo(0, 0, 300);


            try
            {
                _googleManager.Logout();
                _googleManager.Login(OnLoginComplete);
            }
            catch (Exception x)
            {
                await DisplayAlert("Authentication Failed", "Your Authentication Attempt Failed. Please try again..", "Ok");
            }
        }
Exemplo n.º 5
0
        public async Task <ActionResult> ForgotPassword([FromBody] Forgot forgot)
        {
            if (ModelState.IsValid)
            {
                var user = await _userManager.FindByEmailAsync(forgot.Email);

                if (user == null)
                {
                    return(BadRequest(new { message = "email is not found!" }));
                }
            }
            return(Ok(forgot));
        }
Exemplo n.º 6
0
 private void Btn_Forgot_Click(object sender, EventArgs e)
 {
     try
     {
         Hide();
         Forgot_ = new Forgot();
         Forgot_.ShowDialog();
         Clean();
         Show();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Exemplo n.º 7
0
        public IHttpActionResult ForgotPassword([FromBody] Forgot email)
        {
            user u = db.users.Single(x => x.email == email.email);


            if (u != null)
            {
                MailMessage mailMessage = new MailMessage();


                StringBuilder sbEmailBody = new StringBuilder();
                sbEmailBody.Append("Dear " + u.full_name + ",<br/><br/>");
                sbEmailBody.Append("Your Password is " + u.password + ",<br/><br/>");

                sbEmailBody.Append("<br/><br/>");
                sbEmailBody.Append("<b>Farmers Team</b>");

                mailMessage.IsBodyHtml = true;

                mailMessage.Body    = sbEmailBody.ToString();
                mailMessage.Subject = "Reset Your Password";
                SmtpClient smtpClient = new SmtpClient("smtp.gmail.com", 587);

                smtpClient.Credentials = new System.Net.NetworkCredential()
                {
                    UserName = "******",
                    Password = "******"
                };
                string to   = u.email;
                string from = "*****@*****.**";

                smtpClient.EnableSsl = true;

                mailMessage.From = new MailAddress(from);
                mailMessage.To.Add(to);
                smtpClient.Send(mailMessage);
                smtpClient.UseDefaultCredentials = false;

                return(Ok());
            }
            else
            {
                return(NotFound());
            }
        }
Exemplo n.º 8
0
        public ActionResult forgot(Forgot f)
        {
            MyDatabaseDataContext db = new MyDatabaseDataContext();
            V_user us = db.V_users.Where(x => x.Email == f.Email).FirstOrDefault();

            if (us == null)
            {
                ViewBag.error = "ასეთი მომხმარებელი არ არსებობს";
                return(View());
            }

            string body = "http://localhost:51328/Account/Recovery/" + us.Secret;

            SendMail(us.Email, "Recovery", body, false);
            ViewBag.error = "მეილი წარმატებით გაიგზავნა";

            return(View());
        }
Exemplo n.º 9
0
 public ForgotViewModel(Page page) : base(page)
 {
     level       = 0;
     currentUser = new Users();
     forgotList  = new List <Forgot>()
     {
         new Forgot {
             labelText = "Kullanıcı Adı ", entryText = string.Empty, buttonText = "İleri"
         },
         new Forgot {
             labelText = "", entryText = string.Empty, buttonText = "Cevapla"
         },
         new Forgot {
             labelText = "Şifreniz : ", entryText = string.Empty, buttonText = "Geri Dön"
         }
     };
     forgotModel = new Forgot();
     forgotModel = forgotList[0];
     currentPage.Disappearing += onDisappearing;
 }
Exemplo n.º 10
0
        public ActionResult Forgot(Forgot forgot)
        {
            string message = "";
            bool   status  = false;


            using (UserDBEntities db = new UserDBEntities())
            {
                var v = db.Uses.Where(a => a.Email == forgot.Email).FirstOrDefault();
                if (v != null)
                {
                    if (string.Compare(forgot.NewPassword, forgot.ConfirmPassword) == 0)
                    {
                        var m = Crypto.Hash(forgot.NewPassword);
                        v.Password = m;
                        db.SaveChanges();
                        message = "Successfully Completed";
                        status  = true;
                    }
                    else
                    {
                        message = "enter a right password";
                        status  = false;
                    }
                }
                else
                {
                    message = "email is invalid";
                    status  = false;
                }
            }

            ViewBag.Message = message;
            ViewBag.Status  = status;
            return(View());
        }