Пример #1
0
 public BoardController(
     ForumServices forumServices,
     SearchServices searchServices,
     ThreadServices threadServices,
     PostServices postServices,
     PollServices pollServices,
     GlobalServices globalServices,
     IRepository <OnlineUser> onlineUserRepository,
     IRepository <OnlineGuest> onlineGuestRepository,
     IRepository <User> userRepository,
     UserServices usersServices,
     RoleServices roleServices,
     MessageServices messageServices,
     PermissionServices permissionServices,
     FileServices fileServices,
     User currentUser,
     Theme currentTheme)
 {
     _forumServices         = forumServices;
     _searchServices        = searchServices;
     _threadServices        = threadServices;
     _postServices          = postServices;
     _pollServices          = pollServices;
     _onlineUserRepository  = onlineUserRepository;
     _onlineGuestRepository = onlineGuestRepository;
     _userRepository        = userRepository;
     _userServices          = usersServices;
     _roleServices          = roleServices;
     _messageServices       = messageServices;
     _permissionServices    = permissionServices;
     _fileServices          = fileServices;
     _currentUser           = currentUser;
     _currentTheme          = currentTheme;
     SetTopBreadCrumb("Board");
 }
        public async Task <IActionResult> SendCode(SendCodeViewModel model)
        {
            if (!ModelState.IsValid)
            {
                return(View());
            }

            var user = await SignInManager.GetTwoFactorAuthenticationUserAsync();

            if (user == null)
            {
                return(View("Error"));
            }

            // Generate the token and send it
            var code = await UserManager.GenerateTwoFactorTokenAsync(user, model.SelectedProvider);

            if (string.IsNullOrWhiteSpace(code))
            {
                return(View("Error"));
            }

            var message = "Your security code is: " + code;

            if (model.SelectedProvider == "Email")
            {
                await MessageServices.SendEmailAsync(await UserManager.GetEmailAsync(user), "Security Code", message);
            }
            else if (model.SelectedProvider == "Phone")
            {
                await MessageServices.SendSmsAsync(await UserManager.GetPhoneNumberAsync(user), message);
            }

            return(RedirectToAction("VerifyCode", new { Provider = model.SelectedProvider, ReturnUrl = model.ReturnUrl, RememberMe = model.RememberMe }));
        }
        public async Task <IActionResult> SignUp(SignUpViewModel model, IFormFile file)
        {
            if (ModelState.IsValid)
            {
                var user = new ApplicationUser {
                    UserName = model.Email, Email = model.Email
                };
                var result = await _userManager.CreateAsync(user, model.LoginPassword);

                if (result.Succeeded)
                {
                    var fileName = ContentDispositionHeaderValue.Parse(file.ContentDisposition).FileName.Trim('"');

                    if (fileName.EndsWith(".jpg") || fileName.EndsWith(".png") || fileName.EndsWith(".jpeg") || fileName.EndsWith(".gif") || fileName.EndsWith(".bmp") || fileName.EndsWith(".tiff"))

                    {
                        var filePath = _hostingEnvironment.ApplicationBasePath + "\\wwwroot\\profiledat\\" + model.Email + ".jpg";
                        await file.SaveAsAsync(filePath);
                    }


                    await MessageServices.SendEmail(model, _context);


                    return(RedirectToAction("EmailConfPage"));
                }
                else
                {
                    return(View("SignUpPage"));
                }
            }

            return(View("SignUpPage"));
        }
        public void WhenBatchingMessageWithOpenBatchWithWithdrawAndDepositTransactionThenTransactionsInBatchIs2()
        {
            ApplicationService      applicationService      = new ApplicationService(_ctx);
            MessageServices         messageService          = new MessageServices(_ctx);
            UserService             userService             = new UserService(_ctx);
            PaymentAccountService   paymentAccountService   = new PaymentAccountService(_ctx);
            TransactionBatchService transactionBatchService = new TransactionBatchService(_ctx, _logger);

            var transactionBatchGuid = Guid.NewGuid();
            var transactionAmount    = 2.75;

            _ctx.TransactionBatches.Add(new TransactionBatch()
            {
                CreateDate               = System.DateTime.Now,
                Id                       = transactionBatchGuid,
                IsClosed                 = false,
                TotalDepositAmount       = 0,
                TotalNumberOfDeposits    = 0,
                TotalWithdrawalAmount    = 0,
                TotalNumberOfWithdrawals = 0,
                Transactions             = new List <Transaction>()
            });
            _ctx.SaveChanges();

            var application = applicationService.AddApplication("Test", "http://www.test.com", true);
            var sender      = userService.AddUser(application.ApiKey, "*****@*****.**", "pdthx123",
                                                  "*****@*****.**", "1234");

            sender.SecurityPin = "2589";
            userService.UpdateUser(sender);

            var senderPaymentAccount = paymentAccountService.AddPaymentAccount(sender.UserId.ToString(), "Sender PaidThx",
                                                                               "053000219", "1234123412", "Checking");

            sender.PaymentAccounts = new System.Collections.ObjectModel.Collection <PaymentAccount>();
            sender.PaymentAccounts.Add(senderPaymentAccount);

            var recipient = userService.AddUser(application.ApiKey, "*****@*****.**", "pdthx123",
                                                "*****@*****.**", "1234");

            var recipientPaymentAccount = paymentAccountService.AddPaymentAccount(sender.UserId.ToString(), "Recipient PaidThx",
                                                                                  "053000219", "1234123412", "Savings");

            recipient.PaymentAccounts = new System.Collections.ObjectModel.Collection <PaymentAccount>();
            recipient.PaymentAccounts.Add(recipientPaymentAccount);

            var message = messageService.AddMessage(application.ApiKey.ToString(), sender.EmailAddress, recipient.EmailAddress,
                                                    senderPaymentAccount.Id.ToString(), transactionAmount, "Test Payment", "Payment", "2589");

            message.Recipient = userService.FindUserByEmailAddress(recipient.EmailAddress);

            transactionBatchService.BatchTransactions(message);

            var transactionBatch = transactionBatchService.GetOpenBatch();

            Assert.AreEqual(transactionBatchGuid, transactionBatch.Id);
            Assert.AreEqual(2, transactionBatch.Transactions.Count);
            Assert.AreEqual(1, transactionBatch.TotalNumberOfDeposits);
            Assert.AreEqual(1, transactionBatch.TotalNumberOfWithdrawals);
        }
 public UserController(UserServices userServices, RoleServices roleServices, MessageServices messageServices, UsersFilter usersFilter)
 {
     this.roleServices = roleServices;
     this.userServices = userServices;
     this.messageServices = messageServices;
     this.usersFilter = usersFilter;
 }
