Browse Source

Small cleanups and fixes

Teknikode 2 months ago
parent
commit
6865b5c5bc

+ 1
- 0
.gitignore View File

@@ -268,3 +268,4 @@ __pycache__/
268 268
 **/tempkey.rsa
269 269
 /ServiceWorker/Properties/launchSettings.json
270 270
 /IdentityServer/App_Data/Config.json
271
+/ServiceWorker/Output

IdentityServer/Properties/PublishProfiles/Teknik Identity Development.pubxml → IdentityServer/Properties/PublishProfiles/Teknik Identity - Development.pubxml View File


+ 27
- 0
IdentityServer/Properties/PublishProfiles/Teknik Identity - Production.pubxml View File

@@ -0,0 +1,27 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+<!--
3
+This file is used by the publish/package process of your Web project. You can customize the behavior of this process
4
+by editing this MSBuild file. In order to learn more about this please visit https://go.microsoft.com/fwlink/?LinkID=208121. 
5
+-->
6
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
7
+  <PropertyGroup>
8
+    <WebPublishMethod>MSDeploy</WebPublishMethod>
9
+    <LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
10
+    <LastUsedPlatform>Any CPU</LastUsedPlatform>
11
+    <SiteUrlToLaunchAfterPublish>https://auth.teknik.io/</SiteUrlToLaunchAfterPublish>
12
+    <LaunchSiteAfterPublish>True</LaunchSiteAfterPublish>
13
+    <ExcludeApp_Data>True</ExcludeApp_Data>
14
+    <TargetFramework>netcoreapp2.1</TargetFramework>
15
+    <ProjectGuid>eb46e1eb-fdc2-4168-a0ad-8b284d44b13e</ProjectGuid>
16
+    <SelfContained>false</SelfContained>
17
+    <_IsPortable>true</_IsPortable>
18
+    <MSDeployServiceURL>ams1.teknik.io</MSDeployServiceURL>
19
+    <DeployIisAppPath>TeknikIdentity</DeployIisAppPath>
20
+    <RemoteSitePhysicalPath />
21
+    <SkipExtraFilesOnServer>True</SkipExtraFilesOnServer>
22
+    <MSDeployPublishMethod>WMSVC</MSDeployPublishMethod>
23
+    <EnableMSDeployBackup>True</EnableMSDeployBackup>
24
+    <UserName>Administrator</UserName>
25
+    <_SavePWD>True</_SavePWD>
26
+  </PropertyGroup>
27
+</Project>

+ 13
- 0
ServiceWorker/Properties/PublishProfiles/Teknik Service Worker.pubxml View File

@@ -0,0 +1,13 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+<!--
3
+https://go.microsoft.com/fwlink/?LinkID=208121. 
4
+-->
5
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
6
+  <PropertyGroup>
7
+    <PublishProtocol>FileSystem</PublishProtocol>
8
+    <Configuration>Release</Configuration>
9
+    <Platform>Any CPU</Platform>
10
+    <TargetFramework>netcoreapp2.1</TargetFramework>
11
+    <PublishDir>Output\</PublishDir>
12
+  </PropertyGroup>
13
+</Project>

+ 4
- 4
Teknik/Areas/Error/Controllers/ErrorController.cs View File

