Compare commits

...

27 Commits

Author SHA1 Message Date
09ef1ca66e Niekompletna 2018-12-20 07:27:02 +00:00
20655b74f0 Dokumentacja z dodaną zmianą hasła 2018-12-20 06:34:34 +00:00
ff5163cea5 Delete 'instrukcja obsługi.pdf' 2018-12-20 06:34:10 +00:00
1ed563fc7c Dokumentacja z dodaną zmianą hasła 2018-12-20 06:33:41 +00:00
cd89c4bdf7 Delete 'Dokumentacja/instrukcja obsługi.pdf' 2018-12-20 06:33:00 +00:00
d98f7d101a Upload files to 'Dokumentacja' 2018-12-20 06:09:23 +00:00
81b497f02d Najnowsza architektura, poprawione błędy 2018-12-20 01:03:19 +00:00
95bae9565f Usuń 'Dokumentacja/Architektura najnowsza.pdf' 2018-12-20 01:02:55 +00:00
nlitkowski
007fe99f1b Merge branch 'master' of https://git.wmi.amu.edu.pl/s434799/Forum-Inzynieria1 2018-12-20 01:59:57 +01:00
nlitkowski
e9ed7d4b77 redirect do forum po mailu, bug fix, setings wywalone w kosmos 2018-12-20 01:59:38 +01:00
18038707d0 Poprawiona dokumentacja API 2018-12-20 00:29:52 +00:00
nlitkowski
3607ce2f2b naprawiony mailsener 2018-12-20 01:22:51 +01:00
7ef186c12b Plan forum z poprawionymi błędami 2018-12-20 00:09:30 +00:00
0e062a57e9 Najnowsza architektura, poprawione błędy 2018-12-19 23:53:58 +00:00
2cc1af2149 Usuń 'Dokumentacja/Poprawiona-architektura.docx' 2018-12-19 23:49:44 +00:00
c5ca2aa2dc Architektura najnowsza, poprawione błędy 2018-12-19 23:49:18 +00:00
5115b88e85 Prześlij pliki do 'Dokumentacja' 2018-12-19 22:36:45 +00:00
1a97cae65f Usuń 'Dokumentacja/Poprawiona architektura.pdf' 2018-12-19 22:35:59 +00:00
4f2e75eed1 Prześlij pliki do 'Dokumentacja' 2018-12-19 22:30:44 +00:00
cf4cc5650e Usuń 'Dokumentacja/Wstępna architektura systemu.pdf' 2018-12-19 22:28:51 +00:00
Bartosz Chyzy
a0c5d4357b Dodani usuwanie odpowiedzi 2018-12-19 23:26:12 +01:00
Bartosz Chyzy
d72384efe2 Norbert Litkowski nie umie w CSSa 2018-12-19 22:13:44 +01:00
Damian Lasecki
4240f1d563 Add style to edit and delete 2018-12-19 21:15:59 +01:00
Damian Lasecki
d9521ae99d Merge branch 'master' of https://git.wmi.amu.edu.pl/s434799/Forum-Inzynieria1 2018-12-19 21:13:11 +01:00
Damian Lasecki
fd836b41b5 Add style to edit and delete in category view 2018-12-19 21:12:04 +01:00
Bartosz Chyzy
88edf07e00 Zablokowano dostep do tworzenia kont przez randomow 2018-12-19 20:25:54 +01:00
Bartosz Chyzy
15830cf648 Pare spolszczen 2018-12-19 19:48:20 +01:00
27 changed files with 237 additions and 177 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -302,10 +302,20 @@ textarea {
background-color: #f2f2f2; background-color: #f2f2f2;
} }
.delete-category__span{
font-size:2rem;
font-weight:400;
margin-bottom:10rem;
}
.delete-category__dl {
height: 3rem;
margin-bottom: 3rem;
}
@media (min-width: 768px) { @media (min-width: 768px) {
@ -358,7 +368,8 @@ textarea {
flex-direction: row; flex-direction: row;
margin-top: 1rem; margin-top: 1rem;
} }
.form-personal-data{
.form-personal-data {
flex-direction: row; flex-direction: row;
} }
@ -367,10 +378,9 @@ textarea {
} }
.form-AddQuestion input[type=submit] { .form-AddQuestion input[type=submit] {
margin-top:0; margin-top: 0;
}
} }
}