Пример #6
0
        public async Task <IActionResult> Register(RegisterViewModel model)
        {
            if (ModelState.IsValid)
            {
                var user = new ApplicationUser {
                    UserName = model.Email, Email = model.Email
                };
                var result = await UserManager.CreateAsync(user, model.Password);

                if (result.Succeeded)
                {
                    var code = await UserManager.GenerateEmailConfirmationTokenAsync(user);

                    var callbackUrl = Url.Action("ConfirmEmail", "Account", new { userId = user.Id, code = code }, protocol: HttpContext.Request.Scheme);
                    await MessageServices.SendEmailAsync(model.Email, "Confirm your account",
                                                         "Please confirm your account by clicking this link: <a href=\"" + callbackUrl + "\">link</a>");

                    ViewBag.Link   = callbackUrl;
                    ViewBag.Code   = code;
                    ViewBag.UserId = user.Id;
                    return(View("RegisterConfirmation"));
                }
                AddErrors(result);
            }

            // If we got this far, something failed, redisplay form
            return(View(model));
        }
        public async Task <IActionResult> ForgotPassword(ForgotPasswordViewModel model)
        {
            if (ModelState.IsValid)
            {
                var user = await UserManager.FindByNameAsync(model.Email);

                if (user == null || !(await UserManager.IsEmailConfirmedAsync(user)))
                {
                    // Don't reveal that the user does not exist or is not confirmed
                    return(View("ForgotPasswordConfirmation"));
                }

                var code = await UserManager.GeneratePasswordResetTokenAsync(user);

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

                ViewBag.Link = callbackUrl;
                return(View("ForgotPasswordConfirmation"));
            }

            // If we got this far, something failed, redisplay form
            return(View(model));
        }
