Exemple #1
0
        public ActionResult Paid_download(int id)
        {
            var user_email = dbobject.tblUsers.Where(m => m.EmailID.Equals(User.Identity.Name)).FirstOrDefault();

            var tblSeller     = dbobject.tblSellerNotes.Where(m => m.ID == id).FirstOrDefault();
            var user_id       = user_email.ID;
            var checkdownload = dbobject.tblDownloads.Where(m => m.NoteID == id && m.Downloader == user_id).FirstOrDefault();

            if (checkdownload != null)
            {
                return(Json(new { success = true, alertMsg = "already downloaded this note." }, JsonRequestBehavior.AllowGet));
            }

            //tblSellerNote tblSeller = dbobj.tblSellerNotes.Find(id).;
            if (tblSeller == null || tblSeller.Status != 9)
            {
                return(HttpNotFound());
            }

            else if (tblSeller != null && tblSeller.Status == 9)
            {
                var    seller      = dbobject.tblUsers.Where(m => m.ID == tblSeller.SellerID).FirstOrDefault();
                string path        = (from sa in dbobject.tblSellerNotesAttachements where sa.NoteID == tblSeller.ID select sa.FilePath).First().ToString();
                string category    = (from c in dbobject.tblNoteCategories where c.ID == tblSeller.Category select c.Name).First().ToString();
                string seller_name = seller.FirstName;
                seller_name += " " + seller.LastName;
                string buyer_name = user_email.FirstName;
                buyer_name += " " + user_email.LastName;
                string buyer_email = seller.EmailID;

                tblDownload obj = new tblDownload();
                obj.NoteID     = tblSeller.ID;
                obj.Seller     = tblSeller.SellerID;
                obj.Downloader = user_id;
                obj.IsSellerHasAllowedDownload = false;
                obj.AttachmentPath             = path;
                obj.IsAttachmentDownloaded     = false;
                obj.IsPaid         = true;
                obj.PurchasedPrice = tblSeller.SellingPrice;
                obj.NoteTitle      = tblSeller.Title;
                obj.NoteCategory   = category;
                obj.CreatedDate    = DateTime.Now;

                dbobject.tblDownloads.Add(obj);

                string subject = buyer_name + " wants to purchase your notes";
                string body    = "Hello" + " " + seller_name + ",<br/><br/>We would like to inform you that, " + buyer_name + " wants to purchase your notes." +
                                 " Please see Buyer Requests tab and allow download access to Buyer if you have received " +
                                 "the payment from him.<br/><br/>Regards,<br/>Notes Marketplace";
                ForgotPass mailer = new ForgotPass();
                mailer.sendMail(subject, body, buyer_email);
                dbobject.SaveChanges();
                ViewBag.Msg = "Request Added";

                return(Json(new { success = true, responseText = seller_name }, JsonRequestBehavior.AllowGet));
                //#codebyChandreshMendapara
            }

            return(Json(new { success = false, responseText = "Error..." }, JsonRequestBehavior.AllowGet));
        }
Exemple #2
0
        public ActionResult Buyer_Allowed(int id)
        {
            NotesMarketPlaceEntities a = new NotesMarketPlaceEntities();
            var obj       = a.tblDownloads.Where(m => m.ID.Equals(id)).FirstOrDefault();
            int buyer_id  = obj.Downloader;
            int seller_id = obj.Seller;
            var buyer     = a.tblUsers.Where(m => m.ID.Equals(buyer_id)).FirstOrDefault();
            var seller    = a.tblUsers.Where(m => m.ID.Equals(seller_id)).FirstOrDefault();

            if (obj != null)
            {
                // int id = admin_id.ID;
                obj.IsSellerHasAllowedDownload = true;

                string buyer_email = buyer.EmailID;
                string buyer_name  = buyer.FirstName;
                buyer_name += " " + buyer.LastName;

                string seller_name = seller.FirstName;
                seller_name += " " + seller.LastName;
                string     subject = seller_name + " Allows you to download a note";
                ForgotPass mailer  = new ForgotPass();
                string     body    = "Hello " + buyer_name +
                                     ",<br/><br/>We would like to inform you that," + seller_name + " Allows you to download a note." +
                                     "Please login and see My Download tabs to download particular note." +
                                     "<br/><br/>Regards,<br/>Notes Marketplace";
                mailer.sendMail(subject, body, buyer_email);

                a.SaveChanges();
            }
            return(RedirectToAction("Buyer_requests", "Client"));
        }
        public async Task <ActionResult> ForgotPassword([FromBody] ForgotPass model)
        {
            if (ModelState.IsValid)
            {
                var user = await _userManager.FindByNameAsync(model.Email);

                if (user == null)
                {
                    return(Ok("That Email not exist in the database."));
                }

                var code = await _userManager.GeneratePasswordResetTokenAsync(user); //BuildTokenPass(user);//

                //string ppp = Request.Scheme+"://"+ Request.Host.Value+ "/api/Account/ForgotPasswordVAlid?userId=" + user.Id+"&code="+code;
                //var url= Url.Action("fewa","sss", new { userId = user.Id, code = code },ppp, pp);
                string       callbackUrl  = Url.Action(null, null, new { code = code, email = user.Email }, Request.Scheme);
                EmailService emailService = new EmailService(_configuration);
                string       body         = "Please change your password by clicking here: <a href=\"" + callbackUrl.Replace("api/Account/ForgotPassword", "forgotPassword") + "\">link</a>";
                emailService.SendEmail(user.Email, "Forgot Password Skyleaeaccess", body);
                return(Ok(callbackUrl.Replace("api/Account/ForgotPassword", "forgotPassword")));
            }

            // If we got this far, something failed, redisplay form
            return(Ok("Data invalid."));
        }
