The next generation of the Teknik Services. Written in ASP.NET. https://www.teknik.io/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

146 lines
7.6 KiB

@model Teknik.Areas.Users.ViewModels.ProfileViewModel
@using Teknik.Utilities.Cryptography
<div class="container">
@if (!Model.Error)
{
bool OwnProfile = (Model.Username == User.Identity.Name || User.IsInRole("Admin")) && User.Identity.IsAuthenticated;
string gitHost = Config.GitConfig.Host;
string gitFullUrl = string.Empty;
if (!string.IsNullOrEmpty(gitHost))
{
Uri gitUrl = new Uri(gitHost);
gitUrl = new Uri(gitUrl, Model.Username);
gitFullUrl = gitUrl.ToString();
}
string pgpFingerprint = pgpFingerprint = string.Empty;
string pgpFingerprint64 = string.Empty;
if (!string.IsNullOrEmpty(Model.IdentityUserInfo.PGPPublicKey))
{
pgpFingerprint = PGP.GetFingerprint(Model.IdentityUserInfo.PGPPublicKey);
pgpFingerprint64 = PGP.GetFingerprint64(Model.IdentityUserInfo.PGPPublicKey);
}
<div class="row text-center">
<div class="col-sm-3"><h1>@Model.Username</h1></div>
</div>
if (User.IsInRole("Admin"))
{
<div class="row text-center">
<div class="col-sm-3"><a href="@Url.SubRouteUrl("admin", "Admin.UserInfo", new { username = Model.Username })">edit</a></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" readonly>@Model.IdentityUserInfo.PGPPublicKey</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-right"><span class="pull-left"><strong>Joined</strong></span> <time datetime="@Model.IdentityUserInfo.CreationDate?.ToString("s")">@Model.IdentityUserInfo.CreationDate?.ToString("MMMM dd, yyyy")</time></li>
@if (OwnProfile)
{
<li class="list-group-item text-right"><span class="pull-left"><strong>Last Seen</strong></span> <time datetime="@Model.IdentityUserInfo.LastSeen?.ToString("s")">@Model.IdentityUserInfo.LastSeen?.ToString("dd/MM/yyyy hh:mm tt")</time></li>
}
@if (OwnProfile)
{
<li class="list-group-item text-right"><span class="pull-left"><strong>Account Type</strong></span> @Model.IdentityUserInfo.AccountType</li>
}
@if (User.IsInRole("Admin"))
{
<li class="list-group-item text-right"><span class="pull-left"><strong>Account Status</strong></span> @Model.IdentityUserInfo.AccountStatus</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>
}
@if (!string.IsNullOrEmpty(Model.Email) && Config.EmailConfig.Enabled)
{
<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>
}
<li class="list-group-item text-right"><span class="pull-left"><strong>Blog</strong></span> <a href="@Url.SubRouteUrl("blog", "Blog.Blog", new { username = Model.Username })" id="blog_title">@(string.IsNullOrEmpty(Model.BlogSettings.Title) ? string.Format("{0}'s Blog", Model.Username) : Model.BlogSettings.Title)</a></li>
@if (!string.IsNullOrEmpty(gitFullUrl))
{
<li class="list-group-item text-right"><span class="pull-left"><strong>Git</strong></span> <a href="@gitFullUrl">Public Repos</a></li>
}
</ul>
@if (!string.IsNullOrEmpty(Model.UserSettings.Website))
{
<div class="panel panel-default">
<div class="panel-heading">Website <i class="fa fa-link fa-1x"></i></div>
<div class="panel-body"><a href="@Model.UserSettings.Website" id="website">@Model.UserSettings.Website</a></div>
</div>
}
@if (!string.IsNullOrEmpty(Model.UserSettings.Quote))
{
<div class="panel panel-default">
<div class="panel-heading">Quote <i class="fa fa-quote-right fa-1x"></i></div>
<div class="panel-body" id="quote">@Model.UserSettings.Quote</div>
</div>
}
</div><!--/col-3-->
<!-- Right Content Area -->
<div class="col-sm-9">
@if (OwnProfile)
{
<div class="col-sm-12" id="markdown_body">@Html.Markdown(@Model.UserSettings.About)</div>
}
else
{
@Html.Markdown(@Model.UserSettings.About)
}
</div><!--/col-9-->
</div><!--/row-->
}
else
{
<div class="row">
<div class="col-sm-12 text-center">
<h2>@Model.ErrorMessage</h2>
</div>
</div>
}
</div>
<bundle src="js/user.profile.min.js" append-version="true"></bundle>