Пример #8
0
        public ActionResult List(int pageindex, int pagesize)
        {
            MessageServices msgservices = new MessageServices();
            var             result      = msgservices.query.Where(q => q.is_del != true).OrderByDescending(q => q.msg_time).ToPagedList(pageindex, pagesize);

            return(PartialView(result));
        }
        public async Task <IActionResult> Register(RegisterViewModel model)
        {
            if (ModelState.IsValid)
            {
                var user = new ApplicationUser {
                    UserName = model.Email, Email = model.Email
                };
                var result = await UserManager.CreateAsync(user, model.Password);

                if (result.Succeeded)
                {
                    _logger.LogInformation("User {userName} was created.", model.Email);
                    //Bug: Remember browser option missing?
                    //Uncomment this and comment the later part if account verification is not needed.
                    //await SignInManager.SignInAsync(user, isPersistent: false);

                    // 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.GenerateEmailConfirmationTokenAsync(user);

                    var callbackUrl = Url.Action("ConfirmEmail", "Account", new { userId = user.Id, code = code }, protocol: HttpContext.Request.Scheme);
                    await MessageServices.SendEmailAsync(model.Email, "Confirm your account",
                                                         "Please confirm your account by clicking this link: <a href=\"" + callbackUrl + "\">link</a>");

                    return(RedirectToAction("Index", "Home"));
                }
                AddErrors(result);
            }
            // If we got this far, something failed, redisplay form
            return(View(model));
        }
Пример #10
0
        public ActionResult MessageIng(string msg)
        {
            MessageServices     msgServices = new MessageServices();
            JsonResult <string> result      = new JsonResult <string>();
            string userip = UserAddress.GetUserAddress();
            //10分钟内,同一ip只可留言一次
            var newMsg = msgServices.query.Where(q => q.user_ip == userip).OrderByDescending(q => q.msg_time).FirstOrDefault();

            if (newMsg != null && ((TimeSpan)(DateTime.Now - newMsg.msg_time)).TotalMinutes < 10)
            {
                result.Fail("已留言," + (10 - ((TimeSpan)(DateTime.Now - newMsg.msg_time)).TotalMinutes).ToString("F0") + "分钟内无法再次留言");
                return(Json(result, JsonRequestBehavior.AllowGet));
            }
            message add = new message();

            add.is_del   = false;
            add.msg_time = DateTime.Now;
            add.content  = msg;
            add.user_ip  = userip;
            if (msgServices.Add(add) > 0)
            {
                result.Success();
            }
            else
            {
                result.Fail("留言失败");
            }
            return(Json(result, JsonRequestBehavior.AllowGet));
        }
Пример #11
0
        public async Task <ActionResult> sendEmail(string uname)
        {
            UserModel     um = db.Umodel.Single(u => u.Username == uname);
            SendMailModel sm = new SendMailModel();

            if (um != null)
            {
                string pw      = passGen();
                var    message = await EMailTemplate("RecoverPW");

                message = message.Replace("@ViewBag.Name", CultureInfo.CurrentCulture.TextInfo.ToTitleCase(um.Username));
                message = message.Replace("@ViewBag.Pass", CultureInfo.CurrentCulture.TextInfo.ToTitleCase(pw));

                await MessageServices.SendEmail(um.Email, "Project base", message);

                @ViewBag.Error = "Nerror";
                @ViewBag.Uname = uname;

                sm.RecoverCode = pw;
            }
            else
            {
                @ViewBag.Error = "error";
            }

            return(View("~/Views/Login/ForgotPassword.cshtml", sm));
        }
Пример #12
0
        public void WhenPaymentMessageReceivedWithRecipientUriUnRegisteredMobileNumberMessageCountIs1()
        {
            _userService           = new UserService(_ctx);
            _messageService        = new MessageServices(_ctx);
            _paymentAccountService = new PaymentAccountService(_ctx);

            var application = _ctx.Applications.Add(new Application()
            {
                ApiKey          = Guid.NewGuid(),
                ApplicationName = "Test",
                IsActive        = true,
                Url             = "http://www.test.com"
            });

            var securityPin = "2578";
            var sender      = _userService.AddUser(application.ApiKey, "*****@*****.**",
                                                   "james123", "*****@*****.**", "");

            sender.MobileNumber = "804-387-9693";
            _userService.UpdateUser(sender);

            sender.SecurityPin = securityPin;
            _userService.UpdateUser(sender);

            var senderAccount = _paymentAccountService.AddPaymentAccount(sender.UserId.ToString(), "James G Rhodes", "053000219",
                                                                         "1234123412", "Checking");

            sender.PaymentAccounts = new System.Collections.ObjectModel.Collection <PaymentAccount>();
            sender.PaymentAccounts.Add(senderAccount);

            var message = _messageService.AddMessage(application.ApiKey.ToString(), sender.MobileNumber, "804-350-9542", senderAccount.Id.ToString(),
                                                     10.00, "Test Payment", "Payment", securityPin);

            Assert.AreEqual(_ctx.Messages.Count(), 1);
        }