View File

@ -136,7 +136,7 @@ namespace Forum.Controllers
// //
// GET: /Account/Register // GET: /Account/Register
[AllowAnonymous] [Authorize]
public ActionResult Register() public ActionResult Register()
{ {
return View(); return View();
@ -145,7 +145,7 @@ namespace Forum.Controllers
// //
// POST: /Account/Register // POST: /Account/Register
[HttpPost] [HttpPost]
[AllowAnonymous] [Authorize]
[ValidateAntiForgeryToken] [ValidateAntiForgeryToken]
public async Task<ActionResult> Register(RegisterViewModel model) public async Task<ActionResult> Register(RegisterViewModel model)
{ {

View File

@ -133,6 +133,25 @@ namespace Forum.Controllers
return RedirectToAction("Question", new {id = model.QuestionId}); return RedirectToAction("Question", new {id = model.QuestionId});
} }
[Authorize]
[System.Web.Mvc.Route("Home/DeleteAnswer/{id}")]
public ActionResult DeleteAnswer(int? id)
{
var answer = _dbContext.Answers.Find(id);
var question = _dbContext.Questions.FirstOrDefault(x => x.Answers.Any(y => y.Id == id));
if (answer != null)
{
_dbContext.Answers.Remove(answer);
_dbContext.SaveChanges();
}
if (question != null)
return RedirectToAction("Question", new {id = question.Id});
return HttpNotFound();
}
} }
} }

View File

@ -222,6 +222,8 @@
<Content Include="Content\bootstrap.css.map" /> <Content Include="Content\bootstrap.css.map" />
<Content Include="Content\bootstrap-theme.min.css.map" /> <Content Include="Content\bootstrap-theme.min.css.map" />
<Content Include="Content\bootstrap-theme.css.map" /> <Content Include="Content\bootstrap-theme.css.map" />
<None Include="Properties\PublishProfiles\forum-inzynieria1 - FTP.pubxml" />
<None Include="Properties\PublishProfiles\forum-inzynieria1 - Web Deploy.pubxml" />
<None Include="Scripts\jquery-3.3.1.intellisense.js" /> <None Include="Scripts\jquery-3.3.1.intellisense.js" />
<Content Include="Scripts\jquery-3.3.1.js" /> <Content Include="Scripts\jquery-3.3.1.js" />
<Content Include="Scripts\jquery-3.3.1.min.js" /> <Content Include="Scripts\jquery-3.3.1.min.js" />

View File

@ -41,7 +41,7 @@
</div> </div>
</div> </div>
<p> <p>
@Html.ActionLink("Utwórz nowego użytkownika", "Register") @*@Html.ActionLink("Utwórz nowego użytkownika", "Register")*@
</p> </p>
@* Enable this once you have account confirmation enabled for password reset functionality @* Enable this once you have account confirmation enabled for password reset functionality
<p> <p>

View File