Exemple #4
0
        public AuthView()
        {
            InitializeComponent();

            this.WhenActivated(d => {
                // Control bindings
                d(this.Bind(ViewModel, x => x.Username, x => x.Username.Text));
                d(this.Bind(ViewModel, x => x.Password, x => x.Password.Password, Password.Events().PasswordChanged));
                d(this.BindCommand(ViewModel, x => x.SignIn, x => x.SignIn));

                // Change the text of the SignIn control based on state
                d(this.WhenAnyObservable(x => x.ViewModel.SignIn.IsExecuting)
                  .Subscribe(state => { SignIn.Content = state ? "Signing In..." : "Sign In"; }));

                // Invoke ViewModel commands when the external "links" are clicked
                d(NoAccount.Events().MouseLeftButtonUp.InvokeCommand(ViewModel, x => x.Registration));
                d(ForgotPass.Events().MouseLeftButtonUp.InvokeCommand(ViewModel, x => x.ResetPassword));

                // Attempt to grab the users avatar when the Username control loses focus
                d(Username.Events().LostFocus.InvokeCommand(ViewModel, x => x.Avatar));

                // Received `IBitmap` of the users avatar
                d(this.WhenAnyObservable(x => x.ViewModel.Avatar)
                  .Subscribe(bitmap => Avatar.Source = bitmap.ToNative()));

                // Allow 'Enter/Return' to execute authentication
                d(this.Events().KeyUp
                  .Where(x => x.Key == Key.Enter)
                  .Where(_ => ViewModel.SignIn.CanExecute(null))
                  .Subscribe(_ => ViewModel.SignIn.Execute(null)));
            });
        }
Exemple #5
0
        public ActionResult Mail(ForgotPass pass)
        {
            try
            {
                // Định cấu hình lớp webMail để gửi email
                // máy chủ gmail smtp
                WebMail.SmtpServer = "smtp.gmail.com";
                // cổng gmail để gửi email
                WebMail.SmtpPort = 587;
                WebMail.SmtpUseDefaultCredentials = true;
                // gửi email với giao thức bảo mật
                WebMail.EnableSsl = true;
                // EmailId được sử dụng để gửi email từ ứng dụng
                WebMail.UserName = "******";
                WebMail.Password = "******";

                // Địa chỉ email người gửi.
                WebMail.From = "*****@*****.**";
                User user = db.Users.FirstOrDefault(t => t.User_Email == pass.Email);
                pass.Title   = "Xác nhận đổi mật khẩu trang SellingMarket";
                pass.Content = "Xác nhận:'AAAAA";

                //Gửi email
                WebMail.Send(to: pass.Email, subject: pass.Title, body: pass.Content, cc: pass.Cc, bcc: pass.Bcc, isBodyHtml: true);
                ViewBag.Status = "Email được gửi thành công.";
            }
            catch (Exception)
            {
                ViewBag.Status = "Sự cố trong khi gửi email, vui lòng kiểm tra chi tiết.";
            }
            return(View());
        }