Пример #13
0
        public async Task <IActionResult> AddPhoneNumber([FromBody] AddPhoneNumberViewModel model)
        {
            if (!ModelState.IsValid)
            {
                return(this.StatusCode(ApiStatusCode.InvalidArguments));
            }

            // Generate the token and send it
#if !NETCORE
            var code = await this.UserManager.GenerateChangePhoneNumberTokenAsync(User.Identity.GetUserId(), model.Number);
#else
            var user = await this.GetCurrentUserAsync();

            var code = await this.UserManager.GenerateChangePhoneNumberTokenAsync(user, model.Number);
#endif
            var messageText = "Your security code is: " + code;
#if !NETCORE
            if (this.UserManager.SmsService != null)
            {
                var message = new IdentityMessage
                {
                    Destination = model.Number,
                    Body        = messageText
                };
                await this.UserManager.SmsService.SendAsync(message);
            }
#else
            await MessageServices.SendSmsAsync(model.Number, messageText);
#endif
            return(this.StatusCode(ApiStatusCode.Ok));
        }
        public async Task <ActionResult> ForgotPassword(ForgotPasswordViewModel model)
        {
            if (ModelState.IsValid)
            {
                var user = await UserManager.FindByNameAsync(model.Email);

                if (user == null || !(await UserManager.IsEmailConfirmedAsync(user)))
                {
                    // Don't reveal that the user does not exist or is not confirmed
                    return(View("ForgotPasswordConfirmation"));
                }

                // 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);

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

#if !DEMO
                return(RedirectToAction("ForgotPasswordConfirmation"));
#else
                //To display the email link in a friendly page instead of sending email
                ViewBag.Link = callbackUrl;
                return(View("DemoLinkDisplay"));
#endif
            }

            ModelState.AddModelError("", string.Format("We could not locate an account with email : {0}", model.Email));

            // If we got this far, something failed, redisplay form
            return(View(model));
        }
Пример #15
0
        public ActionResult Partial(int ReferenceId)
        {
            MessageServices services      = new MessageServices();
            OfferServices   offerServices = new OfferServices();
            MessageServices chatServices  = new MessageServices();
            MessageModel    filter        = new MessageModel();

            chatServices.MarkAsReaded(
                new MessageModel()
            {
                ReferenceId = ReferenceId, From = SessionWeb.User.PersonId
            });

            OfferModel offer = offerServices.GetFirst(new OfferModel()
            {
                OfferId = ReferenceId
            });

            ViewBag.Alias = SessionWeb.User.PersonId == offer.ProjectAdmin.PersonId ? "PROJECT_OWNER"
                : SessionWeb.User.PersonId == offer.VesselAdmin.PersonId ? "VESSEL_OWNER" : "";
            ViewBag.From = SessionWeb.User.PersonId;
            ViewBag.To   = SessionWeb.User.PersonId == offer.ProjectAdmin.PersonId ? offer.VesselAdmin.PersonId
                : SessionWeb.User.PersonId == offer.VesselAdmin.PersonId ? offer.ProjectAdmin.PersonId : -1;
            ViewBag.lstMsg          = services.Get(filter);
            ViewBag.SessionPersonId = SessionWeb.User.PersonId;
            ViewBag.ReferenceId     = ReferenceId;

            return(View());
        }
        public void WhenGettingOpenBatchWithNoOpenBatchesNewBatchIsCreated()
        {
            ApplicationService      applicationService      = new ApplicationService(_ctx);
            MessageServices         messageService          = new MessageServices(_ctx);
            UserService             userService             = new UserService(_ctx);
            PaymentAccountService   paymentAccountService   = new PaymentAccountService(_ctx);
            TransactionBatchService transactionBatchService = new TransactionBatchService(_ctx, _logger);

            var transactionBatchGuid = Guid.NewGuid();

            _ctx.TransactionBatches.Add(new TransactionBatch()
            {
                CreateDate               = System.DateTime.Now,
                Id                       = transactionBatchGuid,
                IsClosed                 = true,
                TotalDepositAmount       = 0,
                TotalNumberOfDeposits    = 0,
                TotalWithdrawalAmount    = 0,
                TotalNumberOfWithdrawals = 0,
                Transactions             = new List <Transaction>()
            });

            var transactionBatch = transactionBatchService.GetOpenBatch();

            Assert.AreNotEqual(transactionBatchGuid, transactionBatch.Id);
        }