@ -4,29 +4,31 @@
ViewBag.Title = "Delete"; ViewBag.Title = "Delete";
} }
<h2>Delete</h2> <div class="single-category-wrapper">
<h2>Usuwanie ketegorii</h2>
<hr style="border-top: 1px solid #d3d3d3;" />
<h3>Are you sure you want to delete this?</h3> <span class="delete-category__span">Jesteś pewien, że chcesz usunąć kategorię?</span>
<div> <div style="margin-top: 3rem;">
<h4>Category</h4>
<hr /> <dl class="dl-horizontal delete-category__dl">
<dl class="dl-horizontal"> <dt style="text-align:left">
<dt>
@Html.DisplayNameFor(model => model.CategoryName) @Html.DisplayNameFor(model => model.CategoryName)
</dt> </dt>
<dd style="margin-left:0;">
<dd>
@Html.DisplayFor(model => model.CategoryName) @Html.DisplayFor(model => model.CategoryName)
</dd> </dd>
</dl> </dl>
@using (Html.BeginForm()) { @using (Html.BeginForm())
{
@Html.AntiForgeryToken() @Html.AntiForgeryToken()
<div class="form-actions no-color"> <div class="form-actions no-color">
<input type="submit" value="Delete" class="btn btn-default" /> | <input type="submit" value="Usuń" class="answer-list__add-btn" style="height:4rem; width:17rem; background-color:#af4f4f; margin-bottom: 3rem;" />
@Html.ActionLink("Back to List", "Index") </div>
<div>@Html.ActionLink("Powrót do listy kategorii", "Index")
</div> </div>
} }
</div> </div>
</div>

View File

