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.

ViewProfile.cshtml 7.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. @model Teknik.Areas.Users.ViewModels.ProfileViewModel
  2. @using Teknik.Utilities.Cryptography
  3. <div class="container">
  4. @if (!Model.Error)
  5. {
  6. bool OwnProfile = (Model.Username == User.Identity.Name || User.IsInRole("Admin")) && User.Identity.IsAuthenticated;
  7. string gitHost = Config.GitConfig.Host;
  8. string gitFullUrl = string.Empty;
  9. if (!string.IsNullOrEmpty(gitHost))
  10. {
  11. Uri gitUrl = new Uri(gitHost);
  12. gitUrl = new Uri(gitUrl, Model.Username);
  13. gitFullUrl = gitUrl.ToString();
  14. }
  15. string pgpFingerprint = pgpFingerprint = string.Empty;
  16. string pgpFingerprint64 = string.Empty;
  17. if (!string.IsNullOrEmpty(Model.IdentityUserInfo.PGPPublicKey))
  18. {
  19. pgpFingerprint = PGP.GetFingerprint(Model.IdentityUserInfo.PGPPublicKey);
  20. pgpFingerprint64 = PGP.GetFingerprint64(Model.IdentityUserInfo.PGPPublicKey);
  21. }
  22. <div class="row text-center">
  23. <div class="col-sm-4 @(string.IsNullOrEmpty(Model.UserSettings.About) ? "col-sm-offset-4" : "")"><h1>@Model.Username</h1></div>
  24. </div>
  25. if (User.IsInRole("Admin"))
  26. {
  27. <div class="row text-center">
  28. <div class="col-sm-3"><a href="@Url.SubRouteUrl("admin", "Admin.UserInfo", new { username = Model.Username })">edit</a></div>
  29. </div>
  30. }
  31. <div class="modal fade" id="pgpSignature" tabindex="-1" role="dialog" aria-labelledby="pgpSignatureLabel" aria-hidden="true">
  32. <div class="modal-dialog">
  33. <div class="modal-content">
  34. <div class="modal-header">
  35. <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span></button>
  36. <h4 class="modal-title" id="newPostLabel">@(Model.Username)'s Public Key</h4>
  37. </div>
  38. <div class="modal-body">
  39. <div class="row">
  40. <div class="col-sm-2">
  41. Fingerprint:
  42. </div>
  43. <div class="col-sm-10 text-right">
  44. @pgpFingerprint.AddStringAtInterval(4, " ")
  45. </div>
  46. </div>
  47. <div class="row">
  48. <div class="col-sm-2">
  49. 64-bit:
  50. </div>
  51. <div class="col-sm-10 text-right">
  52. @pgpFingerprint64.AddStringAtInterval(4, " ")
  53. </div>
  54. </div>
  55. <div class="row">
  56. <div class="col-sm-2">
  57. Raw:
  58. </div>
  59. <div class="col-sm-10 text-right">
  60. <a href="@Url.SubRouteUrl("user", "User.PGPKey", new { username = Model.Username })" target="_blank">@Url.SubRouteUrl("user", "User.PGPKey", new { username = Model.Username })</a>
  61. </div>
  62. </div>
  63. <br />
  64. <div class="row">
  65. <div class="col-sm-12">
  66. <textarea class="form-control wmd-input" name="pgpKeyBlock" id="pgpKeyBlock" title="Public Key" rows="10" readonly>@Model.IdentityUserInfo.PGPPublicKey</textarea>
  67. </div>
  68. </div>
  69. </div>
  70. </div>
  71. </div>
  72. </div>
  73. <div class="row">
  74. <!-- Left Info Box -->
  75. <div class="col-sm-4 @(string.IsNullOrEmpty(Model.UserSettings.About) ? "col-sm-offset-4" : "")"><!--left col-->
  76. <ul class="list-group">
  77. <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>
  78. @if (OwnProfile)
  79. {
  80. <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>
  81. }
  82. @if (OwnProfile)
  83. {
  84. <li class="list-group-item text-right"><span class="pull-left"><strong>Account Type</strong></span> @Model.IdentityUserInfo.AccountType</li>
  85. }
  86. @if (User.IsInRole("Admin"))
  87. {
  88. <li class="list-group-item text-right"><span class="pull-left"><strong>Account Status</strong></span> @Model.IdentityUserInfo.AccountStatus</li>
  89. }
  90. @if (!string.IsNullOrEmpty(pgpFingerprint))
  91. {
  92. <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>
  93. }
  94. @if (!string.IsNullOrEmpty(Model.Email) && Config.EmailConfig.Enabled)
  95. {
  96. <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>
  97. }
  98. <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>
  99. @if (!string.IsNullOrEmpty(gitFullUrl))
  100. {
  101. <li class="list-group-item text-right"><span class="pull-left"><strong>Git</strong></span> <a href="@gitFullUrl">Public Repos</a></li>
  102. }
  103. </ul>
  104. @if (!string.IsNullOrEmpty(Model.UserSettings.Website))
  105. {
  106. <div class="panel panel-default">
  107. <div class="panel-heading">Website <i class="fa fa-link fa-1x"></i></div>
  108. <div class="panel-body"><a href="@Model.UserSettings.Website" id="website">@Model.UserSettings.Website</a></div>
  109. </div>
  110. }
  111. @if (!string.IsNullOrEmpty(Model.UserSettings.Quote))
  112. {
  113. <div class="panel panel-default">
  114. <div class="panel-heading">Quote <i class="fa fa-quote-right fa-1x"></i></div>
  115. <div class="panel-body" id="quote">@Model.UserSettings.Quote</div>
  116. </div>
  117. }
  118. </div><!--/col-3-->
  119. @if (!string.IsNullOrEmpty(Model.UserSettings.About))
  120. {
  121. <!-- Right Content Area -->
  122. <div class="col-sm-8">
  123. @if (OwnProfile)
  124. {
  125. <div class="col-sm-12" id="markdown_body">@Html.Markdown(Model.UserSettings.About)</div>
  126. }
  127. else
  128. {
  129. @Html.Markdown(Model.UserSettings.About)
  130. }
  131. </div><!--/col-9-->
  132. }
  133. </div><!--/row-->
  134. }
  135. else
  136. {
  137. <div class="row">
  138. <div class="col-sm-12 text-center">
  139. <h2>@Model.ErrorMessage</h2>
  140. </div>
  141. </div>
  142. }
  143. </div>
  144. <bundle src="js/user.profile.min.js" append-version="true"></bundle>