Пример #17
0
        public async Task <IActionResult> Register(RegisterViewModel model)
        {
            if (ModelState.IsValid)
            {
                var user = new User {
                    UserName = model.UserName, Email = model.Email, CreateOn = DateTime.Now, LastTime = DateTime.Now
                };
                var result = await UserManager.CreateAsync(user, model.Password);

                if (result.Succeeded)
                {
                    _logger.LogInformation("User {userName} was created.", model.Email);
                    string code = await UserManager.GenerateEmailConfirmationTokenAsync(user);

                    var callbackUrl = Url.Action("ConfirmEmail", "Account", new { userId = user.Id, code = code }, protocol: HttpContext.Request.Scheme);
                    await MessageServices.SendEmailAsync(model.Email, "Confirm your account",
                                                         "Please confirm your account by clicking this link: <a href=\"" + callbackUrl + "\">link</a>");

                    if (user.UserName.ToLower().Equals("admin"))
                    {
                        await UserManager.AddClaimAsync(user, new Claim("Admin", "Allowed"));
                    }
                    return(RedirectToAction("Login"));
                }
                AddErrors(result);
            }
            return(View(model));
        }
Пример #18
0
        public DateTime?GetTimeStampOfMostRecentDeadletter(string parentTopicName, string subscriptionName)
        {
            var endpoint       = new SubscriptionDeadletterEndpoint(CreateNamespaceManager(), CreateEndpointFactory(), parentTopicName, subscriptionName);
            var deadletterList = MessageServices.GetMessagesFromEndpoint(endpoint);
            var mostRecent     = deadletterList.OrderByDescending(x => x.EnqueuedTimeUtc).FirstOrDefault();

            return(mostRecent?.EnqueuedTimeUtc);
        }
Пример #19
0
        public async System.Threading.Tasks.Task SendEmail(string fullName, string email, string template, string emailTitle)
        {
            var message = await EmailTemplate(template);

            message = message.Replace("UserFullName", CultureInfo.CurrentCulture.TextInfo.ToTitleCase(fullName));
            message = message.Replace("UserEmail", email);
            await MessageServices.SendEmailAsync(email, emailTitle, message);
        }
Пример #20
0
        private void LoadAutoSuggest()
        {
            List <HRR.Core.Domain.Interfaces.IAutoSuggestRecipient> list = new MessageServices().GetAutoSuggestRecipients();

            tbTo.DataSource     = list;
            tbTo.DataTextField  = "Name";
            tbTo.DataValueField = "Email";
        }
        public async Task <ActionResult> SendEmail(SendEmailViewModel model)
        {
            var mesage = await EmailTemplate("WelcomeEmail");

            mesage = mesage.Replace("ViewBag.Name", CultureInfo.CurrentCulture.TextInfo.ToTitleCase(model.FirstName));
            await MessageServices.SendEmailAsync(model.Email2, "Welcome!", mesage);

            return(View("EmailSent"));
        }
Пример #22
0
 public AccountController(SignInManager <AppUser> signInManager,
                          ILogger <LoginViewModel> logger,
                          UserManager <AppUser> userManager,
                          MessageServices emailSender)
 {
     _userManager   = userManager;
     _signInManager = signInManager;
     _emailSender   = emailSender;
     _logger        = logger;
 }
Пример #23
0
        public ActionResult SendEmail(UserRegisteration reg)
        {
            var message = EmailTemplate("WelcomeEmail");

            message = message.Replace("@ViewBag.Name", CultureInfo.CurrentCulture.TextInfo.ToTitleCase(reg.C_FirstName));

            //Sends email
            MessageServices.SendEmail(reg.C_EmailID, "Welcome to Continuous Integration!", message);
            return(View("EmailSent"));
        }
Пример #24
0
        /// <summary>
        /// Sends forgot password registration email.
        /// </summary>
        /// <param name="user">User which request forgot password email.</param>
        /// <param name="code">Code for forgot password registration.</param>
        /// <returns>Asynchronously send forgot password email.</returns>
        protected virtual async Task SendResetPasswordEmail(TUser user, string code)
        {
            var callbackUrl = this.Url.Link("Default", new { @controller = "ResetPassword", @action = "Account", userId = user.Id, code = code });

#if !NETCORE
            await this.UserManager.SendEmailAsync(user.Id, "Reset Password", "Please reset your password by clicking <a href=\"" + callbackUrl + "\">here</a>");
#else
            await MessageServices.SendEmailAsync(user.Id, "Reset Password", "Please reset your password by clicking <a href=\"" + callbackUrl + "\">here</a>");
#endif
        }
