Browse Source

Changed login url

tags/2.0.3
Teknikode 4 years ago
parent
commit
344985e14a

+ 21
- 1
Teknik/Areas/Blog/Controllers/BlogController.cs View File

@@ -164,7 +164,27 @@ namespace Teknik.Areas.Blog.Controllers
}
return Json(new { error = "No post found" });
}

[HttpPost]
[ValidateAntiForgeryToken]
public ActionResult PublishPost(int postID, bool publish)
{
if (ModelState.IsValid)
{
Post post = db.Posts.Find(postID);
if (post != null)
{
post.Published = publish;
if (publish)
post.DatePublished = DateTime.Now;
db.Entry(post).State = EntityState.Modified;
db.SaveChanges();
return Json(new { result = true });
}
}
return Json(new { error = "No post found" });
}

[HttpPost]
[ValidateAntiForgeryToken]
public ActionResult DeletePost(int postID)

+ 6
- 6
Teknik/Areas/Blog/Scripts/Blog.js View File

@@ -205,14 +205,14 @@ function linkPostUnpublish(selector) {
$.ajax({
type: "POST",
url: publishPostURL,
data: AddAntiForgeryToken({ publish: false, postID: post_id }),
data: AddAntiForgeryToken({ postID: post_id, publish: false }),
success: function (html) {
if (html == 'true') {
if (html.result) {
window.location.reload();
}
else {
$("#top_msg").css('display', 'inline', 'important');
$("#top_msg").html('<div class="alert alert-danger alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>' + html + '</div>');
$("#top_msg").html('<div class="alert alert-danger alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>' + html.error + '</div>');
}
}
});
@@ -226,14 +226,14 @@ function linkPostPublish(selector) {
$.ajax({
type: "POST",
url: publishPostURL,
data: AddAntiForgeryToken({ publish: true, postID: post_id }),
data: AddAntiForgeryToken({postID: post_id, publish: true }),
success: function (html) {
if (html == 'true') {
if (html.result) {
window.location.reload();
}
else {
$("#top_msg").css('display', 'inline', 'important');
$("#top_msg").html('<div class="alert alert-danger alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>' + html + '</div>');
$("#top_msg").html('<div class="alert alert-danger alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>' + html.error + '</div>');
}
}
});

+ 2
- 13
Teknik/Areas/Blog/Views/Blog/Posts.cshtml View File

@@ -1,17 +1,6 @@
@model List<Teknik.Areas.Blog.ViewModels.PostViewModel>

@if (Model.Any())
@foreach (var post in Model)
{
foreach (var post in Model)
{
@Html.Partial("Post", post)
}
}
else
{
<div class="row">
<div class="col-sm-12 text-center">
<h2>There are currently no articles.</h2>
</div>
</div>
@Html.Partial("Post", post)
}

+ 1
- 1
Teknik/Areas/Blog/Views/Blog/ViewPost.cshtml View File

@@ -131,7 +131,7 @@
</div>
}
<a name="replies"></a>
<div class="post-comments" id="<?php echo $post_id; ?>"></div>
<div class="post-comments" id="@Model.PostId"></div>
<script>
var converter = new Markdown.getSanitizingConverter();
// Title Conversion

+ 2
- 1
Teknik/Areas/Profile/Controllers/ProfileController.cs View File

@@ -17,6 +17,7 @@ namespace Teknik.Areas.Profile.Controllers
private TeknikEntities db = new TeknikEntities();

// GET: Profile/Profile
[AllowAnonymous]
public ActionResult Index(string username)
{
ViewBag.Title = Config.Title + " - Profile";
@@ -30,7 +31,7 @@ namespace Teknik.Areas.Profile.Controllers
// GET: Profile
public ActionResult Login()
{
return View();
return View(new LoginViewModel());
}

[HttpPost]

+ 3
- 1
Teknik/Web.config View File

@@ -28,7 +28,9 @@
-->
<system.web>
<customErrors mode="Off" />
<authentication mode="Forms" />
<authentication mode="Forms">
<forms loginUrl="~/Profile/Login" timeout="2880" />
</authentication>
<compilation debug="true" targetFramework="4.5.2" />
<httpRuntime targetFramework="4.5.2" />
</system.web>

Loading…
Cancel
Save