Browse Source

Updated all scripts to use the parseErrorMessage() function for grabbing the error message out of the response.

pull/111/head
Teknikode 5 years ago
parent
commit
076d99a698
  1. 6
      Teknik/Areas/Admin/Controllers/AdminController.cs
  2. 34
      Teknik/Areas/Admin/Scripts/UploadSearch.js
  3. 16
      Teknik/Areas/Admin/Scripts/UserSearch.js
  4. 56
      Teknik/Areas/Blog/Scripts/Blog.js
  5. 10
      Teknik/Areas/Contact/Scripts/Contact.js
  6. 50
      Teknik/Areas/Podcast/Scripts/Podcast.js
  7. 17
      Teknik/Areas/Shortener/Scripts/Shortener.js
  8. 10
      Teknik/Areas/Status/Scripts/Status.js
  9. 10
      Teknik/Areas/Upload/Scripts/Upload.js
  10. 6
      Teknik/Areas/User/Scripts/BlogSettings.js
  11. 12
      Teknik/Areas/User/Scripts/CheckAuthCode.js
  12. 20
      Teknik/Areas/User/Scripts/Profile.js
  13. 6
      Teknik/Areas/User/Scripts/ProfileSettings.js
  14. 12
      Teknik/Areas/User/Scripts/ResetPass.js
  15. 42
      Teknik/Areas/User/Scripts/SecuritySettings.js
  16. 6
      Teknik/Areas/User/Scripts/Settings.js
  17. 6
      Teknik/Areas/User/Scripts/UploadSettings.js
  18. 22
      Teknik/Areas/Vault/Scripts/Vault.js

6
Teknik/Areas/Admin/Controllers/AdminController.cs

@ -63,7 +63,7 @@ namespace Teknik.Areas.Admin.Controllers @@ -63,7 +63,7 @@ namespace Teknik.Areas.Admin.Controllers
var results = db.Users.Where(u => u.Username.Contains(query)).ToList();
if (results != null)
{
foreach (Users.Models.User user in results)
foreach (User user in results)
{
try
{
@ -84,7 +84,7 @@ namespace Teknik.Areas.Admin.Controllers @@ -84,7 +84,7 @@ namespace Teknik.Areas.Admin.Controllers
}
}
return PartialView("~/Areas/Admin/Views/Admin/UserResults.cshtml", models);
return Json(new { result = new { html = PartialView("~/Areas/Admin/Views/Admin/UserResults.cshtml", models) } });
}
[HttpPost]
@ -102,7 +102,7 @@ namespace Teknik.Areas.Admin.Controllers @@ -102,7 +102,7 @@ namespace Teknik.Areas.Admin.Controllers
model.Downloads = foundUpload.Downloads;
model.DeleteKey = foundUpload.DeleteKey;
return PartialView("~/Areas/Admin/Views/Admin/UploadResult.cshtml", model);
return Json(new { result = new { html = PartialView("~/Areas/Admin/Views/Admin/UploadResult.cshtml", model) } });
}
return Json(new { error = new { message = "Upload does not exist" } });
}

