diff --git a/Trunk/Server/Forum/Forum/Controllers/AccountController.cs b/Trunk/Server/Forum/Forum/Controllers/AccountController.cs index 1d438b5..7e4a6c7 100644 --- a/Trunk/Server/Forum/Forum/Controllers/AccountController.cs +++ b/Trunk/Server/Forum/Forum/Controllers/AccountController.cs @@ -136,7 +136,7 @@ namespace Forum.Controllers // // GET: /Account/Register - [Authorize] + [AllowAnonymous] public ActionResult Register() { return View(); @@ -145,7 +145,7 @@ namespace Forum.Controllers // // POST: /Account/Register [HttpPost] - [Authorize] + [AllowAnonymous] [ValidateAntiForgeryToken] public async Task Register(RegisterViewModel model) { diff --git a/Trunk/Server/Forum/Forum/Controllers/HomeController.cs b/Trunk/Server/Forum/Forum/Controllers/HomeController.cs index 826ca02..c9691d5 100644 --- a/Trunk/Server/Forum/Forum/Controllers/HomeController.cs +++ b/Trunk/Server/Forum/Forum/Controllers/HomeController.cs @@ -1,8 +1,12 @@ using System; +using System.Collections.Generic; +using System.Configuration; using System.Data.Entity; using System.Linq; +using System.Security.Principal; using System.Threading.Tasks; using System.Web.Mvc; +using Fluentx.Mvc; using Forum.DataAccessLayer; using Forum.DataAccessLayer.Models; using Forum.ViewModels; @@ -113,6 +117,19 @@ namespace Forum.Controllers question.Answers.Add(answer); _dbContext.SaveChanges(); + //Logika wysylania maili + if (User.Identity.IsAuthenticated && !string.IsNullOrEmpty(question.ReportersEmail)) + { + var dataToPost = new Dictionary(); + dataToPost.Add("Subject",question.Title); + dataToPost.Add("EMailTo",question.ReportersEmail); + dataToPost.Add("Content",model.Content); + + return this.RedirectAndPost(ConfigurationManager.AppSettings["MailSenderAddress"], dataToPost); + } + + + return RedirectToAction("Question", new {id = model.QuestionId}); } diff --git a/Trunk/Server/Forum/Forum/Forum.csproj b/Trunk/Server/Forum/Forum/Forum.csproj index cbc2c7d..5fc9d28 100644 --- a/Trunk/Server/Forum/Forum/Forum.csproj +++ b/Trunk/Server/Forum/Forum/Forum.csproj @@ -47,6 +47,12 @@ 4 + + ..\packages\Fluentx.2.0.4\lib\Fluentx.dll + + + ..\packages\Fluentx.Mvc.1.0.4\lib\Fluentx.Mvc.dll + ..\packages\Microsoft.AspNet.TelemetryCorrelation.1.0.4\lib\net45\Microsoft.AspNet.TelemetryCorrelation.dll diff --git a/Trunk/Server/Forum/Forum/Web.config b/Trunk/Server/Forum/Forum/Web.config index 7b4ee10..43c4fef 100644 --- a/Trunk/Server/Forum/Forum/Web.config +++ b/Trunk/Server/Forum/Forum/Web.config @@ -12,6 +12,7 @@ + @@ -86,7 +87,7 @@ - + diff --git a/Trunk/Server/Forum/Forum/packages.config b/Trunk/Server/Forum/Forum/packages.config index f1953cb..efd1174 100644 --- a/Trunk/Server/Forum/Forum/packages.config +++ b/Trunk/Server/Forum/Forum/packages.config @@ -3,6 +3,8 @@ + + diff --git a/Trunk/Server/Forum/MailSender/Controllers/DefaultController.cs b/Trunk/Server/Forum/MailSender/Controllers/DefaultController.cs index b310220..835d825 100644 --- a/Trunk/Server/Forum/MailSender/Controllers/DefaultController.cs +++ b/Trunk/Server/Forum/MailSender/Controllers/DefaultController.cs @@ -13,8 +13,8 @@ namespace MailSender.Controllers [HttpGet] public ActionResult Index() { - var model = JsonConvert.SerializeObject(new Models.MailModel() { Content = "DDD", EMailTo = "ddd@o2.pl", Subject = "LLLLLL" }); - TempData.Add("mailModel", model); + //var model = JsonConvert.SerializeObject(new Models.MailModel() { Content = "DDD", EMailTo = "ddd@o2.pl", Subject = "LLLLLL" }); + //TempData.Add("mailModel", model); return RedirectToAction("Index", "Home"); } }