Пример #25
0
        public void AddMessage_Should_AddMessage()
        {
            var db             = new TFContext(DatabaseSimulator());
            var messageService = new MessageServices(db);
            var message        = new Message();

            messageService.AddMessage(message);

            Assert.AreEqual(1, db.Messages.Count());
        }
Пример #26
0
        public async Task <ActionResult> SendEmail(string fullName, string email)
        {
            var message = await EmailTemplate("RegisterEmailTemplate");

            message = message.Replace("UserFullName", CultureInfo.CurrentCulture.TextInfo.ToTitleCase(fullName));
            message = message.Replace("UserEmail", email);
            await MessageServices.SendEmailAsync(email, "Registration request", message);

            return(RedirectToAction("Index", "Home"));
        }
Пример #27
0
        /// <summary>
        /// Send registration email.
        /// </summary>
        /// <param name="user">Information about newly registered used.</param>
        /// <param name="code">Token which could be used for the confirming email.</param>
        /// <returns>Asynchronous task which sends registration email.</returns>
        protected virtual async Task SendRegistrationEmail(TUser user, string code)
        {
#if !NETCORE
            var callbackUrl = this.Url.Action("ConfirmEmail", "Account", new { userId = user.Id, code = code }, protocol: Request.Url.Scheme);
            await this.UserManager.SendEmailAsync(user.Id, "Confirm your account", "Please confirm your account by clicking <a href=\"" + callbackUrl + "\">here</a>");
#else
            var callbackUrl = this.Url.Action("ConfirmEmail", "Account", new { userId = user.Id, code = code }, protocol: Request.Scheme);
            await MessageServices.SendEmailAsync(user.Id, "Confirm your account", "Please confirm your account by clicking <a href=\"" + callbackUrl + "\">here</a>");
#endif
        }
Пример #28
0
        /// <summary>
        /// Sends forgot password registration email.
        /// </summary>
        /// <param name="user">User which request forgot password email.</param>
        /// <param name="code">Code for forgot password registration.</param>
        /// <returns>Asynchronously send forgot password email.</returns>
        protected virtual async Task SendForgotPasswordEmail(TUser user, string code)
        {
#if !NETCORE
            var callbackUrl = this.Url.Action("ResetPassword", "Account", new { userId = user.Id, code = code }, protocol: Request.Url.Scheme);
            await this.UserManager.SendEmailAsync(user.Id, "Reset Password", "Please reset your password by clicking <a href=\"" + callbackUrl + "\">here</a>");
#else
            var callbackUrl = this.Url.Action("ResetPassword", "Account", new { userId = user.Id, code = code }, protocol: Request.Scheme);
            await MessageServices.SendEmailAsync(user.Id, "Reset Password", "Please reset your password by clicking <a href=\"" + callbackUrl + "\">here</a>");
#endif
        }
Пример #29
0
        protected IEnumerable <VengaMessage> GetMessagesFromEndpoint(Endpoint endpoint, int messageCount)
        {
            var brokeredMessagesList = MessageServices.GetMessagesFromEndpoint(endpoint, messageCount);
            var messagesToReturn     = new List <VengaMessage>();

            foreach (var message in brokeredMessagesList)
            {
                messagesToReturn.Add(VengaMessage.FromBrokeredMessage(message));
            }
            return(messagesToReturn);
        }
Пример #30
0
        protected void PurgeMessagesFromEndpoint(Endpoint endpoint)
        {
            Predicate <BrokeredMessage> deleteMessageChecker = (brokeredMessage) => true;
            var anyDeletions = MessageServices.DeleteSelectedMessagesFromEndpoint(endpoint, deleteMessageChecker);

            if (!anyDeletions)
            {
                throw new APIWarning(
                          "No messages were deleted. The endpoint may have been empty, or the messages may have already been consumed by another process.");
            }
        }
Пример #31
0
        public IMessageSenderService GetService(MessageServices service)
        {
            switch (service)
            {
            case MessageServices.ePochta:
                return(new EPochtaMessageService(_config.GetSection(Resources.Config.ePochta).GetValue <string>(Resources.Config.Token)));

            default:
                throw new NotSupportedException();
            }
        }
 public MessageController(MessageServices messageServices)
 {
     this.messageServices = messageServices;
 }