34
Teknik/Areas/Admin/Scripts/UploadSearch.js

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
$(document).ready(function () {
$(document).ready(function () {
$('#Query').on('input', function (e) {
query = $(this).val();
@ -12,18 +12,16 @@ @@ -12,18 +12,16 @@
type: "POST",
url: searchResultsURL,
data: { url: query },
success: function (html) {
if (html) {
if (html.error) {
$("#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.error.message + '</div>');
}
else {
$("#top_msg").css('display', 'none');
$("#top_msg").html('');
$("#results").html(html);
LinkUploadDelete($('.delete-upload-button'));
}
success: function (response) {
if (response.result) {
$("#top_msg").css('display', 'none');
$("#top_msg").html('');
$("#results").html(response.result.html);
LinkUploadDelete($('.delete-upload-button'));
}
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>' + parseErrorMessage(response) + '</div>');
}
}
});
@ -49,14 +47,14 @@ function LinkUploadDelete(selector) { @@ -49,14 +47,14 @@ function LinkUploadDelete(selector) {
xhrFields: {
withCredentials: true
},
success: function (html) {
if (html.result) {
window.open(html.result.url, '_blank');
success: function (response) {
if (response.result) {
window.open(response.result.url, '_blank');
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.error.message + '</div>');
$("#top_msg").html('<div class="alert alert-danger alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>' + parseErrorMessage(response) + '</div>');
}
}
});
@ -64,4 +62,4 @@ function LinkUploadDelete(selector) { @@ -64,4 +62,4 @@ function LinkUploadDelete(selector) {
}
});
});
}
}

16
Teknik/Areas/Admin/Scripts/UserSearch.js

@ -5,15 +5,13 @@ $(document).ready(function () { @@ -5,15 +5,13 @@ $(document).ready(function () {
type: "POST",
url: userSearchResultsURL,
data: { query: query },
success: function (html) {
if (html) {
if (html.error) {
$("#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.error + '</div>');
}
else {
$("#results").html(html);
}
success: function (response) {
if (response.result) {
$("#results").html(response.result.html);
}
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>' + parseErrorMessage(response) + '</div>');
}
}
});

56
Teknik/Areas/Blog/Scripts/Blog.js

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
$(document).ready(function () {
$(document).ready(function () {
$("textarea.mdd_editor").MarkdownDeep({
help_location: helpURL,
disableTabHandling: false,
@ -16,13 +16,13 @@ @@ -16,13 +16,13 @@
type: "POST",
url: addCommentURL,
data: { postID: postID, article: post },
success: function (html) {
if (html.result) {
success: function (response) {
if (response.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.error + '</div>');
$("#top_msg").html('<div class="alert alert-danger alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>' + parseErrorMessage(response) + '</div>');
}
}
});
@ -37,9 +37,9 @@ @@ -37,9 +37,9 @@
type: "POST",
url: getCommentArticleURL,
data: { commentID: commentID },
success: function (html) {
if (html.result) {
$("#edit_comment_post").val(html.result);
success: function (response) {
if (response.result) {
$("#edit_comment_post").val(response.result);
}
}
});
@ -53,13 +53,13 @@ @@ -53,13 +53,13 @@
type: "POST",
url: editCommentURL,
data: { commentID: postID, article: post },
success: function (html) {
if (html.result) {
success: function (response) {
if (response.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.error + '</div>');
$("#top_msg").html('<div class="alert alert-danger alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>' + parseErrorMessage(response) + '</div>');
}
}
});
@ -73,9 +73,9 @@ function loadMorePosts(start, count) { @@ -73,9 +73,9 @@ function loadMorePosts(start, count) {
type: "POST",
url: getPostsURL,
data: { blogID: blog_id, count: count, startPostID: start },
success: function (html) {
if (html) {
$(".blog-main").append(html);
success: function (response) {
if (response) {
$(".blog-main").append(response);
linkPostDelete('.delete_post');
linkPostPublish('.publish_post');
linkPostUnpublish('.unpublish_post');
@ -91,9 +91,9 @@ function loadMoreComments(start, count) { @@ -91,9 +91,9 @@ function loadMoreComments(start, count) {
type: "POST",
url: getCommentsURL,
data: { postID: post_id, count: count, startCommentID: start },
success: function (html) {
if (html) {
$(".post-comments").append(html);
success: function (response) {
if (response) {
$(".post-comments").append(response);
linkCommentDelete('.delete_comment');
$(window).bind('scroll', bindScrollComments);
}
@ -125,13 +125,13 @@ function linkPostUnpublish(selector) { @@ -125,13 +125,13 @@ function linkPostUnpublish(selector) {
type: "POST",
url: publishPostURL,
data: { postID: post_id, publish: false },
success: function (html) {
if (html.result) {
success: function (response) {
if (response.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.error + '</div>');
$("#top_msg").html('<div class="alert alert-danger alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>' + parseErrorMessage(response) + '</div>');
}
}
});
@ -146,13 +146,13 @@ function linkPostPublish(selector) { @@ -146,13 +146,13 @@ function linkPostPublish(selector) {
type: "POST",
url: publishPostURL,
data: {postID: post_id, publish: true },
success: function (html) {
if (html.result) {
success: function (response) {
if (response.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.error + '</div>');
$("#top_msg").html('<div class="alert alert-danger alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>' + parseErrorMessage(response) + '</div>');
}
}
});
@ -169,13 +169,13 @@ function linkPostDelete(selector) { @@ -169,13 +169,13 @@ function linkPostDelete(selector) {
type: "POST",
url: deletePostURL,
data: { postID: post_id },
success: function (html) {
if (html.result) {
success: function (response) {
if (response.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.error + '</div>');
$("#top_msg").html('<div class="alert alert-danger alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>' + parseErrorMessage(response) + '</div>');
}
}
});
@ -194,13 +194,13 @@ function linkCommentDelete(selector) { @@ -194,13 +194,13 @@ function linkCommentDelete(selector) {
type: "POST",
url: deleteCommentURL,
data: { commentID: post_id },
success: function (html) {
if (html.result) {
success: function (response) {
if (response.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.error + '</div>');
$("#top_msg").html('<div class="alert alert-danger alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>' + parseErrorMessage(response) + '</div>');
}
}
});

10
Teknik/Areas/Contact/Scripts/Contact.js

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
$(document).ready(function () {
$(document).ready(function () {
$("#contact_submit").click(function () {
var form = $('#contactForm');
$.validator.unobtrusive.parse(form);
@ -7,8 +7,8 @@ @@ -7,8 +7,8 @@
type: "POST",
url: form.attr('action'),
data: form.serialize(),
success: function (html) {
if (html.result == 'true') {
success: function (response) {
if (response.result == 'true') {
$('#contactForm').each(function(){
this.reset();
});
@ -17,11 +17,11 @@ @@ -17,11 +17,11 @@
}
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.error + '</div>');
$("#top_msg").html('<div class="alert alert-danger alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>' + parseErrorMessage(response) + '</div>');
}
}
});
}
return false;
});
});
});

50
Teknik/Areas/Podcast/Scripts/Podcast.js

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
$(document).ready(function () {
$(document).ready(function () {
$("#podcast_submit").click(function () {
$.blockUI({ message: '<div class="text-center"><h3>Saving...</h3></div>' });
$('#newPodcast').modal('hide');
@ -27,11 +27,8 @@ @@ -27,11 +27,8 @@
window.location.reload();
}
else {
var error = obj;
if (obj.error)
error = obj.error;
$("#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>' + error + '</div>');
$("#top_msg").html('<div class="alert alert-danger alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>' + parseErrorMessage(obj) + '</div>');
}
}
};
@ -135,11 +132,8 @@ @@ -135,11 +132,8 @@
window.location.reload();
}
else {
var error = obj;
if (obj.error)
error = obj.error;
$("#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>' + error + '</div>');
$("#top_msg").html('<div class="alert alert-danger alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>' + parseErrorMessage(obj) + '</div>');
}
}
};
@ -154,13 +148,13 @@ @@ -154,13 +148,13 @@
type: "POST",
url: addCommentURL,
data: { podcastId: postID, article: post },
success: function (html) {
if (html.result) {
success: function (response) {
if (response.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.error + '</div>');
$("#top_msg").html('<div class="alert alert-danger alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>' + parseErrorMessage(response) + '</div>');
}
}
});
@ -191,13 +185,13 @@ @@ -191,13 +185,13 @@
type: "POST",
url: editCommentURL,
data: { commentID: postID, article: post },
success: function (html) {
if (html.result) {
success: function (response) {
if (response.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.error + '</div>');
$("#top_msg").html('<div class="alert alert-danger alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>' + parseErrorMessage(response) + '</div>');
}
}
});
@ -263,13 +257,13 @@ function linkPodcastUnpublish(selector) { @@ -263,13 +257,13 @@ function linkPodcastUnpublish(selector) {
type: "POST",
url: publishPodcastURL,
data: { podcastId: podcastId, publish: false },
success: function (html) {
if (html.result) {
success: function (response) {
if (response.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.error + '</div>');
$("#top_msg").html('<div class="alert alert-danger alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>' + parseErrorMessage(response) + '</div>');
}
}
});
@ -284,13 +278,13 @@ function linkPodcastPublish(selector) { @@ -284,13 +278,13 @@ function linkPodcastPublish(selector) {
type: "POST",
url: publishPodcastURL,
data: { podcastId: podcastId, publish: true },
success: function (html) {
if (html.result) {
success: function (response) {
if (response.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.error + '</div>');
$("#top_msg").html('<div class="alert alert-danger alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>' + parseErrorMessage(response) + '</div>');
}
}
});
@ -307,13 +301,13 @@ function linkPodcastDelete(selector) { @@ -307,13 +301,13 @@ function linkPodcastDelete(selector) {
type: "POST",
url: deletePodcastURL,
data: { podcastId: podcastId },
success: function (html) {
if (html.result) {
success: function (response) {
if (response.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.error + '</div>');
$("#top_msg").html('<div class="alert alert-danger alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>' + parseErrorMessage(response) + '</div>');
}
}
});
@ -348,17 +342,17 @@ function linkCommentDelete(selector) { @@ -348,17 +342,17 @@ function linkCommentDelete(selector) {
type: "POST",
url: deleteCommentURL,
data: { commentID: post_id },
success: function (html) {
if (html.result) {
success: function (response) {
if (response.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.error + '</div>');
$("#top_msg").html('<div class="alert alert-danger alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>' + parseErrorMessage(response) + '</div>');
}
}
});
}
});
});
}
}

17
Teknik/Areas/Shortener/Scripts/Shortener.js

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
$(document).ready(function () {
$(document).ready(function () {
$('#url').focus();
$("#shortenSubmit").click(function () {
@ -9,18 +9,13 @@ @@ -9,18 +9,13 @@
type: "POST",
url: $("#shortenerForm").attr('action'),
data: { url: url },
success: function (html) {
if (html.result) {
$('#url').val(html.result.shortUrl);
success: function (response) {
if (response.result) {
$('#url').val(response.result.shortUrl);
}
else {
var errorMsg = "Invalid Url";
if (html.error)
{
errorMsg = html.error;
}
$("#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>' + errorMsg + '</div>');
$("#top_msg").html('<div class="alert alert-danger alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>' + parseErrorMessage(response) + '</div>');
}
$('#url').focus();
$('#url').select();
@ -33,4 +28,4 @@ @@ -33,4 +28,4 @@
$("#top_msg").css('display', 'none', 'important');
$("#top_msg").html('');
});
});
});

10
Teknik/Areas/Status/Scripts/Status.js

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
var cpuUsageChart;
var cpuUsageChart;
var memUsageChart;
var networkUsageChart;
@ -346,12 +346,8 @@ $(document).ready(function () { @@ -346,12 +346,8 @@ $(document).ready(function () {
visitChart.redraw();
}
else {
var err = response;
if (response.error) {
err = response.error.message;
}
$("#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>' + err + '</div>');
$("#top_msg").html('<div class="alert alert-danger alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>' + parseErrorMessage(response) + '</div>');
}
}
});
@ -368,4 +364,4 @@ $(document).ready(function () { @@ -368,4 +364,4 @@ $(document).ready(function () {
memUsageChart.setSize($('#mem-usage-chart').width(), $('#mem-usage-chart').height());
networkUsageChart.setSize($('#network-usage-chart').width(), $('#network-usage-chart').height());
})
});
});

10
Teknik/Areas/Upload/Scripts/Upload.js

@ -29,15 +29,15 @@ function linkShortenUrl(element, fileID, url) { @@ -29,15 +29,15 @@ function linkShortenUrl(element, fileID, url) {
type: "POST",
url: shortenURL,
data: { url: url },
success: function (html) {
if (html.result) {
success: function (response) {
if (response.result) {
element.prop('disabled', true);
$('#upload-panel-' + fileID).find('#upload-link').attr('href', html.result.shortUrl);
$('#upload-panel-' + fileID).find('#upload-link').text(html.result.shortUrl);
$('#upload-panel-' + fileID).find('#upload-link').attr('href', response.result.shortUrl);
$('#upload-panel-' + fileID).find('#upload-link').text(response.result.shortUrl);
}
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.error + '</div>');
$("#top_msg").html('<div class="alert alert-danger alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>' + parseErrorMessage(response) + '</div>');
}
}
});

6
Teknik/Areas/User/Scripts/BlogSettings.js

@ -12,15 +12,15 @@ $(document).ready(function () { @@ -12,15 +12,15 @@ $(document).ready(function () {
Title: blog_title,
Description: blog_desc,
}),
success: function (html) {
success: function (response) {
$.unblockUI();
if (html.result) {
if (response.result) {
$("#top_msg").css('display', 'inline', 'important');
$("#top_msg").html('<div class="alert alert-success alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>Settings Saved!</div>');
}
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>' + parseErrorMessage(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>' + parseErrorMessage(response) + '</div>');
}
}
});

12
Teknik/Areas/User/Scripts/CheckAuthCode.js

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
$(document).ready(function () {
$(document).ready(function () {
$("#authCheckStatus").css('display', 'none', 'important');
$('#Code').focus();
@ -25,16 +25,16 @@ @@ -25,16 +25,16 @@
xhrFields: {
withCredentials: true
},
success: function (html) {
if (html.result) {
window.location = html.result;
success: function (response) {
if (response.result) {
window.location = response.result;
}
else {
$("#authCheckStatus").css('display', 'inline', 'important');
$("#authCheckStatus").html('<div class="alert alert-danger alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>' + html.error + '</div>');
$("#authCheckStatus").html('<div class="alert alert-danger alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>' + parseErrorMessage(response) + '</div>');
}
}
});
return false;
});
});
});

20
Teknik/Areas/User/Scripts/Profile.js

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
$(document).ready(function () {
$(document).ready(function () {
$('.delete-upload-button').click(function () {
var deleteUrl = $(this).attr('id');
var uploadID = $(this).data('upload-id');
@ -17,14 +17,14 @@ @@ -17,14 +17,14 @@
xhrFields: {
withCredentials: true
},
success: function (html) {
if (html.result) {
window.open(html.result.url, '_blank');
success: function (response) {
if (response.result) {
window.open(response.result.url, '_blank');
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.error.message + '</div>');
$("#top_msg").html('<div class="alert alert-danger alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>' + parseErrorMessage(response) + '</div>');
}
}
});
@ -45,17 +45,17 @@ @@ -45,17 +45,17 @@
xhrFields: {
withCredentials: true
},
success: function (html) {
if (html.result) {
window.location = html.result.url;
success: function (response) {
if (response.result) {
window.location = response.result.url;
}
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.error.message + '</div>');
$("#top_msg").html('<div class="alert alert-danger alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>' + parseErrorMessage(response) + '</div>');
}
}
});
}
});
});
});
});

6
Teknik/Areas/User/Scripts/ProfileSettings.js

@ -14,15 +14,15 @@ $(document).ready(function () { @@ -14,15 +14,15 @@ $(document).ready(function () {
Quote: quote,
About: about
}),
success: function (html) {
success: function (response) {
$.unblockUI();
if (html.result) {
if (response.result) {
$("#top_msg").css('display', 'inline', 'important');
$("#top_msg").html('<div class="alert alert-success alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>Settings Saved!</div>');
}
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>' + parseErrorMessage(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>' + parseErrorMessage(response) + '</div>');
}
}
});

12
Teknik/Areas/User/Scripts/ResetPass.js

@ -8,14 +8,14 @@ $(document).ready(function () { @@ -8,14 +8,14 @@ $(document).ready(function () {
data: AddAntiForgeryToken({
username: username
}),
success: function (html) {
if (html.result) {
success: function (response) {
if (response.result) {
$("#top_msg").css('display', 'inline', 'important');
$("#top_msg").html('<div class="alert alert-success alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>The Password Reset Link has been sent to your recovery email.</div>');
}
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>' + parseErrorMessage(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>' + parseErrorMessage(response) + '</div>');
}
}
});
@ -33,14 +33,14 @@ $(document).ready(function () { @@ -33,14 +33,14 @@ $(document).ready(function () {
Password: password,
PasswordConfirm: confirmPassword
}),
success: function (html) {
if (html.result) {
success: function (response) {
if (response.result) {
$("#top_msg").css('display', 'inline', 'important');
$("#top_msg").html('<div class="alert alert-success alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>Password has successfully been reset.</div>');
}
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>' + parseErrorMessage(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>' + parseErrorMessage(response) + '</div>');
}
}
});

42
Teknik/Areas/User/Scripts/SecuritySettings.js

@ -7,14 +7,14 @@ $(document).ready(function () { @@ -7,14 +7,14 @@ $(document).ready(function () {
type: "POST",
url: resendVerifyURL,
data: AddAntiForgeryToken({}),
success: function (html) {
if (html.result) {
success: function (response) {
if (response.result) {
$("#top_msg").css('display', 'inline', 'important');
$("#top_msg").html('<div class="alert alert-info alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>Recovery Email Verification Sent.</div>');
}
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>' + parseErrorMessage(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>' + parseErrorMessage(response) + '</div>');
}
}
});
@ -38,14 +38,14 @@ $(document).ready(function () { @@ -38,14 +38,14 @@ $(document).ready(function () {
data: AddAntiForgeryToken({
code: setCode
}),
success: function (html) {
if (html.result) {
success: function (response) {
if (response.result) {
$("#authSetupStatus").css('display', 'inline', 'important');
$("#authSetupStatus").html('<div class="alert alert-success alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>Success!</div>');
}
else {
$("#authSetupStatus").css('display', 'inline', 'important');
$("#authSetupStatus").html('<div class="alert alert-danger alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>' + parseErrorMessage(html) + '</div>');
$("#authSetupStatus").html('<div class="alert alert-danger alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>' + parseErrorMessage(response) + '</div>');
}
}
});
@ -56,15 +56,15 @@ $(document).ready(function () { @@ -56,15 +56,15 @@ $(document).ready(function () {
type: "POST",
url: clearTrustedDevicesURL,
data: AddAntiForgeryToken({}),
success: function (html) {
if (html.result) {
success: function (response) {
if (response.result) {
$('#ClearDevices').html('Clear Trusted Devices (0)');
$("#top_msg").css('display', 'inline', 'important');
$("#top_msg").html('<div class="alert alert-success alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>Successfully Cleared Trusted Devices</div>');
}
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>' + parseErrorMessage(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>' + parseErrorMessage(response) + '</div>');
}
}
});
@ -151,14 +151,14 @@ $(document).ready(function () { @@ -151,14 +151,14 @@ $(document).ready(function () {
TwoFactorEnabled: update_security_two_factor,
RecoveryEmail: recovery
}),
success: function (html) {
success: function (response) {
$.unblockUI();
if (html.result) {
if (html.result.checkAuth)
if (response.result) {
if (response.result.checkAuth)
{
$('#setupAuthenticatorLink').removeClass('hide');
$('#authSetupSecretKey').text(html.result.key);
$('#authQRCode').attr("src", html.result.qrUrl);
$('#authSetupSecretKey').text(response.result.key);
$('#authQRCode').attr("src", response.result.qrUrl);
$('#authenticatorSetup').modal('show');
}
else
@ -169,7 +169,7 @@ $(document).ready(function () { @@ -169,7 +169,7 @@ $(document).ready(function () {
}
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>' + parseErrorMessage(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>' + parseErrorMessage(response) + '</div>');
}
}
});
@ -185,14 +185,14 @@ $(document).ready(function () { @@ -185,14 +185,14 @@ $(document).ready(function () {
data: AddAntiForgeryToken({
username: username
}),
success: function (html) {
if (html.result) {
success: function (response) {
if (response.result) {
$("#top_msg").css('display', 'inline', 'important');
$("#top_msg").html('<div class="alert alert-success alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>The Password Reset Link has been sent to your recovery email.</div>');
}
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>' + parseErrorMessage(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>' + parseErrorMessage(response) + '</div>');
}
}
});
@ -210,14 +210,14 @@ $(document).ready(function () { @@ -210,14 +210,14 @@ $(document).ready(function () {
Password: password,
PasswordConfirm: confirmPassword
}),
success: function (html) {
if (html.result) {
success: function (response) {
if (response.result) {
$("#top_msg").css('display', 'inline', 'important');
$("#top_msg").html('<div class="alert alert-success alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>Password has successfully been reset.</div>');
}
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>' + parseErrorMessage(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>' + parseErrorMessage(response) + '</div>');
}
}
});

6
Teknik/Areas/User/Scripts/Settings.js

@ -6,13 +6,13 @@ $(document).ready(function () { @@ -6,13 +6,13 @@ $(document).ready(function () {
type: "POST",
url: deleteUserURL,
data: AddAntiForgeryToken({}),
success: function (html) {
if (html.result) {
success: function (response) {
if (response.result) {
window.location.replace(homeUrl);
}
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>' + parseErrorMessage(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>' + parseErrorMessage(response) + '</div>');
}
}
});

6
Teknik/Areas/User/Scripts/UploadSettings.js

@ -12,15 +12,15 @@ $(document).ready(function () { @@ -12,15 +12,15 @@ $(document).ready(function () {
data: AddAntiForgeryToken({
Encrypt: upload_encrypt
}),
success: function (html) {
success: function (response) {
$.unblockUI();
if (html.result) {
if (response.result) {
$("#top_msg").css('display', 'inline', 'important');
$("#top_msg").html('<div class="alert alert-success alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>Settings Saved!</div>');
}
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>' + parseErrorMessage(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>' + parseErrorMessage(response) + '</div>');
}
}
});

22
Teknik/Areas/Vault/Scripts/Vault.js

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
$(document).ready(function () {
$(document).ready(function () {
$("textarea.mdd_editor").MarkdownDeep({
help_location: helpURL,
disableTabHandling: false,
@ -175,12 +175,8 @@ @@ -175,12 +175,8 @@
window.location = response.result.url;
}
else {
var err = response;
if (response.error) {
err = response.error.message;
}
$("#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>' + err + '</div>');
$("#top_msg").html('<div class="alert alert-danger alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>' + parseErrorMessage(response) + '</div>');
}
}
});
@ -199,17 +195,13 @@ @@ -199,17 +195,13 @@
xhrFields: {
withCredentials: true
},
success: function (html) {
if (html.result) {
window.location = html.result.url;
success: function (response) {
if (response.result) {
window.location = response.result.url;
}
else {
var err = html;
if (html.error) {
err = html.error.message;
}
$("#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>' + err + '</div>');
$("#top_msg").html('<div class="alert alert-danger alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>' + parseErrorMessage(response) + '</div>');
}
}
});
@ -257,4 +249,4 @@ function linkShowMore(element) { @@ -257,4 +249,4 @@ function linkShowMore(element) {
btnBottom.find('.show-more-button').text(linkText);
};
});
}
}

Loading…
Cancel
Save