Exemple #6
0
        public async Task <ActionResult> ForgotPass(ForgotPass model)
        {
            if (ModelState.IsValid)
            {
                var user = await UserManager.FindByEmailAsync(model.Email);

                if (user != null && user.Logins.Count == 0)
                {
                    // For more information on how to enable account confirmation and password reset please visit http://go.microsoft.com/fwlink/?LinkID=320771
                    // Send an email with this link
                    string code = await UserManager.GeneratePasswordResetTokenAsync(user.Id);

                    var callbackUrl = Url.Action("ResetPassword", "Account", new { code = code }, protocol: Request.Url.Scheme);
                    await UserManager.SendEmailAsync(user.Id, "Reset Password", "Please reset your password by clicking <a href=\"" + callbackUrl + "\">here</a>");

                    return(PasswordResetSent());
                }
                else
                {
                    return(PasswordResetSent());
                }
            }
            // If we got this far, something failed, redisplay form
            return(View(model));
        }
Exemple #7
0
        public ActionResult ConfirmPassword(ForgotPass pass)
        {
            var a       = TempData["Email"].ToString();
            var update  = db.Employees.Single(x => x.Email == a);
            var passwrd = (pass.Password).ToString();

            update.Password = pass.Password;
            //db.Employees.Add(update);
            db.Entry(update).State = EntityState.Modified;
            db.SaveChanges();
            return(RedirectToAction("Login", "Emp"));
        }
Exemple #8
0
        public ActionResult ForgotPassword(ForgotPass pass)
        {
            var getdetails = db.Employees.Where(x => x.Email.Equals(pass.Email) && x.Phone.Equals(pass.phone)).SingleOrDefault();

            if (getdetails != null)
            {
                try
                {
                    var sendmail = new MailAddress("*****@*****.**", "Akhil");
                    var receiver = new MailAddress(pass.Email, "Buddy");
                    var password = "";//please type your email here
                    var subject  = "testmail";
                    var body     = "Please follow the link  to reset the password \"http://localhost:52601/Emp/ConfirmPassword\" ";



                    var smptp = new SmtpClient
                    {
                        Host                  = "smtp.gmail.com",
                        Port                  = 587,
                        EnableSsl             = true,
                        DeliveryMethod        = SmtpDeliveryMethod.Network,
                        UseDefaultCredentials = false,
                        Credentials           = new NetworkCredential(sendmail.Address, password)
                    };
                    using (var mess = new MailMessage(sendmail, receiver)
                    {
                        Subject = subject,
                        Body = body,
                    })
                    {
                        smptp.Send(mess);
                    }

                    ViewBag.Status = "Please check your mail";
                    return(View());
                }
                catch
                {
                    ViewBag.Status = "Problem while sending email, Please check details.";
                }
            }
            else
            {
                ViewBag.Status = "Sorry it seems you are not a registered user";
            }
            return(View());
        }
        public object Activateaccount(ForgotPass forgotPass)
        {
            string message = "";

            if (ModelState.IsValid)
            {
                var user = entity.TB_ECOMM_USERS.Where(a => a.USER_EMAIL == forgotPass.Email).FirstOrDefault();
                if (user != null)
                {
                    user.EMAIL_CONFIRMED = true;
                    entity.Configuration.ValidateOnSaveEnabled = false;
                    entity.SaveChanges();
                    message = "Your acoount has been successfully activated";
                }
            }
            else
            {
                message = "Something invalid";
            }
            //ViewBag.Message = message;
            //return View(model);
            return(message);
        }
        public object ForgotPassword(ForgotPass forgotPass)
        {
            string message = "";
            bool   status  = false;
            var    account = entity.TB_ECOMM_USERS.Where(a => a.USER_EMAIL == forgotPass.Email).FirstOrDefault();

            if (account != null)
            {
                //Send email for reset password
                string resetCode = Guid.NewGuid().ToString();
                SendVerificationLinkEmail(account.USER_EMAIL, resetCode, "ResetPassword");
                account.RESET_CODE = resetCode;
                //This line I have added here to avoid confirm password not match issue , as we had added a confirm password property
                entity.Configuration.ValidateOnSaveEnabled = false;
                entity.SaveChanges();
                message = "Reset password link has been sent to your email id.";
            }
            else
            {
                message = "Account not found";
            }

            return(message);
        }
        private void forgetPass_btn_Click(object sender, EventArgs e)//
        {
            ForgotPass fp = new ForgotPass();

            fp.ShowDialog();
        }