Browse Source

Fixed profile bugs

tags/2.0.3
Teknikode 4 years ago
parent
commit
17f21194da

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

@@ -73,6 +73,7 @@ namespace Teknik.Areas.Profile.Controllers

[HttpPost]
[AllowAnonymous]
[ValidateAntiForgeryToken]
public ActionResult Login(LoginViewModel model)
{
if (ModelState.IsValid)
@@ -115,6 +116,7 @@ namespace Teknik.Areas.Profile.Controllers

[HttpPost]
[AllowAnonymous]
[ValidateAntiForgeryToken]
public ActionResult Register(RegisterViewModel model)
{
if (ModelState.IsValid)
@@ -198,7 +200,7 @@ namespace Teknik.Areas.Profile.Controllers

[HttpPost]
[ValidateAntiForgeryToken]
public ActionResult Delete(int postID)
public ActionResult Delete()
{
if (ModelState.IsValid)
{
@@ -207,7 +209,7 @@ namespace Teknik.Areas.Profile.Controllers
{
db.Users.Remove(user);
db.SaveChanges();
return Redirect(Url.SubRouteUrl("www", "Home.Index"));
return Logout();
}
}
return Json(new { error = "Unable to delete user." });

+ 3
- 2
Teknik/Areas/Profile/Scripts/Profile.js View File

@@ -5,6 +5,7 @@
$.ajax({
type: "POST",
url: deleteUserURL,
data: AddAntiForgeryToken({}),
success: function (html) {
if (html.result) {
window.location.reload();
@@ -34,7 +35,7 @@
$.ajax({
type: "POST",
url: editUserURL,
data: {
data: AddAntiForgeryToken({
curPass: current_password,
newPass: password,
newPassConfirm: password_confirm,
@@ -43,7 +44,7 @@
about: about,
blogTitle: blog_title,
blogDesc: blog_desc
},
}),
success: function (html) {
if (html.result) {
$.unblockUI();

+ 1
- 1
Teknik/Areas/Profile/Views/Profile/Register.cshtml View File

@@ -1,6 +1,6 @@
@model Teknik.Areas.Profile.ViewModels.RegisterViewModel

<form role="form" id="registrationForm" action="@Url.Action("profile", "Profile.Register")" method="post" accept-charset="UTF-8">
<form role="form" id="registrationForm" action="@Url.SubRouteUrl("profile", "Profile.Register")" method="post" accept-charset="UTF-8">
<input name="ReturnUrl" id="ReturnUrl" type="hidden" value="@Model.ReturnUrl" />
<div class="form-group">
<input type="text" class="form-control" id="Username" value="" placeholder="Username" name="Username" data-val-required="The Username field is required." data-val="true"/>

Loading…
Cancel
Save