@@ -61,7 +61,7 @@ namespace Teknik.Areas.Error.Controllers
61 61
         {
62 62
             Response.StatusCode = StatusCodes.Status401Unauthorized;
63 63
 
64
-            ViewBag.Title = "401";
64
+            ViewBag.Title = "Unauthorized";
65 65
             ViewBag.Description = "Unauthorized";
66 66
 
67 67
             LogError(LogLevel.Error, "Unauthorized");
@@ -77,7 +77,7 @@ namespace Teknik.Areas.Error.Controllers
77 77
         {
78 78
             Response.StatusCode = StatusCodes.Status403Forbidden;
79 79
 
80
-            ViewBag.Title = "403";
80
+            ViewBag.Title = "Access Denied";
81 81
             ViewBag.Description = "Access Denied";
82 82
 
83 83
             LogError(LogLevel.Error, "Access Denied");
@@ -93,7 +93,7 @@ namespace Teknik.Areas.Error.Controllers
93 93
         {
94 94
             Response.StatusCode = StatusCodes.Status404NotFound;
95 95
 
96
-            ViewBag.Title = "404";
96
+            ViewBag.Title = "Not Found";
97 97
             ViewBag.Description = "Uh Oh, can't find it!";            
98 98
 
99 99
             LogError(LogLevel.Warning, "Page Not Found");
@@ -124,7 +124,7 @@ namespace Teknik.Areas.Error.Controllers
124 124
 
125 125
             Response.StatusCode = StatusCodes.Status500InternalServerError;
126 126
 
127
-            ViewBag.Title = "500";
127
+            ViewBag.Title = "Server Error";
128 128
             ViewBag.Description = "Something Borked";
129 129
             
130 130
             LogError(LogLevel.Error, "Server Error", exception);

+ 8
- 0
Teknik/Areas/User/Controllers/UserController.cs View File

@@ -1210,6 +1210,10 @@ namespace Teknik.Areas.Users.Controllers
1210 1210
                     return Json(new { error = "You must enter an authorization callback URL" });
1211 1211
                 if (!callbackUrl.IsValidUrl())
1212 1212
                     return Json(new { error = "Invalid callback URL" });
1213
+                if (!string.IsNullOrEmpty(homepageUrl) && !homepageUrl.IsValidUrl())
1214
+                    return Json(new { error = "Invalid homepage URL" });
1215
+                if (!string.IsNullOrEmpty(logoUrl) && !logoUrl.IsValidUrl())
1216
+                    return Json(new { error = "Invalid logo URL" });
1213 1217
 
1214 1218
                 // Validate the code with the identity server
1215 1219
                 var result = await IdentityHelper.CreateClient(_config, User.Identity.Name, name, homepageUrl, logoUrl, callbackUrl, "openid", "role", "account-info", "security-info", "teknik-api.read", "teknik-api.write");
@@ -1271,6 +1275,10 @@ namespace Teknik.Areas.Users.Controllers
1271 1275
                     return Json(new { error = "You must enter an authorization callback URL" });
1272 1276
                 if (!callbackUrl.IsValidUrl())
1273 1277
                     return Json(new { error = "Invalid callback URL" });
1278
+                if (!string.IsNullOrEmpty(homepageUrl) && !homepageUrl.IsValidUrl())
1279
+                    return Json(new { error = "Invalid homepage URL" });
1280
+                if (!string.IsNullOrEmpty(logoUrl) && !logoUrl.IsValidUrl())
1281
+                    return Json(new { error = "Invalid logo URL" });
1274 1282
 
1275 1283
                 Client foundClient = await IdentityHelper.GetClient(_config, User.Identity.Name, clientId);
1276 1284
 

+ 1
- 1
Teknik/Areas/User/Utility/UserHelper.cs View File

@@ -678,7 +678,7 @@ If you recieved this email and you did not reset your password, you can ignore t
678 678
             }
679 679
             catch (Exception ex)
680 680
             {
681
-                throw new Exception("Unable to disable email account.", ex);
681
+                throw new Exception("Unable to get email account status.", ex);
682 682
             }
683 683
             return false;
684 684
         }

+ 2
- 1
Teknik/Areas/User/Views/User/ViewProfile.cshtml View File

@@ -1,6 +1,7 @@
1 1
 @model Teknik.Areas.Users.ViewModels.ProfileViewModel
2 2
 
3 3
 @using Teknik.Utilities.Cryptography
4
+@using Teknik.Areas.Users.Utility
4 5
 
5 6
 <div class="container">
6 7
     @if (!Model.Error)
@@ -95,7 +96,7 @@
95 96
                     {
96 97
                         <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>
97 98
                     }
98
-                    @if (!string.IsNullOrEmpty(Model.Email) && Config.EmailConfig.Enabled)
99
+                    @if (!string.IsNullOrEmpty(Model.Email) && Config.EmailConfig.Enabled && UserHelper.UserEmailEnabled(Config, Model.Email))
99 100
                     {
100 101
                         <li class="list-group-item text-right"><span class="pull-left"><strong>Email</strong></span> @(Html.Raw(User.Identity.IsAuthenticated ? $"<a href=\"mailto:{Model.Email}\">{Model.Email}</a>" : $"{Model.Username} at {Config.EmailConfig.Domain}"))</li>
101 102
                     }

Teknik/Properties/PublishProfiles/Teknik Development (AMS1).pubxml → Teknik/Properties/PublishProfiles/Teknik - Development.pubxml View File


Teknik/Properties/PublishProfiles/FolderProfile.pubxml → Teknik/Properties/PublishProfiles/Teknik - Production.pubxml View File

@@ -5,18 +5,23 @@ by editing this MSBuild file. In order to learn more about this please visit htt
5 5
 -->
6 6
 <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
7 7
   <PropertyGroup>
8
-    <WebPublishMethod>FileSystem</WebPublishMethod>
9
-    <PublishProvider>FileSystem</PublishProvider>
8
+    <WebPublishMethod>MSDeploy</WebPublishMethod>
10 9
     <LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
11 10
     <LastUsedPlatform>Any CPU</LastUsedPlatform>
12
-    <SiteUrlToLaunchAfterPublish />
11
+    <SiteUrlToLaunchAfterPublish>https://www.teknik.io/</SiteUrlToLaunchAfterPublish>
13 12
     <LaunchSiteAfterPublish>True</LaunchSiteAfterPublish>
14 13
     <ExcludeApp_Data>False</ExcludeApp_Data>
15 14
     <TargetFramework>netcoreapp2.1</TargetFramework>
16 15
     <ProjectGuid>1e52f0d0-9e89-4022-a905-c685ef3564e1</ProjectGuid>
17 16
     <SelfContained>false</SelfContained>
18 17
     <_IsPortable>true</_IsPortable>
19
-    <publishUrl>bin\Release\netcoreapp2.1\publish\</publishUrl>
20
-    <DeleteExistingFiles>False</DeleteExistingFiles>
18
+    <MSDeployServiceURL>ams1.teknik.io</MSDeployServiceURL>
19
+    <DeployIisAppPath>Teknik</DeployIisAppPath>
20
+    <RemoteSitePhysicalPath />
21
+    <SkipExtraFilesOnServer>True</SkipExtraFilesOnServer>
22
+    <MSDeployPublishMethod>WMSVC</MSDeployPublishMethod>
23
+    <EnableMSDeployBackup>True</EnableMSDeployBackup>
24
+    <UserName>Administrator</UserName>
25
+    <_SavePWD>True</_SavePWD>
21 26
   </PropertyGroup>
22 27
 </Project>

+ 803
- 803
Teknik/package-lock.json
File diff suppressed because it is too large
View File


Loading…
Cancel
Save