diff --git a/Teknik/Areas/User/Views/User/Settings.cshtml b/Teknik/Areas/User/Views/User/Settings.cshtml
deleted file mode 100644
index c4dc12a..0000000
--- a/Teknik/Areas/User/Views/User/Settings.cshtml
+++ /dev/null
@@ -1,255 +0,0 @@
-@model Teknik.Areas.Users.ViewModels.SettingsViewModel
-
-@using Teknik.Utilities
-@using Teknik.Areas.Users.ViewModels
-
-
-
-@Styles.Render("~/Content/user")
-@Scripts.Render("~/bundles/user")
-
-
- @if (!Model.Error)
- {
-
-
- }
- else
- {
-
-
-
Sorry, but I couldn't find that user.
-
-
- }
-
diff --git a/Teknik/Areas/User/Views/User/AuthToken.cshtml b/Teknik/Areas/User/Views/User/Settings/AuthToken.cshtml
similarity index 100%
rename from Teknik/Areas/User/Views/User/AuthToken.cshtml
rename to Teknik/Areas/User/Views/User/Settings/AuthToken.cshtml
diff --git a/Teknik/Areas/User/Views/User/Settings/BlogSettings.cshtml b/Teknik/Areas/User/Views/User/Settings/BlogSettings.cshtml
new file mode 100644
index 0000000..9b6c4a6
--- /dev/null
+++ b/Teknik/Areas/User/Views/User/Settings/BlogSettings.cshtml
@@ -0,0 +1,36 @@
+@model Teknik.Areas.Users.ViewModels.BlogSettingsViewModel
+
+@using Teknik.Utilities
+@using Teknik.Areas.Users.ViewModels
+
+@{
+ Layout = "~/Areas/User/Views/User/Settings/Settings.cshtml";
+}
+
+
+
+@Styles.Render("~/Content/user/settings/blog")
+@Scripts.Render("~/bundles/user/settings/blog")
+
+
+
diff --git a/Teknik/Areas/User/Views/User/Settings/InviteCode.cshtml b/Teknik/Areas/User/Views/User/Settings/InviteCode.cshtml
new file mode 100644
index 0000000..c31c186
--- /dev/null
+++ b/Teknik/Areas/User/Views/User/Settings/InviteCode.cshtml
@@ -0,0 +1,21 @@
+@using Teknik.Utilities
+@model Teknik.Areas.Users.ViewModels.InviteCodeViewModel
+
+@{
+ bool codeClaimed = Model.ClaimedUser != null;
+}
+
+
+ @if (!codeClaimed)
+ {
+
+
+
+
+ }
+ @Model.Code
+ @if (codeClaimed)
+ {
+ Claimed by @Model.ClaimedUser.Username
+ }
+
diff --git a/Teknik/Areas/User/Views/User/Settings/InviteSettings.cshtml b/Teknik/Areas/User/Views/User/Settings/InviteSettings.cshtml
new file mode 100644
index 0000000..eb17061
--- /dev/null
+++ b/Teknik/Areas/User/Views/User/Settings/InviteSettings.cshtml
@@ -0,0 +1,59 @@
+@model Teknik.Areas.Users.ViewModels.InviteSettingsViewModel
+
+@using Teknik.Utilities
+@using Teknik.Areas.Users.ViewModels
+
+@{
+ Layout = "~/Areas/User/Views/User/Settings/Settings.cshtml";
+}
+
+@Styles.Render("~/Content/user/settings/invite")
+@Scripts.Render("~/bundles/user/settings/invite")
+
+
+
+
+
+
+
+
+
+ @if (Model.AvailableCodes.Any())
+ {
+ foreach (InviteCodeViewModel code in Model.AvailableCodes)
+ {
+ @Html.Partial("Settings/InviteCode", code)
+ }
+ }
+ else
+ {
+ - No Invite Codes Available
+ }
+
+
+
+
+
+
+
+
+
+
+
+ @if (Model.ClaimedCodes.Any())
+ {
+ foreach (InviteCodeViewModel code in Model.ClaimedCodes)
+ {
+ @Html.Partial("Settings/InviteCode", code)
+ }
+ }
+ else
+ {
+ - No Invite Codes have been Claimed
+ }
+
+
+
+
diff --git a/Teknik/Areas/User/Views/User/Settings/ProfileSettings.cshtml b/Teknik/Areas/User/Views/User/Settings/ProfileSettings.cshtml
new file mode 100644
index 0000000..1947ab0
--- /dev/null
+++ b/Teknik/Areas/User/Views/User/Settings/ProfileSettings.cshtml
@@ -0,0 +1,41 @@
+@model Teknik.Areas.Users.ViewModels.ProfileSettingsViewModel
+
+@using Teknik.Utilities
+@using Teknik.Areas.Users.ViewModels
+
+@{
+ Layout = "~/Areas/User/Views/User/Settings/Settings.cshtml";
+}
+
+
+
+@Styles.Render("~/Content/user/settings/profile")
+@Scripts.Render("~/bundles/user/settings/profile")
+
+
diff --git a/Teknik/Areas/User/Views/User/Settings/SecuritySettings.cshtml b/Teknik/Areas/User/Views/User/Settings/SecuritySettings.cshtml
new file mode 100644
index 0000000..bff5876
--- /dev/null
+++ b/Teknik/Areas/User/Views/User/Settings/SecuritySettings.cshtml
@@ -0,0 +1,178 @@
+@model Teknik.Areas.Users.ViewModels.SecuritySettingsViewModel
+
+@using Teknik.Utilities
+@using Teknik.Areas.Users.ViewModels
+
+@{
+ Layout = "~/Areas/User/Views/User/Settings/Settings.cshtml";
+}
+
+
+
+@Styles.Render("~/Content/user/settings/security")
+@Scripts.Render("~/bundles/user/settings/security")
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Teknik/Areas/User/Views/User/Settings/Settings.cshtml b/Teknik/Areas/User/Views/User/Settings/Settings.cshtml
new file mode 100644
index 0000000..b93c952
--- /dev/null
+++ b/Teknik/Areas/User/Views/User/Settings/Settings.cshtml
@@ -0,0 +1,51 @@
+@model Teknik.Areas.Users.ViewModels.SettingsViewModel
+
+@{
+ Layout = "~/Views/Shared/_Layout.cshtml";
+}
+
+@using Teknik.Utilities
+@using Teknik.Areas.Users.ViewModels
+
+@Styles.Render("~/Content/user/settings")
+@Scripts.Render("~/bundles/user/settings")
+
+
+
+
+ @if (!Model.Error)
+ {
+
+
+
+
+
+
+
+
+
+ @RenderBody()
+
+
+ }
+ else
+ {
+
+
+
@Model.ErrorMessage
+
+
+ }
+
diff --git a/Teknik/Areas/User/Views/User/Settings/SettingsBase.cshtml b/Teknik/Areas/User/Views/User/Settings/SettingsBase.cshtml
new file mode 100644
index 0000000..6325730
--- /dev/null
+++ b/Teknik/Areas/User/Views/User/Settings/SettingsBase.cshtml
@@ -0,0 +1,12 @@
+@model Teknik.Areas.Users.ViewModels.SettingsViewModel
+
+@{
+ Layout = "~/Areas/User/Views/User/Settings/Settings.cshtml";
+}
+
+
+
+
Default Account Settings
+
+
+
diff --git a/Teknik/Areas/User/Views/User/Settings/UploadSettings.cshtml b/Teknik/Areas/User/Views/User/Settings/UploadSettings.cshtml
new file mode 100644
index 0000000..58d403d
--- /dev/null
+++ b/Teknik/Areas/User/Views/User/Settings/UploadSettings.cshtml
@@ -0,0 +1,36 @@
+@model Teknik.Areas.Users.ViewModels.UploadSettingsViewModel
+
+@using Teknik.Utilities
+@using Teknik.Areas.Users.ViewModels
+
+@{
+ Layout = "~/Areas/User/Views/User/Settings/Settings.cshtml";
+}
+
+
+
+@Styles.Render("~/Content/user/settings/upload")
+@Scripts.Render("~/bundles/user/settings/upload")
+
+
diff --git a/Teknik/Areas/User/Views/User/_LoginPartial.cshtml b/Teknik/Areas/User/Views/User/_LoginPartial.cshtml
index 2ed4e48..79b2d8a 100644
--- a/Teknik/Areas/User/Views/User/_LoginPartial.cshtml
+++ b/Teknik/Areas/User/Views/User/_LoginPartial.cshtml
@@ -1,11 +1,11 @@
-@model Teknik.ViewModels.ViewModelBase
+@model Teknik.ViewModels.ViewModelBase
@using Teknik.Utilities
@using Microsoft.AspNet.Identity
@if (Model.Config.UserConfig.RegistrationEnabled || Model.Config.UserConfig.LoginEnabled)
{
-
+
-}
\ No newline at end of file
+
+}
diff --git a/Teknik/Models/TeknikEntities.cs b/Teknik/Models/TeknikEntities.cs
index e82035a..7b21a53 100644
--- a/Teknik/Models/TeknikEntities.cs
+++ b/Teknik/Models/TeknikEntities.cs
@@ -1,4 +1,4 @@
-using Microsoft.AspNet.Identity.EntityFramework;
+using Microsoft.AspNet.Identity.EntityFramework;
using System.Data.Entity;
using System.Data.Entity.Infrastructure;
using Teknik.Areas.Blog.Models;
@@ -26,6 +26,7 @@ namespace Teknik.Models
public DbSet
TrustedDevices { get; set; }
public DbSet AuthTokens { get; set; }
public DbSet TransferTypes { get; set; }
+ public DbSet InviteCodes { get; set; }
// User Settings
public DbSet UserSettings { get; set; }
public DbSet SecuritySettings { get; set; }
@@ -115,6 +116,16 @@ namespace Teknik.Models
.WithOptional(u => u.User)
.WillCascadeOnDelete(false);
+ modelBuilder.Entity()
+ .HasMany(u => u.OwnedInviteCodes)
+ .WithOptional(c => c.Owner)
+ .WillCascadeOnDelete(false);
+
+ modelBuilder.Entity()
+ .HasOptional(u => u.ClaimedInviteCode)
+ .WithOptionalPrincipal(c => c.ClaimedUser)
+ .WillCascadeOnDelete(false);
+
// Upload Mappings
modelBuilder.Entity()
.HasOptional(u => u.User);
@@ -130,13 +141,14 @@ namespace Teknik.Models
// Vault Mappings
modelBuilder.Entity()
.HasOptional(u => u.User);
-
+
// Users
modelBuilder.Entity().ToTable("Users");
modelBuilder.Entity().ToTable("Groups");
modelBuilder.Entity().ToTable("Roles");
modelBuilder.Entity().ToTable("TrustedDevices");
modelBuilder.Entity().ToTable("AuthTokens");
+ modelBuilder.Entity().ToTable("InviteCodes");
modelBuilder.Entity().ToTable("TransferTypes");
modelBuilder.Entity().ToTable("RecoveryEmailVerifications");
modelBuilder.Entity().ToTable("ResetPasswordVerifications");
@@ -176,4 +188,4 @@ namespace Teknik.Models
base.OnModelCreating(modelBuilder);
}
}
-}
\ No newline at end of file
+}
diff --git a/Teknik/Scripts/common.js b/Teknik/Scripts/common.js
index 4a6c372..96b16d0 100644
--- a/Teknik/Scripts/common.js
+++ b/Teknik/Scripts/common.js
@@ -1,4 +1,4 @@
-$(document).ready(function () {
+$(document).ready(function () {
$("#top_msg").css('display', 'none', 'important');
// Opt-in for tooltips
@@ -280,6 +280,41 @@ function addParamsToUrl(origUrl, params) {
var appendix = (hasQuery ? "&" : "?") + paramStr;
return hasHash ? origUrl.replace("#", appendix + "#") : origUrl + appendix;
}
+
+function sleep(ms) {
+ return new Promise(resolve => setTimeout(resolve, ms));
+}
+
+function parseErrorMessage(errorObj) {
+ var errorMsg = "";
+ if (errorObj === null || errorObj === undefined) {
+ // Do nothing
+ }
+ else if (errorObj.constructor === {}.constructor) {
+ if (errorObj.error) {
+ errorMsg = errorObj.error;
+ if (errorObj.error.message) {
+ errorMsg = errorObj.error.message;
+ }
+ }
+ }
+ else {
+ try {
+ var json = $.parseJSON(errorObj);
+ if (json.error) {
+ errorMsg = json.error;
+ if (json.error.message) {
+ errorMsg = json.error.message;
+ }
+ }
+ }
+ catch (err) {
+ // Don't do anything
+ }
+ }
+ return errorMsg;
+}
+
/***************************** TIMER Page Load *******************************/
var loopTime;
var startTime = new Date();
@@ -301,4 +336,4 @@ function pageloadStopTimer() {
$('#pagetime').show();
clearTimeout(loopTime);
-}
\ No newline at end of file
+}
diff --git a/Teknik/Teknik.csproj b/Teknik/Teknik.csproj
index ef2f802..fc86dd3 100644
--- a/Teknik/Teknik.csproj
+++ b/Teknik/Teknik.csproj
@@ -293,15 +293,22 @@
+
+
+
+
+
+
+
@@ -410,7 +417,13 @@
-
+
+
+
+
+
+
+
@@ -598,7 +611,7 @@
-
+
@@ -643,7 +656,7 @@
-
+
@@ -666,6 +679,13 @@
+
+
+
+
+
+
+
diff --git a/Utilities/Configuration/UserConfig.cs b/Utilities/Configuration/UserConfig.cs
index 17299e2..60a602f 100644
--- a/Utilities/Configuration/UserConfig.cs
+++ b/Utilities/Configuration/UserConfig.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@@ -19,6 +19,7 @@ namespace Teknik.Configuration
public string ReservedUsernameDefinitionFile { get; set; }
public decimal PremiumAccountPrice { get; set; }
public string PaymentType { get; set; }
+ public bool InviteCodeRequired { get; set; }
public UserConfig()
{
@@ -32,6 +33,7 @@ namespace Teknik.Configuration
ReservedUsernameDefinitionFile = string.Empty;
PremiumAccountPrice = 0;
PaymentType = "Donation";
+ InviteCodeRequired = false;
}
}
}