1
0
mirror of https://git.teknik.io/Teknikode/Teknik.git synced 2023-08-02 14:16:22 +02:00

Renamed 'Profile' area to 'User' to better match it's purpose.

Added PGP Public Key adding for users and a method to view/link raw pgp key.
Updated multiple packages.
This commit is contained in:
Uncled1023 2016-05-14 19:27:39 -07:00
parent 1c35fcfd7b
commit 74e5e90e1b
63 changed files with 890 additions and 526 deletions

View File

@ -8,7 +8,7 @@ using System.Web;
using System.Web.Mvc;
using Teknik.Areas.Blog.Models;
using Teknik.Areas.Blog.ViewModels;
using Teknik.Areas.Profile.Models;
using Teknik.Areas.Users.Models;
using Teknik.Controllers;
using Teknik.Helpers;
using Teknik.Models;

View File

@ -1,6 +1,6 @@
using System;
using System.Collections.Generic;
using Teknik.Areas.Profile.Models;
using Teknik.Areas.Users.Models;
namespace Teknik.Areas.Blog.Models
{

View File

@ -2,7 +2,7 @@
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Teknik.Areas.Profile.Models;
using Teknik.Areas.Users.Models;
namespace Teknik.Areas.Blog.Models
{

View File

@ -4,7 +4,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Teknik.Areas.Blog.Models;
using Teknik.Areas.Profile.Models;
using Teknik.Areas.Users.Models;
using Teknik.ViewModels;
namespace Teknik.Areas.Blog.ViewModels

View File

@ -3,7 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Web;
using Teknik.Areas.Blog.Models;
using Teknik.Areas.Profile.Models;
using Teknik.Areas.Users.Models;
using Teknik.ViewModels;
namespace Teknik.Areas.Blog.ViewModels

View File

@ -7,7 +7,7 @@
<div class="col-sm-8 col-sm-offset-2">
<div class="post-comment">
<p class="post-comment-meta text-muted">
<a href="@Url.SubRouteUrl("profile", "Profile.Index", new { username = Model.User.Username })">@Model.User.Username</a> replied at <time datetime="@Model.DatePosted.ToString("o")">@Model.DatePosted.ToString("hh:mm:ss tt") on @Model.DatePosted.ToString("MMMM dd, yyyy")</time>
<a href="@Url.SubRouteUrl("user", "User.Index", new { username = Model.User.Username })">@Model.User.Username</a> replied at <time datetime="@Model.DatePosted.ToString("o")">@Model.DatePosted.ToString("hh:mm:ss tt") on @Model.DatePosted.ToString("MMMM dd, yyyy")</time>
@if (Model.User.Username == User.Identity.Name || User.IsInRole("Admin"))
{
<br />

View File

@ -11,7 +11,7 @@
@if (!Model.System)
{
<text>
by <a href="@Url.SubRouteUrl("profile", "Profile.Index", new { username = Model.Blog.User.Username })">@Model.Blog.User.Username</a>
by <a href="@Url.SubRouteUrl("user", "User.Index", new { username = Model.Blog.User.Username })">@Model.Blog.User.Username</a>
</text>
}
@if (Model.Blog.User.Username == User.Identity.Name || User.IsInRole("Admin"))

View File

@ -23,19 +23,28 @@ namespace Teknik.Areas.Home.Controllers
HomeViewModel model = new HomeViewModel();
// Grab the latest site blog posts
List<BlogPost> lastSite = new List<BlogPost>();
if (db.BlogPosts.Count() > 0)
{
var foundSite = db.BlogPosts.Include("Blog").Include("Blog.User").OrderByDescending(post => post.DatePosted).Where(p => p.Published && p.System).Take(5);
if (foundSite != null)
lastSite = foundSite.ToList();
}
// Grab the latest user blog posts
List<BlogPost> lastPosts = new List<BlogPost>();
if (db.BlogPosts.Count() > 0)
{
var foundPosts = db.BlogPosts.Include("Blog").Include("Blog.User").OrderByDescending(post => post.DatePosted).Where(p => p.Published && !p.System).Take(5);
if (foundPosts != null)
lastPosts = foundPosts.ToList();
}
// Grab the latest podcasts
List<Podcast.Models.Podcast> lastPods = new List<Podcast.Models.Podcast>();
if (db.Podcasts.Count() > 0)
{
var foundPods = db.Podcasts.OrderByDescending(post => post.DatePosted).Where(p => p.Published).Take(5);
if (foundPods != null)
lastPods = foundPods.ToList();
}
model.SitePosts = lastSite;
model.Podcasts = lastPods;

View File

@ -94,7 +94,7 @@
</div>
</div>
</a>
<a href="@Url.SubRouteUrl("profile", "Profile.Index")">
<a href="@Url.SubRouteUrl("user", "User.Index")">
<div class="col-md-3 text-center">
<br />
<i class="fa fa-sitemap fa-5x"></i>
@ -237,7 +237,7 @@
<h2 class="blog-post-title-sm text-left"><a href="@Url.SubRouteUrl("blog", "Blog.Post", new { username = post.Blog.User.Username, id = post.BlogPostId })" id="title_@post.BlogPostId">@post.Title</a>
</h2>
<p class="blog-post-meta-sm text-left text-muted">
Posted on <time datetime="@post.DatePosted.ToString("o")">@post.DatePosted.ToString("MMMM dd, yyyy")</time> by <a href="@Url.SubRouteUrl("profile", "Profile.Index", new { username = post.Blog.User.Username })">@post.Blog.User.Username</a>
Posted on <time datetime="@post.DatePosted.ToString("o")">@post.DatePosted.ToString("MMMM dd, yyyy")</time> by <a href="@Url.SubRouteUrl("user", "User.Index", new { username = post.Blog.User.Username })">@post.Blog.User.Username</a>
</p>
</div>
</div>

View File

@ -123,7 +123,7 @@ namespace Teknik.Areas.Paste.Controllers
if (User.Identity.IsAuthenticated)
{
Profile.Models.User user = db.Users.Where(u => u.Username == User.Identity.Name).FirstOrDefault();
Users.Models.User user = db.Users.Where(u => u.Username == User.Identity.Name).FirstOrDefault();
if (user != null)
{
paste.UserId = user.UserId;

View File

@ -3,7 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Teknik.Areas.Profile.Models;
using Teknik.Areas.Users.Models;
namespace Teknik.Areas.Paste.Models
{

View File

@ -2,7 +2,7 @@
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Teknik.Areas.Profile.Models;
using Teknik.Areas.Users.Models;
namespace Teknik.Areas.Podcast.Models
{

View File

@ -2,7 +2,7 @@
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Teknik.Areas.Profile.Models;
using Teknik.Areas.Users.Models;
using Teknik.ViewModels;
namespace Teknik.Areas.Podcast.ViewModels

View File

@ -7,7 +7,7 @@
<div class="col-sm-8 col-sm-offset-2">
<div class="post-comment">
<p class="post-comment-meta text-muted">
<a href="@Url.SubRouteUrl("profile", "Profile.Index", new { username = Model.User.Username })">@Model.User.Username</a> replied at <time datetime="@Model.DatePosted.ToString("o")">@Model.DatePosted.ToString("hh:mm:ss tt") on @Model.DatePosted.ToString("MMMM dd, yyyy")</time>
<a href="@Url.SubRouteUrl("user", "User.Index", new { username = Model.User.Username })">@Model.User.Username</a> replied at <time datetime="@Model.DatePosted.ToString("o")">@Model.DatePosted.ToString("hh:mm:ss tt") on @Model.DatePosted.ToString("MMMM dd, yyyy")</time>
@if (Model.User.Username == User.Identity.Name || User.IsInRole("Admin"))
{
<br />

View File

@ -1,82 +0,0 @@
using System.Collections.Generic;
using System.Web.Mvc;
using System.Web.Optimization;
using Teknik.Configuration;
namespace Teknik.Areas.Profile
{
public class ProfileAreaRegistration : AreaRegistration
{
public override string AreaName
{
get
{
return "Profile";
}
}
public override void RegisterArea(AreaRegistrationContext context)
{
Config config = Config.Load();
context.MapSubdomainRoute(
"Profile.Login", // Route name
new List<string>() { "profile" }, // Subdomains
new List<string>() { config.Host }, // domains
"Login", // URL with parameters
new { controller = "Profile", action = "Login" }, // Parameter defaults
new[] { typeof(Controllers.ProfileController).Namespace }
);
context.MapSubdomainRoute(
"Profile.Logout", // Route name
new List<string>() { "profile" }, // Subdomains
new List<string>() { config.Host }, // domains
"Logout", // URL with parameters
new { controller = "Profile", action = "Logout" }, // Parameter defaults
new[] { typeof(Controllers.ProfileController).Namespace }
);
context.MapSubdomainRoute(
"Profile.Register", // Route name
new List<string>() { "profile" }, // Subdomains
new List<string>() { config.Host }, // domains
"Register", // URL with parameters
new { controller = "Profile", action = "Register" }, // Parameter defaults
new[] { typeof(Controllers.ProfileController).Namespace }
);
context.MapSubdomainRoute(
"Profile.Settings", // Route name
new List<string>() { "profile" }, // Subdomains
new List<string>() { config.Host }, // domains
"Settings", // URL with parameters
new { controller = "Profile", action = "Settings" }, // Parameter defaults
new[] { typeof(Controllers.ProfileController).Namespace }
);
context.MapSubdomainRoute(
"Profile.Index", // Route name
new List<string>() { "profile" }, // Subdomains
new List<string>() { config.Host }, // domains
"{username}", // URL with parameters
new { controller = "Profile", action = "Index", username = UrlParameter.Optional }, // Parameter defaults
new[] { typeof(Controllers.ProfileController).Namespace }
);
context.MapSubdomainRoute(
"Profile.Action", // Route name
new List<string>() { "profile" }, // Subdomains
new List<string>() { config.Host }, // domains
"Action/{action}", // URL with parameters
new { controller = "Profile", action = "Index" }, // Parameter defaults
new[] { typeof(Controllers.ProfileController).Namespace }
);
// Register Script Bundle
BundleTable.Bundles.Add(new ScriptBundle("~/bundles/profile").Include(
"~/Scripts/bootbox/bootbox.min.js",
"~/Scripts/jquery.blockUI.js",
"~/Scripts/bootstrap-switch.js",
"~/Areas/Profile/Scripts/Profile.js"));
// Register Style Bundles
BundleTable.Bundles.Add(new StyleBundle("~/Content/profile").Include(
"~/Content/bootstrap-switch/bootstrap3/bootstrap-switch.css"));
}
}
}

View File

@ -46,7 +46,7 @@ namespace Teknik.Areas.Shortener.Controllers
if (User.Identity.IsAuthenticated)
{
Profile.Models.User foundUser = db.Users.Where(u => u.Username == User.Identity.Name).FirstOrDefault();
Users.Models.User foundUser = db.Users.Where(u => u.Username == User.Identity.Name).FirstOrDefault();
if (foundUser != null)
{
newUrl.UserId = foundUser.UserId;

View File

@ -2,7 +2,7 @@
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Teknik.Areas.Profile.Models;
using Teknik.Areas.Users.Models;
namespace Teknik.Areas.Shortener.Models
{

View File

@ -30,7 +30,7 @@ namespace Teknik.Areas.Transparency.Controllers
Paste.Models.Paste paste = db.Pastes.OrderByDescending(p => p.PasteId).FirstOrDefault();
model.PasteCount = (paste != null) ? paste.PasteId : 0;
Profile.Models.User user = db.Users.OrderByDescending(u => u.UserId).FirstOrDefault();
Users.Models.User user = db.Users.OrderByDescending(u => u.UserId).FirstOrDefault();
model.UserCount = (user != null) ? user.UserId : 0;
Shortener.Models.ShortenedUrl url = db.ShortenedUrls.OrderByDescending(s => s.ShortenedUrlId).FirstOrDefault();

View File

@ -28,7 +28,7 @@ namespace Teknik.Areas.Upload.Controllers
ViewBag.Title = "Teknik Upload - End to End Encryption";
UploadViewModel model = new UploadViewModel();
model.CurrentSub = Subdomain;
Areas.Profile.Models.User user = db.Users.Where(u => u.Username == User.Identity.Name).FirstOrDefault();
Users.Models.User user = db.Users.Where(u => u.Username == User.Identity.Name).FirstOrDefault();
if (user != null)
{
model.SaveKey = user.UploadSettings.SaveKey;
@ -111,7 +111,7 @@ namespace Teknik.Areas.Upload.Controllers
{
if (User.Identity.IsAuthenticated)
{
Profile.Models.User user = db.Users.Where(u => u.Username == User.Identity.Name).FirstOrDefault();
Users.Models.User user = db.Users.Where(u => u.Username == User.Identity.Name).FirstOrDefault();
if (user != null)
{
upload.UserId = user.UserId;

View File

@ -2,7 +2,7 @@
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Teknik.Areas.Profile.Models;
using Teknik.Areas.Users.Models;
namespace Teknik.Areas.Upload.Models
{

View File

@ -10,8 +10,8 @@ using Teknik.Areas.Shortener.Models;
using Teknik.Areas.Blog.Models;
using Teknik.Areas.Error.Controllers;
using Teknik.Areas.Error.ViewModels;
using Teknik.Areas.Profile.Models;
using Teknik.Areas.Profile.ViewModels;
using Teknik.Areas.Users.Models;
using Teknik.Areas.Users.ViewModels;
using Teknik.Controllers;
using Teknik.Helpers;
using Teknik.Models;
@ -19,9 +19,9 @@ using Teknik.ViewModels;
using System.Windows;
using System.Net;
namespace Teknik.Areas.Profile.Controllers
namespace Teknik.Areas.Users.Controllers
{
public class ProfileController : DefaultController
public class UserController : DefaultController
{
private TeknikEntities db = new TeknikEntities();
@ -67,10 +67,10 @@ namespace Teknik.Areas.Profile.Controllers
return View(model);
}
model.Error = true;
model.ErrorMessage = "The user does not exist";
return View(model);
}
// GET: Profile/Profile
[AllowAnonymous]
public ActionResult Settings()
{
@ -106,13 +106,30 @@ namespace Teknik.Areas.Profile.Controllers
[HttpGet]
[AllowAnonymous]
// GET: Profile
public ActionResult ViewRawPGP(string username)
{
ViewBag.Title = username + "'s Public Key - " + Config.Title;
ViewBag.Description = "The PGP public key for " + username;
User user = db.Users.Where(u => u.Username == username).FirstOrDefault();
if (user != null)
{
if (!string.IsNullOrEmpty(user.UserSettings.PGPSignature))
{
return Content(user.UserSettings.PGPSignature, "text/plain");
}
}
return Redirect(Url.SubRouteUrl("error", "Error.Http404"));
}
[HttpGet]
[AllowAnonymous]
public ActionResult Login(string ReturnUrl)
{
LoginViewModel model = new LoginViewModel();
model.ReturnUrl = ReturnUrl;
return View("/Areas/Profile/Views/Profile/ViewLogin.cshtml", model);
return View("/Areas/Users/Views/User/ViewLogin.cshtml", model);
}
[HttpPost]
@ -175,13 +192,12 @@ namespace Teknik.Areas.Profile.Controllers
[HttpGet]
[AllowAnonymous]
// GET: Profile
public ActionResult Register(string ReturnUrl)
{
RegisterViewModel model = new RegisterViewModel();
model.ReturnUrl = ReturnUrl;
return View("/Areas/Profile/Views/Profile/ViewRegistration.cshtml", model);
return View("/Areas/User/Views/User/ViewRegistration.cshtml", model);
}
[HttpPost]
@ -273,7 +289,7 @@ namespace Teknik.Areas.Profile.Controllers
}
[HttpPost]
public ActionResult Edit(string curPass, string newPass, string newPassConfirm, string website, string quote, string about, string blogTitle, string blogDesc, bool saveKey, bool serverSideEncrypt)
public ActionResult Edit(string curPass, string newPass, string newPassConfirm, string pgpPublicKey, string website, string quote, string about, string blogTitle, string blogDesc, bool saveKey, bool serverSideEncrypt)
{
if (ModelState.IsValid)
{
@ -328,6 +344,13 @@ namespace Teknik.Areas.Profile.Controllers
}
}
// PGP Key valid?
if (!string.IsNullOrEmpty(pgpPublicKey) && !PGP.IsPublicKey(pgpPublicKey))
{
return Json(new { error = "Invalid PGP Public Key" });
}
user.UserSettings.PGPSignature = pgpPublicKey;
user.UserSettings.Website = website;
user.UserSettings.Quote = quote;
user.UserSettings.About = about;

View File

@ -6,7 +6,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Teknik.Areas.Profile.Models
namespace Teknik.Areas.Users.Models
{
public class BlogSettings
{

View File

@ -4,7 +4,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Teknik.Areas.Profile.Models
namespace Teknik.Areas.Users.Models
{
public class Group
{

View File

@ -4,7 +4,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Teknik.Areas.Profile.Models
namespace Teknik.Areas.Users.Models
{
public enum PermissionTarget
{

View File

@ -4,7 +4,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Teknik.Areas.Profile.Models
namespace Teknik.Areas.Users.Models
{
public enum PermissionType
{

View File

@ -4,7 +4,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Teknik.Areas.Profile.Models
namespace Teknik.Areas.Users.Models
{
public class Role
{

View File

@ -6,7 +6,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Teknik.Areas.Profile.Models
namespace Teknik.Areas.Users.Models
{
public class UploadSettings
{

View File

@ -4,7 +4,7 @@ using Microsoft.AspNet.Identity.EntityFramework;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
namespace Teknik.Areas.Profile.Models
namespace Teknik.Areas.Users.Models
{
public class User
{

View File

@ -6,7 +6,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Teknik.Areas.Profile.Models
namespace Teknik.Areas.Users.Models
{
public class UserSettings
{
@ -19,6 +19,8 @@ namespace Teknik.Areas.Profile.Models
public string Quote { get; set; }
public string PGPSignature { get; set; }
public virtual User User { get; set; }
public virtual BlogSettings BlogSettings { get; set; }
@ -30,6 +32,7 @@ namespace Teknik.Areas.Profile.Models
About = string.Empty;
Website = string.Empty;
Quote = string.Empty;
PGPSignature = string.Empty;
}
}
}

View File

@ -37,6 +37,7 @@
current_password = $("#update_password_current").val();
password = $("#update_password").val();
password_confirm = $("#update_password_confirm").val();
update_pgp_public_key = $("#update_pgp_public_key").val();
website = $("#update_website").val();
quote = $("#update_quote").val();
about = $("#update_about").val();
@ -51,6 +52,7 @@
curPass: current_password,
newPass: password,
newPassConfirm: password_confirm,
pgpPublicKey: update_pgp_public_key,
website: website,
quote: quote,
about: about,

View File

@ -0,0 +1,90 @@
using System.Collections.Generic;
using System.Web.Mvc;
using System.Web.Optimization;
using Teknik.Configuration;
namespace Teknik.Areas.Users
{
public class UserAreaRegistration : AreaRegistration
{
public override string AreaName
{
get
{
return "User";
}
}
public override void RegisterArea(AreaRegistrationContext context)
{
Config config = Config.Load();
context.MapSubdomainRoute(
"User.Login", // Route name
new List<string>() { "user" }, // Subdomains
new List<string>() { config.Host }, // domains
"Login", // URL with parameters
new { controller = "User", action = "Login" }, // Parameter defaults
new[] { typeof(Controllers.UserController).Namespace }
);
context.MapSubdomainRoute(
"User.Logout", // Route name
new List<string>() { "user" }, // Subdomains
new List<string>() { config.Host }, // domains
"Logout", // URL with parameters
new { controller = "User", action = "Logout" }, // Parameter defaults
new[] { typeof(Controllers.UserController).Namespace }
);
context.MapSubdomainRoute(
"User.Register", // Route name
new List<string>() { "user" }, // Subdomains
new List<string>() { config.Host }, // domains
"Register", // URL with parameters
new { controller = "User", action = "Register" }, // Parameter defaults
new[] { typeof(Controllers.UserController).Namespace }
);
context.MapSubdomainRoute(
"User.Settings", // Route name
new List<string>() { "user" }, // Subdomains
new List<string>() { config.Host }, // domains
"Settings", // URL with parameters
new { controller = "User", action = "Settings" }, // Parameter defaults
new[] { typeof(Controllers.UserController).Namespace }
);
context.MapSubdomainRoute(
"User.Index", // Route name
new List<string>() { "user" }, // Subdomains
new List<string>() { config.Host }, // domains
"{username}", // URL with parameters
new { controller = "User", action = "Index", username = UrlParameter.Optional }, // Parameter defaults
new[] { typeof(Controllers.UserController).Namespace }
);
context.MapSubdomainRoute(
"User.PGPKey", // Route name
new List<string>() { "user" }, // Subdomains
new List<string>() { config.Host }, // domains
"{username}/PGP", // URL with parameters
new { controller = "User", action = "ViewRawPGP" }, // Parameter defaults
new[] { typeof(Controllers.UserController).Namespace }
);
context.MapSubdomainRoute(
"User.Action", // Route name
new List<string>() { "user" }, // Subdomains
new List<string>() { config.Host }, // domains
"Action/{action}", // URL with parameters
new { controller = "User", action = "Index" }, // Parameter defaults
new[] { typeof(Controllers.UserController).Namespace }
);
// Register Script Bundle
BundleTable.Bundles.Add(new ScriptBundle("~/bundles/user").Include(
"~/Scripts/bootbox/bootbox.min.js",
"~/Scripts/jquery.blockUI.js",
"~/Scripts/bootstrap-switch.js",
"~/Areas/User/Scripts/User.js"));
// Register Style Bundles
BundleTable.Bundles.Add(new StyleBundle("~/Content/user").Include(
"~/Content/bootstrap-switch/bootstrap3/bootstrap-switch.css"));
}
}
}

View File

@ -5,11 +5,11 @@ using System.Text;
using System.Threading.Tasks;
using System.Web;
using System.Web.Security;
using Teknik.Areas.Profile.Models;
using Teknik.Areas.Users.Models;
using Teknik.Configuration;
using Teknik.Models;
namespace Teknik.Areas.Profile.Utility
namespace Teknik.Areas.Users.Utility
{
public static class UserHelper
{

View File

@ -8,7 +8,7 @@ using Teknik.Helpers;
using Teknik.Models;
using Teknik.ViewModels;
namespace Teknik.Areas.Profile.ViewModels
namespace Teknik.Areas.Users.ViewModels
{
public class LoginViewModel : ViewModelBase
{

View File

@ -2,10 +2,10 @@
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Teknik.Areas.Profile.Models;
using Teknik.Areas.Users.Models;
using Teknik.ViewModels;
namespace Teknik.Areas.Profile.ViewModels
namespace Teknik.Areas.Users.ViewModels
{
public class ProfileViewModel : ViewModelBase
{

View File

@ -1,11 +1,11 @@
using System;
using System.ComponentModel.DataAnnotations;
using Teknik.Areas.Profile.Models;
using Teknik.Areas.Users.Models;
using Teknik.Helpers;
using Teknik.Models;
using Teknik.ViewModels;
namespace Teknik.Areas.Profile.ViewModels
namespace Teknik.Areas.Users.ViewModels
{
public class RegisterViewModel : ViewModelBase
{

View File

@ -2,10 +2,10 @@
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Teknik.Areas.Profile.Models;
using Teknik.Areas.Users.Models;
using Teknik.ViewModels;
namespace Teknik.Areas.Profile.ViewModels
namespace Teknik.Areas.Users.ViewModels
{
public class SettingsViewModel : ViewModelBase
{

View File

@ -1,4 +1,4 @@
@model Teknik.Areas.Profile.ViewModels.ProfileViewModel
@model Teknik.Areas.Users.ViewModels.ProfileViewModel
@using Teknik.Helpers
@using Teknik.Areas.Paste
@ -8,15 +8,69 @@
@if (!Model.Error)
{
bool OwnProfile = (Model.Username == User.Identity.Name || User.IsInRole("Admin"));
string pgpFingerprint = pgpFingerprint = string.Empty;
string pgpFingerprint64 = string.Empty;
if (!string.IsNullOrEmpty(Model.UserSettings.PGPSignature))
{
pgpFingerprint = PGP.GetFingerprint(Model.UserSettings.PGPSignature);
pgpFingerprint64 = PGP.GetFingerprint64(Model.UserSettings.PGPSignature);
}
<div class="row text-center">
<div class="col-sm-3"><h1>@Model.Username</h1></div>
</div>
<div class="modal fade" id="pgpSignature" tabindex="-1" role="dialog" aria-labelledby="pgpSignatureLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="newPostLabel">@(Model.Username)'s Public Key</h4>
</div>
<div class="modal-body">
<div class="row">
<div class="col-sm-2">
Fingerprint:
</div>
<div class="col-sm-10 text-right">
@pgpFingerprint.AddStringAtInterval(4, " ")
</div>
</div>
<div class="row">
<div class="col-sm-2">
64-bit:
</div>
<div class="col-sm-10 text-right">
@pgpFingerprint64.AddStringAtInterval(4, " ")
</div>
</div>
<div class="row">
<div class="col-sm-2">
Raw:
</div>
<div class="col-sm-10 text-right">
<a href="@Url.SubRouteUrl("user", "User.PGPKey", new { username = Model.Username })" target="_blank">@Url.SubRouteUrl("user", "User.PGPKey", new { username = Model.Username })</a>
</div>
</div>
<br />
<div class="row">
<div class="col-sm-12">
<textarea class="form-control wmd-input" name="pgpKeyBlock" id="pgpKeyBlock" title="Public Key" rows="10" onClick="SelectAll('pgpKeyBlock');" readonly>@Model.UserSettings.PGPSignature</textarea>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<!-- Left Info Box -->
<div class="col-sm-3"><!--left col-->
<ul class="list-group">
<li class="list-group-item text-muted">Profile</li>
@if (!string.IsNullOrEmpty(pgpFingerprint))
{
<li class="list-group-item text-right"><span class="pull-left"><strong>Public Key</strong></span> <a href="#" data-toggle="modal" data-target="#pgpSignature">@pgpFingerprint64.AddStringAtInterval(4, " ")</a></li>
}
<li class="list-group-item text-right"><span class="pull-left"><strong>Joined</strong></span> <time datetime="@Model.LastSeen.ToString("o")">@Model.JoinDate.ToString("MMMM dd, yyyy")</time></li>
@if (OwnProfile && User.Identity.IsAuthenticated)
{

View File

@ -1,8 +1,8 @@
@model Teknik.Areas.Profile.ViewModels.LoginViewModel
@model Teknik.Areas.Users.ViewModels.LoginViewModel
@if (Model.Config.UserConfig.LoginEnabled)
{
<form role="form" id="loginForm" action="@Url.SubRouteUrl("profile", "Profile.Login")" method="post" accept-charset="UTF-8">
<form role="form" id="loginForm" action="@Url.SubRouteUrl("user", "User.Login")" 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" />

View File

@ -1,8 +1,8 @@
@model Teknik.Areas.Profile.ViewModels.RegisterViewModel
@model Teknik.Areas.Users.ViewModels.RegisterViewModel
@if (Model.Config.UserConfig.RegistrationEnabled)
{
<form role="form" id="registrationForm" action="@Url.SubRouteUrl("profile", "Profile.Register")" method="post" accept-charset="UTF-8">
<form role="form" id="registrationForm" action="@Url.SubRouteUrl("user", "User.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"/>

View File

@ -1,15 +1,15 @@
@model Teknik.Areas.Profile.ViewModels.SettingsViewModel
@model Teknik.Areas.Users.ViewModels.SettingsViewModel
@using Teknik.Helpers
<script>
var homeUrl = '@Url.SubRouteUrl("www", "Home.Index")';
var editUserURL = '@Url.SubRouteUrl("profile", "Profile.Action", new { action = "Edit" })';
var deleteUserURL = '@Url.SubRouteUrl("profile", "Profile.Action", new { action = "Delete" })';
var editUserURL = '@Url.SubRouteUrl("user", "User.Action", new { action = "Edit" })';
var deleteUserURL = '@Url.SubRouteUrl("user", "User.Action", new { action = "Delete" })';
</script>
@Styles.Render("~/Content/profile")
@Scripts.Render("~/bundles/profile")
@Styles.Render("~/Content/user")
@Scripts.Render("~/bundles/user")
<div class="container">
@if (!Model.Error)
@ -26,25 +26,37 @@
</div>
<hr>
<div class="row">
<div class="form-group col-sm-4">
<div class="col-sm-4">
<div class="row">
<div class="form-group col-sm-12">
<label for="update_password_current"><h4>Current Password</h4></label>
<input class="form-control" name="update_password_current" id="update_password_current" placeholder="current password" title="enter your current password." type="password" />
</div>
<div class="form-group col-sm-4">
</div>
<div class="row">
<div class="form-group col-sm-12">
<label for="update_password"><h4>New Password</h4></label>
<input class="form-control" name="update_password" id="update_password" placeholder="new password" title="enter your password." type="password" />
</div>
<div class="form-group col-sm-4">
</div>
<div class="row">
<div class="form-group col-sm-12">
<label for="update_password_confirm"><h4>Verify New Password</h4></label>
<input class="form-control" name="update_password_confirm" id="update_password_confirm" placeholder="new password confirmed" title="enter your password again." type="password" />
</div>
</div>
</div>
<div class="col-sm-8">
<label for="update_pgp_public_key"><h4>Public Key</h4></label>
<textarea class="form-control" id="update_pgp_public_key" name="update_pgp_public_key" placeholder="Public Key Here" title="enter your blog's description" rows="10">@Model.UserSettings.PGPSignature</textarea>
</div>
</div>
<div class="row">
<div class="form-group col-sm-6">
<div class="form-group col-sm-4">
<label for="update_website"><h4>Website</h4></label>
<input class="form-control" id="update_website" name="update_website" placeholder="http://www.noneofyourbusiness.com/" title="enter your website" type="text" value="@Model.UserSettings.Website" />
</div>
<div class="form-group col-sm-6">
<div class="form-group col-sm-8">
<label for="update_quote"><h4>Quote</h4></label>
<input class="form-control" id="update_quote" name="update_quote" placeholder="I have a dream!" title="enter a memorable quote" type="text" value="@Model.UserSettings.Quote" maxlength="140" />
</div>

View File

@ -1,4 +1,4 @@
@model Teknik.Areas.Profile.ViewModels.LoginViewModel
@model Teknik.Areas.Users.ViewModels.LoginViewModel
<div class="container">
<div class="row">
@ -6,7 +6,7 @@
<div class="text-center">
<h1>Teknik Login</h1>
<div class="col-md-4 col-md-offset-4">
@Html.Partial("../../Areas/Profile/Views/Profile/Login", Model)
@Html.Partial("../../Areas/User/Views/User/Login", Model)
</div>
</div>
</div>

View File

@ -1,4 +1,4 @@
@model Teknik.Areas.Profile.ViewModels.RegisterViewModel
@model Teknik.Areas.Users.ViewModels.RegisterViewModel
<div class="container">
<div class="row">
@ -7,7 +7,7 @@
<h1>Teknik Registration</h1>
<h3>By regsitering, you agree to Teknik's <a href="@Url.SubRouteUrl("tos", "Terms")">Terms of Service</a></h3>
<div class="col-md-4 col-md-offset-4">
@Html.Partial("../../Areas/Profile/Views/Profile/Register", Model)
@Html.Partial("../../Areas/User/Views/User/Register", Model)
</div>
</div>
</div>

View File

@ -10,7 +10,7 @@ using System.Data.Entity;
using System.Web.Security;
using Teknik.Migrations;
using System.Data.Entity.Migrations;
using Teknik.Areas.Profile.Models;
using Teknik.Areas.Users.Models;
using System.ComponentModel;
using Teknik.Areas.Error.Controllers;
using System.Web.Helpers;

View File

@ -11,7 +11,10 @@ using Org.BouncyCastle.Crypto.Paddings;
using Org.BouncyCastle.Crypto.Parameters;
using Org.BouncyCastle.Security;
using Org.BouncyCastle.Utilities.Encoders;
using Org.BouncyCastle.Bcpg.OpenPgp;
using Org.BouncyCastle.Utilities.IO;
using System;
using System.Collections.Generic;
namespace Teknik.Helpers
{
@ -149,4 +152,82 @@ namespace Teknik.Helpers
return keyGenerator.GetBytes(keySize / 8);
}
}
public static class PGP
{
public static bool IsPublicKey(string key)
{
bool isValid = false;
try
{
byte[] byteArray = Encoding.ASCII.GetBytes(key);
using (MemoryStream stream = new MemoryStream(byteArray))
{
using (Stream decoderStream = PgpUtilities.GetDecoderStream(stream))
{
PgpPublicKeyRingBundle publicKeyBundle = new PgpPublicKeyRingBundle(decoderStream);
PgpPublicKey foundKey = GetFirstPublicKey(publicKeyBundle);
if (foundKey != null)
{
isValid = true;
}
}
}
}
catch (Exception ex)
{
isValid = false;
}
return isValid;
}
public static string GetFingerprint(string key)
{
string hexString = string.Empty;
byte[] byteArray = Encoding.ASCII.GetBytes(key);
using (MemoryStream stream = new MemoryStream(byteArray))
{
using (Stream decoderStream = PgpUtilities.GetDecoderStream(stream))
{
PgpPublicKeyRingBundle publicKeyBundle = new PgpPublicKeyRingBundle(decoderStream);
PgpPublicKey foundKey = GetFirstPublicKey(publicKeyBundle);
if (foundKey != null)
{
byte[] fing = foundKey.GetFingerprint();
hexString = Hex.ToHexString(fing);
}
}
}
return hexString;
}
public static string GetFingerprint64(string key)
{
string fingerprint = GetFingerprint(key);
if (fingerprint.Length > 16)
fingerprint = fingerprint.Substring(fingerprint.Length - 16);
return fingerprint;
}
private static PgpPublicKey GetFirstPublicKey(PgpPublicKeyRingBundle publicKeyRingBundle)
{
foreach (PgpPublicKeyRing kRing in publicKeyRingBundle.GetKeyRings())
{
var keys = kRing.GetPublicKeys();
foreach (var key in keys)
{
PgpPublicKey foundKey = (PgpPublicKey)key;
//PgpPublicKey key = kRing.GetPublicKeys()
//.Cast<PgpPublicKey>()
// .Where(k => k.IsEncryptionKey)
// .FirstOrDefault();
if (foundKey != null && foundKey.IsEncryptionKey)
return foundKey;
}
}
return null;
}
}
}

View File

@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;
namespace Teknik.Helpers
@ -13,5 +14,27 @@ namespace Teknik.Helpers
return value.Length <= maxLength ? value : value.Substring(0, maxLength);
}
public static string AddStringAtInterval(this string value, int interval, string insertStr)
{
if (interval <= 0 || value.Length < interval)
return value;
StringBuilder sb = new StringBuilder();
int finalIndex = 0;
for (int i = 0; i < value.Length; i = i + interval)
{
sb.Append(value.Substring(i, interval));
sb.Append(insertStr);
finalIndex = i;
}
if (finalIndex + interval != value.Length)
{
sb.Append(value.Substring(finalIndex, value.Length - finalIndex));
}
return sb.ToString();
}
}
}

View File

@ -27,13 +27,13 @@ namespace Teknik.Migrations
{
// Pre-populate with the default stuff
// Create system blog
Areas.Profile.Models.User systemUser = new Areas.Profile.Models.User();
Areas.Users.Models.User systemUser = new Areas.Users.Models.User();
systemUser.Username = Constants.SERVERUSER;
systemUser.JoinDate = DateTime.Now;
systemUser.LastSeen = DateTime.Now;
systemUser.UserSettings = new Areas.Profile.Models.UserSettings();
systemUser.BlogSettings = new Areas.Profile.Models.BlogSettings();
systemUser.UploadSettings = new Areas.Profile.Models.UploadSettings();
systemUser.UserSettings = new Areas.Users.Models.UserSettings();
systemUser.BlogSettings = new Areas.Users.Models.BlogSettings();
systemUser.UploadSettings = new Areas.Users.Models.UploadSettings();
context.Users.AddOrUpdate(systemUser);
context.SaveChanges();
@ -44,32 +44,32 @@ namespace Teknik.Migrations
context.SaveChanges();
// Create roles and groups
Areas.Profile.Models.Role adminRole = new Areas.Profile.Models.Role();
Areas.Users.Models.Role adminRole = new Areas.Users.Models.Role();
adminRole.Name = "Admin";
adminRole.Description = "Allows complete access to user specific actions";
context.Roles.AddOrUpdate(adminRole);
Areas.Profile.Models.Role podcastRole = new Areas.Profile.Models.Role();
Areas.Users.Models.Role podcastRole = new Areas.Users.Models.Role();
podcastRole.Name = "Podcast";
podcastRole.Description = "Allows create/edit/delete access to podcasts";
context.Roles.AddOrUpdate(podcastRole);
Areas.Profile.Models.Group adminGroup = new Areas.Profile.Models.Group();
Areas.Users.Models.Group adminGroup = new Areas.Users.Models.Group();
adminGroup.Name = "Administrators";
adminGroup.Description = "System Administrators with full access";
adminGroup.Roles = new List<Areas.Profile.Models.Role>();
adminGroup.Roles = new List<Areas.Users.Models.Role>();
adminGroup.Roles.Add(adminRole);
adminGroup.Roles.Add(podcastRole);
context.Groups.AddOrUpdate(adminGroup);
Areas.Profile.Models.Group podcastGroup = new Areas.Profile.Models.Group();
Areas.Users.Models.Group podcastGroup = new Areas.Users.Models.Group();
podcastGroup.Name = "Podcast";
podcastGroup.Description = "Podcast team members";
podcastGroup.Roles = new List<Areas.Profile.Models.Role>();
podcastGroup.Roles = new List<Areas.Users.Models.Role>();
podcastGroup.Roles.Add(podcastRole);
context.Groups.AddOrUpdate(podcastGroup);
Areas.Profile.Models.Group memberGroup = new Areas.Profile.Models.Group();
Areas.Users.Models.Group memberGroup = new Areas.Users.Models.Group();
memberGroup.Name = "Member";
memberGroup.Description = "The default member group with basic permissions";
context.Groups.AddOrUpdate(memberGroup);
@ -129,10 +129,10 @@ namespace Teknik.Migrations
foreach (var user in userRet)
{
// Create User
Areas.Profile.Models.User newUser = new Areas.Profile.Models.User();
newUser.UserSettings = new Areas.Profile.Models.UserSettings();
newUser.BlogSettings = new Areas.Profile.Models.BlogSettings();
newUser.UploadSettings = new Areas.Profile.Models.UploadSettings();
Areas.User.Models.User newUser = new Areas.User.Models.User();
newUser.UserSettings = new Areas.User.Models.UserSettings();
newUser.BlogSettings = new Areas.User.Models.BlogSettings();
newUser.UploadSettings = new Areas.User.Models.UploadSettings();
newUser.TransferAccount = true;
newUser.Username = user["username"].ToString();
newUser.HashedPassword = user["password"].ToString();
@ -151,7 +151,7 @@ namespace Teknik.Migrations
context.Users.AddOrUpdate(newUser);
context.SaveChanges();
string oldUsername = user["username"].ToString();
Areas.Profile.Models.User newUser = context.Users.Where(u => u.Username == oldUsername).FirstOrDefault();
Areas.User.Models.User newUser = context.Users.Where(u => u.Username == oldUsername).FirstOrDefault();
if (newUser != null)
{
int oldUserId = Int32.Parse(user["id"].ToString());

View File

@ -2,7 +2,7 @@
using System.Data.Entity;
using System.Data.Entity.Infrastructure;
using Teknik.Areas.Blog.Models;
using Teknik.Areas.Profile.Models;
using Teknik.Areas.Users.Models;
using Teknik.Areas.Contact.Models;
using Teknik.Migrations;
using Teknik.Areas.Upload.Models;

View File

@ -102,6 +102,10 @@ function getFileExtension(fileName) {
return '.' + fileName.substr(index + 1);
}
function SelectAll(id) {
document.getElementById(id).focus();
document.getElementById(id).select();
}
/***************************** TIMER Page Load *******************************/
var loopTime;

Binary file not shown.

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -4,11 +4,11 @@
* intended to be used only for design-time IntelliSense. Please use the
* standard jQuery library for all runtime use.
*
* Comment version: 2.1.2
* Comment version: 2.2.3
*/
/*!
* jQuery JavaScript Library v2.1.2
* jQuery JavaScript Library v2.2.3
* http://jquery.com/
*
* Includes Sizzle.js
@ -981,7 +981,7 @@
}
};
jQuery.ajaxSettings = {
"url": 'http://localhost:25812/?ver=2.1.2&newLineMethod=xml',
"url": 'http://localhost:25812/?ver=2.2.3&newLineMethod=xml',
"type": 'GET',
"isLocal": false,
"global": true,
@ -1722,7 +1722,7 @@
return select(selector.replace(rtrim, "$1"), context, results, seed);
};
jQuery.fn = {
"jquery": '2.1.2',
"jquery": '2.2.3',
"selector": '',
"length": 0
};

View File

@ -1,5 +1,5 @@
/*!
* jQuery JavaScript Library v2.2.0
* jQuery JavaScript Library v2.2.3
* http://jquery.com/
*
* Includes Sizzle.js
@ -9,7 +9,7 @@
* Released under the MIT license
* http://jquery.org/license
*
* Date: 2016-01-08T20:02Z
* Date: 2016-04-05T19:26Z
*/
(function( global, factory ) {
@ -65,7 +65,7 @@ var support = {};
var
version = "2.2.0",
version = "2.2.3",
// Define a local copy of jQuery
jQuery = function( selector, context ) {
@ -276,6 +276,7 @@ jQuery.extend( {
},
isPlainObject: function( obj ) {
var key;
// Not plain objects:
// - Any object or value whose internal [[Class]] property is not "[object Object]"
@ -285,14 +286,18 @@ jQuery.extend( {
return false;
}
// Not own constructor property must be Object
if ( obj.constructor &&
!hasOwn.call( obj.constructor.prototype, "isPrototypeOf" ) ) {
!hasOwn.call( obj, "constructor" ) &&
!hasOwn.call( obj.constructor.prototype || {}, "isPrototypeOf" ) ) {
return false;
}
// If the function hasn't returned already, we're confident that
// |obj| is a plain object, created by {} or constructed with new Object
return true;
// Own properties are enumerated firstly, so to speed up,
// if last one is own, then all properties are own
for ( key in obj ) {}
return key === undefined || hasOwn.call( obj, key );
},
isEmptyObject: function( obj ) {
@ -4479,7 +4484,7 @@ function on( elem, types, selector, data, fn, one ) {
if ( fn === false ) {
fn = returnFalse;
} else if ( !fn ) {
return this;
return elem;
}
if ( one === 1 ) {
@ -5128,14 +5133,14 @@ var
rscriptTypeMasked = /^true\/(.*)/,
rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;
// Manipulating tables requires a tbody
function manipulationTarget( elem, content ) {
if ( jQuery.nodeName( elem, "table" ) &&
jQuery.nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ) {
return jQuery.nodeName( elem, "table" ) &&
jQuery.nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ?
return elem.getElementsByTagName( "tbody" )[ 0 ] || elem;
}
return elem;
elem.getElementsByTagName( "tbody" )[ 0 ] ||
elem.appendChild( elem.ownerDocument.createElement( "tbody" ) ) :
elem;
}
// Replace/restore the type attribute of script elements for safe DOM manipulation
@ -5642,7 +5647,7 @@ var getStyles = function( elem ) {
// FF meanwhile throws on frame elements through "defaultView.getComputedStyle"
var view = elem.ownerDocument.defaultView;
if ( !view.opener ) {
if ( !view || !view.opener ) {
view = window;
}
@ -5791,15 +5796,18 @@ function curCSS( elem, name, computed ) {
style = elem.style;
computed = computed || getStyles( elem );
ret = computed ? computed.getPropertyValue( name ) || computed[ name ] : undefined;
// Support: Opera 12.1x only
// Fall back to style even without computed
// computed is undefined for elems on document fragments
if ( ( ret === "" || ret === undefined ) && !jQuery.contains( elem.ownerDocument, elem ) ) {
ret = jQuery.style( elem, name );
}
// Support: IE9
// getPropertyValue is only needed for .css('filter') (#12537)
if ( computed ) {
ret = computed.getPropertyValue( name ) || computed[ name ];
if ( ret === "" && !jQuery.contains( elem.ownerDocument, elem ) ) {
ret = jQuery.style( elem, name );
}
// A tribute to the "awesome hack by Dean Edwards"
// Android Browser returns percentage for some values,
@ -7322,6 +7330,12 @@ jQuery.extend( {
}
} );
// Support: IE <=11 only
// Accessing the selectedIndex property
// forces the browser to respect setting selected
// on the option
// The getter ensures a default option is selected
// when in an optgroup
if ( !support.optSelected ) {
jQuery.propHooks.selected = {
get: function( elem ) {
@ -7330,6 +7344,16 @@ if ( !support.optSelected ) {
parent.parentNode.selectedIndex;
}
return null;
},
set: function( elem ) {
var parent = elem.parentNode;
if ( parent ) {
parent.selectedIndex;
if ( parent.parentNode ) {
parent.parentNode.selectedIndex;
}
}
}
};
}
@ -7524,7 +7548,8 @@ jQuery.fn.extend( {
var rreturn = /\r/g;
var rreturn = /\r/g,
rspaces = /[\x20\t\r\n\f]+/g;
jQuery.fn.extend( {
val: function( value ) {
@ -7600,9 +7625,15 @@ jQuery.extend( {
option: {
get: function( elem ) {
// Support: IE<11
// option.value not trimmed (#14858)
return jQuery.trim( elem.value );
var val = jQuery.find.attr( elem, "value" );
return val != null ?
val :
// Support: IE10-11+
// option.text throws exceptions (#14686, #14858)
// Strip and collapse whitespace
// https://html.spec.whatwg.org/#strip-and-collapse-whitespace
jQuery.trim( jQuery.text( elem ) ).replace( rspaces, " " );
}
},
select: {
@ -7849,7 +7880,7 @@ jQuery.extend( jQuery.event, {
// But now, this "simulate" function is used only for events
// for which stopPropagation() is noop, so there is no need for that anymore.
//
// For the compat branch though, guard for "click" and "submit"
// For the 1.x branch though, guard for "click" and "submit"
// events is still used, but was moved to jQuery.event.stopPropagation function
// because `originalEvent` should point to the original event for the constancy
// with other events and for more focused logic
@ -9350,18 +9381,6 @@ jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
// Support: Safari 8+
// In Safari 8 documents created via document.implementation.createHTMLDocument
// collapse sibling forms: the second one becomes a child of the first one.
// Because of that, this security measure has to be disabled in Safari 8.
// https://bugs.webkit.org/show_bug.cgi?id=137337
support.createHTMLDocument = ( function() {
var body = document.implementation.createHTMLDocument( "" ).body;
body.innerHTML = "<form></form><form></form>";
return body.childNodes.length === 2;
} )();
// Argument "data" should be string of html
// context (optional): If specified, the fragment will be created in this context,
// defaults to document
@ -9374,12 +9393,7 @@ jQuery.parseHTML = function( data, context, keepScripts ) {
keepScripts = context;
context = false;
}
// Stop scripts or inline event handlers from being executed immediately
// by using document.implementation
context = context || ( support.createHTMLDocument ?
document.implementation.createHTMLDocument( "" ) :
document );
context = context || document;
var parsed = rsingleTag.exec( data ),
scripts = !keepScripts && [];
@ -9461,7 +9475,7 @@ jQuery.fn.load = function( url, params, callback ) {
// If it fails, this function gets "jqXHR", "status", "error"
} ).always( callback && function( jqXHR, status ) {
self.each( function() {
callback.apply( self, response || [ jqXHR.responseText, status, jqXHR ] );
callback.apply( this, response || [ jqXHR.responseText, status, jqXHR ] );
} );
} );
}
@ -9619,11 +9633,8 @@ jQuery.fn.extend( {
}
// Add offsetParent borders
// Subtract offsetParent scroll positions
parentOffset.top += jQuery.css( offsetParent[ 0 ], "borderTopWidth", true ) -
offsetParent.scrollTop();
parentOffset.left += jQuery.css( offsetParent[ 0 ], "borderLeftWidth", true ) -
offsetParent.scrollLeft();
parentOffset.top += jQuery.css( offsetParent[ 0 ], "borderTopWidth", true );
parentOffset.left += jQuery.css( offsetParent[ 0 ], "borderLeftWidth", true );
}
// Subtract parent offsets and element margins

4
Teknik/Scripts/jquery-2.2.3.min.js vendored Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -4,7 +4,7 @@
* intended to be used only for design-time IntelliSense. Please use the
* standard jQuery library for all production use.
*
* Comment version: 1.14.0
* Comment version: 1.15.0
*/
/*
@ -15,7 +15,7 @@
* for informational purposes only and are not the license terms under
* which Microsoft distributed this file.
*
* jQuery Validation Plugin - v1.14.0 - 2/4/2013
* jQuery Validation Plugin - v1.15.0 - 2/4/2013
* https://github.com/jzaefferer/jquery-validation
* Copyright (c) 2013 Jörn Zaefferer; Licensed MIT
*

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -49,8 +49,8 @@
<HintPath>..\packages\Antlr.3.5.0.2\lib\Antlr3.Runtime.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="BouncyCastle.Crypto, Version=1.7.4137.9688, Culture=neutral, PublicKeyToken=a4292a325f69b123, processorArchitecture=MSIL">
<HintPath>..\packages\BouncyCastle.1.7.0\lib\Net40-Client\BouncyCastle.Crypto.dll</HintPath>
<Reference Include="BouncyCastle.Crypto, Version=1.8.1.0, Culture=neutral, PublicKeyToken=0e99375e54769942">
<HintPath>..\packages\BouncyCastle.1.8.1\lib\BouncyCastle.Crypto.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
@ -83,7 +83,7 @@
<Private>True</Private>
</Reference>
<Reference Include="Newtonsoft.Json, Version=8.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.8.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
<HintPath>..\packages\Newtonsoft.Json.8.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Piwik.Tracker, Version=2.8.0.0, Culture=neutral, processorArchitecture=MSIL">
@ -91,12 +91,12 @@
<Private>True</Private>
</Reference>
<Reference Include="PresentationFramework" />
<Reference Include="RouteDebugger, Version=2.1.4.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\routedebugger.2.1.4.0\lib\net40\RouteDebugger.dll</HintPath>
<Reference Include="RouteDebugger, Version=2.1.5.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\routedebugger.2.1.5\lib\net40\RouteDebugger.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="SecurityDriven.Inferno, Version=1.1.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Inferno.1.1.0\lib\net451\SecurityDriven.Inferno.dll</HintPath>
<Reference Include="SecurityDriven.Inferno, Version=1.2.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Inferno.1.2.0\lib\net452\SecurityDriven.Inferno.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System" />
@ -207,14 +207,14 @@
<Compile Include="Areas\Privacy\Controllers\PrivacyController.cs" />
<Compile Include="Areas\Privacy\PrivacyAreaRegistration.cs" />
<Compile Include="Areas\Privacy\ViewModels\PrivacyViewModel.cs" />
<Compile Include="Areas\Profile\Controllers\ProfileController.cs" />
<Compile Include="Areas\Profile\Models\BlogSettings.cs" />
<Compile Include="Areas\Profile\Models\UploadSettings.cs" />
<Compile Include="Areas\Profile\Models\UserSettings.cs" />
<Compile Include="Areas\Profile\ProfileAreaRegistration.cs" />
<Compile Include="Areas\Profile\Utility\UserHelper.cs" />
<Compile Include="Areas\Profile\ViewModels\ProfileViewModel.cs" />
<Compile Include="Areas\Profile\ViewModels\SettingsViewModel.cs" />
<Compile Include="Areas\User\Controllers\UserController.cs" />
<Compile Include="Areas\User\Models\BlogSettings.cs" />
<Compile Include="Areas\User\Models\UploadSettings.cs" />
<Compile Include="Areas\User\Models\UserSettings.cs" />
<Compile Include="Areas\User\UserAreaRegistration.cs" />
<Compile Include="Areas\User\Utility\UserHelper.cs" />
<Compile Include="Areas\User\ViewModels\ProfileViewModel.cs" />
<Compile Include="Areas\User\ViewModels\SettingsViewModel.cs" />
<Compile Include="Areas\RSS\Controllers\RSSController.cs" />
<Compile Include="Areas\RSS\RSSAreaRegistration.cs" />
<Compile Include="Areas\Shortener\Controllers\ShortenerController.cs" />
@ -269,11 +269,11 @@
<Compile Include="Helpers\ActionResultHelper.cs" />
<Compile Include="Helpers\Constants.cs" />
<Compile Include="Helpers\Crypto.cs" />
<Compile Include="Areas\Profile\Models\Group.cs" />
<Compile Include="Areas\Profile\Models\PermissionTarget.cs" />
<Compile Include="Areas\Profile\Models\PermissionType.cs" />
<Compile Include="Areas\User\Models\Group.cs" />
<Compile Include="Areas\User\Models\PermissionTarget.cs" />
<Compile Include="Areas\User\Models\PermissionType.cs" />
<Compile Include="Areas\Blog\Models\BlogPost.cs" />
<Compile Include="Areas\Profile\Models\Role.cs" />
<Compile Include="Areas\User\Models\Role.cs" />
<Compile Include="Helpers\HttpRequestExtensions.cs" />
<Compile Include="Helpers\MysqlDatabase.cs" />
<Compile Include="Helpers\MarkdownHelper.cs" />
@ -288,10 +288,10 @@
</Compile>
<Compile Include="Migrations\Configuration.cs" />
<Compile Include="Models\TeknikEntities.cs" />
<Compile Include="Areas\Profile\Models\User.cs" />
<Compile Include="Areas\User\Models\User.cs" />
<Compile Include="Areas\Blog\Models\Blog.cs" />
<Compile Include="Areas\Profile\ViewModels\LoginViewModel.cs" />
<Compile Include="Areas\Profile\ViewModels\RegisterViewModel.cs" />
<Compile Include="Areas\User\ViewModels\LoginViewModel.cs" />
<Compile Include="Areas\User\ViewModels\RegisterViewModel.cs" />
<Compile Include="Modules\PerformanceMonitorModule.cs" />
<Compile Include="ViewModels\ViewModelBase.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
@ -310,7 +310,7 @@
<Content Include="Areas\Paste\Scripts\SyntaxWorker.js" />
<Content Include="Areas\Podcast\Content\Podcast.css" />
<Content Include="Areas\Podcast\Scripts\Podcast.js" />
<Content Include="Areas\Profile\Scripts\Profile.js" />
<Content Include="Areas\User\Scripts\User.js" />
<Content Include="Areas\Shortener\Scripts\Shortener.js" />
<Content Include="Areas\Upload\Scripts\Download.js" />
<Content Include="Content\audioplayer.css" />
@ -439,9 +439,9 @@
<Content Include="Areas\Contact\Views\web.config" />
<Content Include="Areas\Contact\Views\_ViewStart.cshtml" />
<Content Include="Areas\Contact\Views\Contact\Index.cshtml" />
<Content Include="Areas\Profile\Views\web.config" />
<Content Include="Areas\Profile\Views\_ViewStart.cshtml" />
<Content Include="Areas\Profile\Views\Profile\Index.cshtml" />
<Content Include="Areas\User\Views\web.config" />
<Content Include="Areas\User\Views\_ViewStart.cshtml" />
<Content Include="Areas\User\Views\User\Index.cshtml" />
<Content Include="Fonts\FontAwesome.otf" />
<Content Include="Fonts\fontawesome-webfont.woff" />
<Content Include="Fonts\fontawesome-webfont.ttf" />
@ -457,14 +457,14 @@
<Content Include="Areas\Blog\Views\Blog\Posts.cshtml" />
<Content Include="Areas\Blog\Views\Blog\Post.cshtml" />
<Content Include="Areas\Blog\Views\Blog\ViewPost.cshtml" />
<Content Include="Areas\Profile\Views\Profile\ViewLogin.cshtml" />
<Content Include="Areas\User\Views\User\ViewLogin.cshtml" />
<Content Include="Areas\Blog\Views\Blog\Comments.cshtml" />
<Content Include="Areas\Blog\Views\Blog\Comment.cshtml" />
<Content Include="Fonts\fontawesome-webfont.woff2" />
<Content Include="Areas\Upload\Views\web.config" />
<Content Include="Areas\Upload\Views\Upload\Index.cshtml" />
<Content Include="Areas\Upload\Views\_ViewStart.cshtml" />
<Content Include="Areas\Profile\Views\Profile\ViewRegistration.cshtml" />
<Content Include="Areas\User\Views\User\ViewRegistration.cshtml" />
<Content Include="Areas\Error\Views\web.config" />
<Content Include="Areas\Error\Views\Error\Http404.cshtml" />
<Content Include="Areas\Error\Views\_ViewStart.cshtml" />
@ -502,7 +502,7 @@
<Content Include="Areas\Podcast\Views\Podcast\Comments.cshtml" />
<Content Include="Areas\Podcast\Views\Podcast\ViewPodcast.cshtml" />
<Content Include="App_Data\Config.json" />
<Content Include="Areas\Profile\Views\Profile\Settings.cshtml" />
<Content Include="Areas\User\Views\User\Settings.cshtml" />
<Content Include="Areas\Transparency\Views\web.config" />
<Content Include="Areas\Transparency\Views\_ViewStart.cshtml" />
<Content Include="Areas\Transparency\Views\Transparency\Index.cshtml" />
@ -533,16 +533,15 @@
<Content Include="Scripts\Dropzone\dropzone.js" />
<Content Include="Scripts\FileSaver.js" />
<Content Include="Scripts\Highlight\highlight.pack.js" />
<None Include="Scripts\jquery-2.2.0-vsdoc.js" />
<Content Include="Scripts\jquery-2.2.0.js" />
<Content Include="Scripts\jquery-2.2.0.min.js" />
<Content Include="Scripts\jquery-2.2.0.min.map" />
<None Include="Scripts\jquery.validate-vsdoc.js" />
<None Include="Scripts\jquery-2.2.3-vsdoc.js" />
<Content Include="Scripts\jquery-2.2.3.js" />
<Content Include="Scripts\jquery-2.2.3.min.js" />
<Content Include="Scripts\jquery-ui.widgets.js" />
<Content Include="Scripts\jquery.blockUI.js" />
<Content Include="Scripts\jquery.fileupload.js" />
<Content Include="Scripts\jquery.iframe-transport.js" />
<Content Include="Scripts\jquery.tocify.min.js" />
<None Include="Scripts\jquery.validate-vsdoc.js" />
<Content Include="Scripts\jquery.validate.js" />
<Content Include="Scripts\jquery.validate.min.js" />
<Content Include="Scripts\jquery.validate.unobtrusive.js" />
@ -581,9 +580,10 @@
<Content Include="Views\Shared\_LoginPartial.cshtml" />
<Content Include="Views\Shared\_Navbar.cshtml" />
<Content Include="Views\Shared\_Footer.cshtml" />
<Content Include="Areas\Profile\Views\Profile\Login.cshtml" />
<Content Include="Areas\Profile\Views\Profile\Register.cshtml" />
<Content Include="Areas\User\Views\User\Login.cshtml" />
<Content Include="Areas\User\Views\User\Register.cshtml" />
<Content Include="Areas\Dev\Views\Dev\Index.cshtml" />
<Content Include="Scripts\jquery-2.2.3.min.map" />
</ItemGroup>
<ItemGroup>
<Folder Include="Areas\About\Models\" />
@ -606,13 +606,13 @@
<Folder Include="Areas\Podcast\Views\Shared\" />
<Folder Include="Areas\Privacy\Models\" />
<Folder Include="Areas\Privacy\Views\Shared\" />
<Folder Include="Areas\Profile\Views\Shared\" />
<Folder Include="Areas\Shortener\Views\Shared\" />
<Folder Include="Areas\Stream\Views\Shared\" />
<Folder Include="Areas\TOS\Models\" />
<Folder Include="Areas\TOS\Views\TOS\" />
<Folder Include="Areas\Transparency\Views\Shared\" />
<Folder Include="Areas\Upload\Views\Shared\" />
<Folder Include="Areas\User\Views\Shared\" />
</ItemGroup>
<ItemGroup>
<Content Include="packages.config">
@ -679,12 +679,12 @@
</FlavorProperties>
</VisualStudio>
</ProjectExtensions>
<Import Project="..\packages\GitVersionTask.3.4.1\build\dotnet\GitVersionTask.targets" Condition="Exists('..\packages\GitVersionTask.3.4.1\build\dotnet\GitVersionTask.targets')" />
<Import Project="..\packages\GitVersionTask.3.5.3\build\dotnet\GitVersionTask.targets" Condition="Exists('..\packages\GitVersionTask.3.5.3\build\dotnet\GitVersionTask.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\GitVersionTask.3.4.1\build\dotnet\GitVersionTask.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\GitVersionTask.3.4.1\build\dotnet\GitVersionTask.targets'))" />
<Error Condition="!Exists('..\packages\GitVersionTask.3.5.3\build\dotnet\GitVersionTask.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\GitVersionTask.3.5.3\build\dotnet\GitVersionTask.targets'))" />
</Target>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.

View File

@ -11,13 +11,13 @@
<a href="#" id="user_menu" class="dropdown-toggle" data-toggle="dropdown">@User.Identity.Name <strong class="caret"></strong></a>
<ul class="dropdown-menu" role="menu" aria-labelledby="user_menu">
<li>
<a href="@Url.SubRouteUrl("profile", "Profile.Index", new { username = User.Identity.Name })">Profile</a>
<a href="@Url.SubRouteUrl("user", "User.Index", new { username = User.Identity.Name })">Profile</a>
</li>
<li>
<a href="@Url.SubRouteUrl("blog", "Blog.Blog", new { username = User.Identity.Name })">Blog</a>
</li>
<li>
<a href="@Url.SubRouteUrl("profile", "Profile.Settings")">Settings</a>
<a href="@Url.SubRouteUrl("user", "User.Settings")">Settings</a>
</li>
@if (User.IsInRole("Admin"))
{
@ -26,7 +26,7 @@
</li>
}
<li>
<a href="@Url.SubRouteUrl("profile", "Profile.Logout")">Sign Out</a>
<a href="@Url.SubRouteUrl("user", "User.Logout")">Sign Out</a>
</li>
</ul>
</li>
@ -38,7 +38,7 @@
<li class="dropdown">
<a class="dropdown-toggle" href="#" data-toggle="dropdown" id="reg_dropdown">Sign Up <strong class="caret"></strong></a>
<div class="dropdown-menu" style="padding: 15px; padding-bottom: 0px;">
@Html.Partial("../../Areas/Profile/Views/Profile/Register", new Teknik.Areas.Profile.ViewModels.RegisterViewModel())
@Html.Partial("../../Areas/User/Views/User/Register", new Teknik.Areas.Users.ViewModels.RegisterViewModel())
</div>
</li>
}
@ -47,7 +47,7 @@
<li class="dropdown">
<a class="dropdown-toggle" href="#" data-toggle="dropdown" id="login_dropdown">Sign In <strong class="caret"></strong></a>
<div class="dropdown-menu" style="padding: 15px; padding-bottom: 0px;">
@Html.Partial("../../Areas/Profile/Views/Profile/Login", new Teknik.Areas.Profile.ViewModels.LoginViewModel())
@Html.Partial("../../Areas/User/Views/User/Login", new Teknik.Areas.Users.ViewModels.LoginViewModel())
</div>
</li>
}

View File

@ -4,13 +4,13 @@
<package id="bootstrap" version="3.3.6" targetFramework="net452" userInstalled="true" />
<package id="Bootstrap.Flat" version="3.3.4" targetFramework="net452" />
<package id="Bootstrap.Switch" version="3.3.2.1" targetFramework="net452" />
<package id="BouncyCastle" version="1.7.0" targetFramework="net452" />
<package id="BouncyCastle" version="1.8.1" targetFramework="net452" />
<package id="EntityFramework" version="6.1.3" targetFramework="net452" userInstalled="true" />
<package id="FontAwesome" version="4.4.0" targetFramework="net452" userInstalled="true" />
<package id="GitVersionTask" version="3.4.1" targetFramework="net452" developmentDependency="true" />
<package id="Inferno" version="1.1.0" targetFramework="net452" userInstalled="true" />
<package id="jQuery" version="2.2.0" targetFramework="net452" userInstalled="true" />
<package id="jQuery.Validation" version="1.14.0" targetFramework="net452" userInstalled="true" />
<package id="GitVersionTask" version="3.5.3" targetFramework="net452" developmentDependency="true" />
<package id="Inferno" version="1.2.0" targetFramework="net452" userInstalled="true" />
<package id="jQuery" version="2.2.3" targetFramework="net452" userInstalled="true" />
<package id="jQuery.Validation" version="1.15.0" targetFramework="net452" userInstalled="true" />
<package id="MarkdownDeep.Full" version="1.5" targetFramework="net452" />
<package id="MarkdownDeep.NET" version="1.5" targetFramework="net452" />
<package id="MarkdownHelper" version="1.3" targetFramework="net452" />
@ -25,9 +25,9 @@
<package id="Modernizr" version="2.8.3" targetFramework="net452" userInstalled="true" />
<package id="MySql.Data" version="6.9.8" targetFramework="net452" />
<package id="nClam" version="2.0.6.0" targetFramework="net452" />
<package id="Newtonsoft.Json" version="8.0.2" targetFramework="net452" userInstalled="true" />
<package id="Newtonsoft.Json" version="8.0.3" targetFramework="net452" userInstalled="true" />
<package id="Piwik.Tracker" version="2.8.0.0" targetFramework="net452" />
<package id="Respond" version="1.4.2" targetFramework="net452" userInstalled="true" />
<package id="routedebugger" version="2.1.4" targetFramework="net452" userInstalled="true" />
<package id="routedebugger" version="2.1.5" targetFramework="net452" userInstalled="true" />
<package id="WebGrease" version="1.6.0" targetFramework="net46" userInstalled="true" />
</packages>