Browse Source

Removed user from system blog.

Added gogs source id as config option.
tags/2.0.3
Teknikode 4 years ago
parent
commit
17a66c79c2

+ 7
- 1
Teknik/Areas/Blog/Views/Blog/Post.cshtml View File

@@ -7,7 +7,13 @@
<div class="blog-post">
<h2 class="blog-post-title text-center"><a href="@Url.SubRouteUrl("blog", "Blog.Post", new { username = Model.Blog.User.Username, id = Model.PostId })" id="title_@Model.PostId">@Html.Markdown(@Model.Title)</a></h2>
<p class="blog-post-meta text-center text-muted">
Posted on <time datetime="@Model.DatePosted.ToString("o")">@Model.DatePosted.ToString("MMMM dd, yyyy")</time> by <a href="@Url.SubRouteUrl("profile", "Profile.Index", new { username = Model.Blog.User.Username })">@Model.Blog.User.Username</a>
Posted on <time datetime="@Model.DatePosted.ToString("o")">@Model.DatePosted.ToString("MMMM dd, yyyy")</time>
@if (!Model.System)
{
<text>
by <a href="@Url.SubRouteUrl("profile", "Profile.Index", new { username = Model.Blog.User.Username })">@Model.Blog.User.Username</a>
</text>
}
@if (Model.Blog.User.Username == User.Identity.Name || User.IsInRole("Admin"))
{
<br />

+ 1
- 1
Teknik/Areas/Home/Views/Home/Index.cshtml View File

@@ -151,7 +151,7 @@
<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>
</p>
</div>
</div>

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

@@ -227,7 +227,7 @@ namespace Teknik.Areas.Profile.Controllers
// Add gogs user
using (var client = new WebClient())
{
var obj = new { username = model.Username, email = email, password = model.Password };
var obj = new { source_id = Config.GitConfig.SourceId, username = model.Username, email = email, password = model.Password };
string json = Newtonsoft.Json.JsonConvert.SerializeObject(obj);
client.Headers[HttpRequestHeader.ContentType] = "application/json";
Uri baseUri = new Uri(Config.GitConfig.Host);
@@ -305,7 +305,7 @@ namespace Teknik.Areas.Profile.Controllers
{
using (var client = new WebClient())
{
var obj = new { source_id = 1, email = email, password = newPass };
var obj = new { source_id = Config.GitConfig.SourceId, email = email, password = newPass };
string json = Newtonsoft.Json.JsonConvert.SerializeObject(obj);
client.Headers[HttpRequestHeader.ContentType] = "application/json";
Uri baseUri = new Uri(Config.GitConfig.Host);

+ 3
- 0
Teknik/Configuration/GitConfig.cs View File

@@ -14,11 +14,14 @@ namespace Teknik.Configuration

public string AccessToken { get; set; }

public int SourceId { get; set; }

public GitConfig()
{
Enabled = true;
Host = string.Empty;
AccessToken = string.Empty;
SourceId = 1;
}
}
}

Loading…
Cancel
Save