@ -4,19 +4,21 @@
ViewBag.Title = "Edit"; ViewBag.Title = "Edit";
} }
<h2>Edit</h2> <div class="single-category-wrapper">
<h2>Edytuj nazwię kategorii</h2>
<hr style="border-top: 1px solid #d3d3d3; margin-bottom: 3rem;" />
@using (Html.BeginForm())
{ @using (Html.BeginForm())
{
@Html.AntiForgeryToken() @Html.AntiForgeryToken()
<div class="form-horizontal"> <div class="form-horizontal">
<h4>Category</h4>
<hr />
@Html.ValidationSummary(true, "", new { @class = "text-danger" }) @Html.ValidationSummary(true, "", new { @class = "text-danger" })
@Html.HiddenFor(model => model.Id) @Html.HiddenFor(model => model.Id)
<div class="form-group"> <div class="form-group">
@Html.LabelFor(model => model.CategoryName, htmlAttributes: new { @class = "control-label col-md-2" }) @Html.LabelFor(model => model.CategoryName, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10"> <div class="col-md-10">
@ -24,19 +26,17 @@
@Html.ValidationMessageFor(model => model.CategoryName, "", new { @class = "text-danger" }) @Html.ValidationMessageFor(model => model.CategoryName, "", new { @class = "text-danger" })
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<div class="col-md-offset-2 col-md-10"> <div class="col-md-offset-2 col-md-10">
<input type="submit" value="Save" class="btn btn-default" /> <input type="submit" value="Zapisz" class="answer-list__add-btn" style="height:4rem; width:17rem" />
</div> </div>
</div> </div>
</div> </div>
} }
<div>
<div> @Html.ActionLink("Powrót do listy kategorii", "Index")
@Html.ActionLink("Back to List", "Index") </div>
</div> </div>
@section Scripts {
@section Scripts {
@Scripts.Render("~/bundles/jqueryval") @Scripts.Render("~/bundles/jqueryval")
} }

View File

@ -12,7 +12,7 @@
<table class="table"> <table class="table">
<tr> <tr>
<th> <th>
@Html.DisplayNameFor(model => model.CategoryName) Nazwa kategorii
</th> </th>
<th></th> <th></th>
</tr> </tr>

View File

@ -30,7 +30,7 @@
foreach (var answer in Model.Answers) foreach (var answer in Model.Answers)
{ {
<li class="answer-list__single-answer"> <li class="answer-list__single-answer">
<div class="answer-list__answer__info" @{if(answer.Professional!=null){<text>style="background-color: #7ecc2a"</text>}}> <div class="answer-list__answer__info" @{if (answer.Professional != null) { <text> style="background-color: #7ecc2a" </text> }}>
@{ @{
if (answer.Professional != null) if (answer.Professional != null)
{ {
@ -41,6 +41,12 @@
<span class="username">@answer.Nick napisał(a)</span> <span class="username">@answer.Nick napisał(a)</span>
} }
} }
@{
if (User.Identity.IsAuthenticated)
{
@Html.ActionLink("Usuń odpowiedź", "DeleteAnswer", new {id = answer.Id},new{@style="color:#fff;"});
}
}
@answer.Date @answer.Date
</div> </div>
<div class="answer-list__content"> <div class="answer-list__content">

View File

@ -9,7 +9,7 @@
<li> <li>
@Html.ActionLink("Witaj " + User.Identity.GetUserName() + "!", "Index", "Manage", routeValues: null, htmlAttributes: new { title = "Manage" }) @Html.ActionLink("Witaj " + User.Identity.GetUserName() + "!", "Index", "Manage", routeValues: null, htmlAttributes: new { title = "Manage" })
</li> </li>
<li>@Html.ActionLink("Zarejestruj się", "Register", "Account", routeValues: null, htmlAttributes: new { id = "registerLink" })</li> <li>@Html.ActionLink("Dodaj profesjonalistę", "Register", "Account", routeValues: null, htmlAttributes: new { id = "registerLink" })</li>
<li><a href="javascript:document.getElementById('logoutForm').submit()">Wyloguj się</a></li> <li><a href="javascript:document.getElementById('logoutForm').submit()">Wyloguj się</a></li>
</ul> </ul>
} }

View File

@ -12,7 +12,7 @@
<add name="DefaultConnection" connectionString="Data Source=(LocalDb)\MSSQLLocalDB;AttachDbFilename=|DataDirectory|\ForumInzyneria1.mdf;Initial Catalog=ForumInzyneria1;Integrated Security=True" providerName="System.Data.SqlClient" /> <add name="DefaultConnection" connectionString="Data Source=(LocalDb)\MSSQLLocalDB;AttachDbFilename=|DataDirectory|\ForumInzyneria1.mdf;Initial Catalog=ForumInzyneria1;Integrated Security=True" providerName="System.Data.SqlClient" />
</connectionStrings> </connectionStrings>
<appSettings> <appSettings>
<add key="MailSenderAddress" value="http://localhost:51829/Home/Index" /> <add key="MailSenderAddress" value="http://mailsender-inzynieria1.azurewebsites.net/Home/Index" />
<add key="webpages:Version" value="3.0.0.0" /> <add key="webpages:Version" value="3.0.0.0" />
<add key="webpages:Enabled" value="false" /> <add key="webpages:Enabled" value="false" />
<add key="ClientValidationEnabled" value="true" /> <add key="ClientValidationEnabled" value="true" />

View File

@ -301,6 +301,11 @@ textarea {
height: 200px; height: 200px;
} }
.w100 {
width: 100% !important;
max-width: 100% !important;
}
.form-emailsend .form-emailsend
{ {
color: black; color: black;

View File

@ -4,23 +4,36 @@ using System.Web.Mvc;
using System.Web.ModelBinding; using System.Web.ModelBinding;
using System; using System;
using Newtonsoft.Json; using Newtonsoft.Json;
using System.Configuration;
namespace MailSender.Controllers namespace MailSender.Controllers
{ {
[RoutePrefix("")]
public class HomeController : Controller public class HomeController : Controller
{ {
[HttpPost] [HttpPost]
public ActionResult Index([System.Web.Http.FromBody]MailDTO.MailDTO mail) public ActionResult Index([System.Web.Http.FromBody]MailDTO.MailDTO mail)
{ {
var model = new Models.MailModel(mail); var model = new Models.MailModel(mail);
TempData.Add("mailMod", model);
return View(model); return View(model);
} }
[HttpGet]
public ActionResult Index()
{
if(TempData["mailMod"] != null)
{
return View(TempData["mailMod"]);
}
return View(new Models.MailModel());
}
[System.Web.Http.HttpGet] [System.Web.Http.HttpGet]
public ActionResult Error(string errMsg) public ActionResult Error(string errMsg)
{ {
ViewData.Add("errMsg", errMsg); TempData.Add("errMsg", errMsg);
return View(); return RedirectToAction("Index");
} }
[System.Web.Mvc.HttpPost] [System.Web.Mvc.HttpPost]
@ -28,16 +41,19 @@ namespace MailSender.Controllers
{ {
if (ModelState.IsValid) if (ModelState.IsValid)
{ {
var smtpClient = new SmtpClient(Settings.smtpServer, Settings.smtpPort) var smtpClient = new SmtpClient(ConfigurationManager.AppSettings["smtp-server"],
Int32.Parse(ConfigurationManager.AppSettings["smtp-port"]))
{ {
Credentials = new NetworkCredential(Settings.user, Settings.pass), Credentials = new NetworkCredential(
ConfigurationManager.AppSettings["user-mail"],
ConfigurationManager.AppSettings["pass-mail"]),
EnableSsl = true EnableSsl = true
}; };
smtpClient.Send(Settings.user, model.EMailTo, model.Subject, model.Content); smtpClient.Send(ConfigurationManager.AppSettings["user-mail"], model.EMailTo, model.Subject, model.Content);
return RedirectToAction("Index"); return Redirect(ConfigurationManager.AppSettings["forum-address"]);
} }
else else
return RedirectToAction("Error", new { errMsg = "Error nie umiesz pisac maila menelu" }); return RedirectToAction("Error", new { errMsg = "Błąd wysyłania wiadomości e-mail." });
} }
} }
} }

View File

@ -175,7 +175,6 @@
</Compile> </Compile>
<Compile Include="Models\MailModel.cs" /> <Compile Include="Models\MailModel.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Settings.cs" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Content Include="Content\bootstrap-theme.css" /> <Content Include="Content\bootstrap-theme.css" />
@ -191,6 +190,8 @@
<Content Include="ApplicationInsights.config"> <Content Include="ApplicationInsights.config">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content> </Content>
<None Include="Properties\PublishProfiles\mailsender-inzynieria1 - FTP.pubxml" />
<None Include="Properties\PublishProfiles\mailsender-inzynieria1 - Web Deploy.pubxml" />
<None Include="Scripts\jquery-3.3.1.intellisense.js" /> <None Include="Scripts\jquery-3.3.1.intellisense.js" />
<Content Include="Scripts\jquery-3.3.1.js" /> <Content Include="Scripts\jquery-3.3.1.js" />
<Content Include="Scripts\jquery-3.3.1.min.js" /> <Content Include="Scripts\jquery-3.3.1.min.js" />

View File

@ -30,6 +30,10 @@ namespace MailSender.Models
[StringLength(500, ErrorMessage = "Message has to have between 1 and 500 chars", MinimumLength = 1)] [StringLength(500, ErrorMessage = "Message has to have between 1 and 500 chars", MinimumLength = 1)]
public string Content { get; set; } public string Content { get; set; }
public MailModel()
{
Content = EMailTo = Subject = string.Empty;
}
public MailModel(MailDTO.MailDTO DTO) public MailModel(MailDTO.MailDTO DTO)
{ {

View File

@ -1,10 +0,0 @@
namespace MailSender
{
public class Settings
{
public static string smtpServer = "smtp.gmail.com";
public static int smtpPort = 587;
public static string user = "ttestowy504@gmail.com";
public static string pass = "ChyzySoftware";
}
}

View File

@ -4,28 +4,30 @@
} }
@if (ViewData.ContainsKey("mailErr")) @if (TempData["mailErr"] != null)
{ {
<h3>Error: @ViewData["mailErr"]</h3> string errStr = TempData["mailErr"] as string;
<h3>Error: @TempData["mailErr"]</h3>
TempData["mailErr"] = null;
} }
@using (Html.BeginForm("Send", "Home", FormMethod.Post)) @using (Html.BeginForm("Send", "Home", FormMethod.Post))
{ {
<div class="form-group"> <div class="form-group">
@Html.LabelFor(i => i.Subject, new { @class = "label-form" }) @Html.LabelFor(i => i.Subject, new { @class = "label-form" })
@Html.EditorFor(i => i.Subject, new { htmlAttributes = new { @value = Model.Subject, @class = "form-control form-emailsend", @placeholder = "Temat" } }) @Html.EditorFor(i => i.Subject, new { htmlAttributes = new { @value = Model.Subject, @class = "form-control form-emailsend w100", @placeholder = "Temat" } })
@Html.ValidationMessageFor(i => i.Subject) @Html.ValidationMessageFor(i => i.Subject)
</div> </div>
<div class="form-group"> <div class="form-group">
@Html.LabelFor(i => i.EMailTo, new { @class = "label-form" }) @Html.LabelFor(i => i.EMailTo, new { @class = "label-form" })
@Html.EditorFor(i => i.EMailTo, new { htmlAttributes = new { @value = Model.EMailTo, @class = "form-control form-emailsend", @placeholder = "Do" } }) @Html.EditorFor(i => i.EMailTo, new { htmlAttributes = new { @value = Model.EMailTo, @class = "form-control form-emailsend w100", @placeholder = "Do" } })
@Html.ValidationMessageFor(i => i.EMailTo) @Html.ValidationMessageFor(i => i.EMailTo)
</div> </div>
<div class="form-group" > <div class="form-group" >
@Html.LabelFor(i => i.Content, new { @class = "label-form" }) @Html.LabelFor(i => i.Content, new { @class = "label-form" })
@Html.EditorFor(i => i.Content, new { htmlAttributes = new { @value = Model.Content, @class = "form-control", @id = "exampleFormControlTextarea3", @rows=9, @placeholder = "Odpowiedź" } }) @Html.EditorFor(i => i.Content, new { htmlAttributes = new { @value = Model.Content, @class = "form-control w100", @id = "exampleFormControlTextarea3", @rows=9, @placeholder = "Odpowiedź" } })
@Html.ValidationMessageFor(i => i.Content) @Html.ValidationMessageFor(i => i.Content)
</div> </div>

View File

@ -20,10 +20,8 @@
@Html.ActionLink("E-mail", "Index", "Home", new { area = "" }, new { @class = "navbar-brand" }) @Html.ActionLink("E-mail", "Index", "Home", new { area = "" }, new { @class = "navbar-brand" })
</div> </div>
<div class="navbar-collapse collapse"> <div class="navbar-collapse collapse">
<ul class="nav navbar-nav"> <ul class="nav navbar-nar">
<li>@Html.ActionLink("Strona Główna", "Index", "Home")</li>
<li>@Html.ActionLink("O mnie", "About", "Home")</li>
<li>@Html.ActionLink("Kontakt", "Contact", "Home")</li>
</ul> </ul>
</div> </div>
</div> </div>

View File

@ -10,6 +10,11 @@
</configSections> </configSections>
<appSettings> <appSettings>
<add key="webpages:Version" value="3.0.0.0" /> <add key="webpages:Version" value="3.0.0.0" />
<add key="user-mail" value="ttestowy504@gmail.com" />
<add key="pass-mail" value="ChyzySoftware" />
<add key="smtp-port" value="587" />
<add key="smtp-server" value="smtp.gmail.com" />
<add key="forum-address" value="http://forum-inzynieria1.azurewebsites.net/home/index"/>
<add key="webpages:Enabled" value="false" /> <add key="webpages:Enabled" value="false" />
<add key="ClientValidationEnabled" value="true" /> <add key="ClientValidationEnabled" value="true" />
<add key="UnobtrusiveJavaScriptEnabled" value="true" /> <add key="UnobtrusiveJavaScriptEnabled" value="true" />