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.

Settings.cshtml 16KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233
  1. @model Teknik.Areas.Users.ViewModels.SettingsViewModel
  2. @using Teknik.Helpers
  3. <script>
  4. var homeUrl = '@Url.SubRouteUrl("www", "Home.Index")';
  5. var editUserURL = '@Url.SubRouteUrl("user", "User.Action", new { action = "Edit" })';
  6. var deleteUserURL = '@Url.SubRouteUrl("user", "User.Action", new { action = "Delete" })';
  7. var resendVerifyURL = '@Url.SubRouteUrl("user", "User.Action", new { action = "ResendVerifyRecoveryEmail"})';
  8. var confirmAuthSetupURL = '@Url.SubRouteUrl("user", "User.Action", new { action = "VerifyAuthenticatorCode" })';
  9. </script>
  10. @Styles.Render("~/Content/user")
  11. @Scripts.Render("~/bundles/user")
  12. <div class="container">
  13. @if (!Model.Error)
  14. {
  15. <div class="modal fade" id="authenticatorSetup" tabindex="-1" role="dialog" aria-labelledby="authenticatorSetupLabel" aria-hidden="true">
  16. <div class="modal-dialog">
  17. <div class="modal-content">
  18. <div class="modal-header">
  19. <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span></button>
  20. <h4 class="modal-title" id="authSetupTitleLabel">Set Up a Third Party App to Generate Codes</h4>
  21. </div>
  22. <div class="modal-body">
  23. <div class="row">
  24. <div class="col-sm-12 text-center">
  25. <div id="authSetupStatus"></div>
  26. </div>
  27. </div>
  28. <form class="form" action="##" method="post" id="confirmAuthSetup">
  29. <p>To get a third party app working, either scan the QR code below or type the secret key into the app.</p>
  30. <div class="row">
  31. <div class="col-sm-4">
  32. <p class="text-muted">QR Code:</p>
  33. </div>
  34. <div class="col-sm-8">
  35. <img id="authQRCode" src="@Url.SubRouteUrl("user", "User.Action", new { action = "GenerateAuthQrCode", key = Model.SecuritySettings.TwoFactorKey })" width="200" height="200" alt="qr code" />
  36. </div>
  37. </div>
  38. <div class="row">
  39. <div class="col-sm-4">
  40. <p class="text-muted">Secret Key:</p>
  41. </div>
  42. <div class="col-sm-8">
  43. <span class="text-success" id="authSetupSecretKey">@Model.SecuritySettings.TwoFactorKey</span>
  44. </div>
  45. </div>
  46. <hr />
  47. <p>To confirm the third party app is set up correctly, enter the security code that appears on your phone.</p>
  48. <div class="row">
  49. <div class="col-sm-4">
  50. <p class="text-muted">Security Code:</p>
  51. </div>
  52. <div class="col-sm-6">
  53. <input class="form-control" id="auth_setup_code" name="auth_setup_code" title="Authenticator Security Code" type="text" />
  54. </div>
  55. </div>
  56. <hr />
  57. <div class="form-group text-right">
  58. <button class="btn btn-primary" id="auth_setup_confirm" type="button" name="auth_setup_confirm">Confirm</button>
  59. </div>
  60. </form>
  61. </div>
  62. </div>
  63. </div>
  64. </div>
  65. <div class="row">
  66. <div class="col-sm-12">
  67. <form class="form" action="##" method="post" id="updateForm">
  68. <input name="update_userid" id="update_userid" type="hidden" value="@Model.UserID" />
  69. <!-- Tab Navigation -->
  70. <ul class="nav nav-tabs" id="settingTabs">
  71. <li class="active"><a href="#profile" data-toggle="tab"> Profile </a></li>
  72. <li><a href="#security" data-toggle="tab"> Security </a></li>
  73. <li><a href="#blog" data-toggle="tab"> Blog </a></li>
  74. <li><a href="#uploads" data-toggle="tab"> Uploads </a></li>
  75. </ul>
  76. <div class="tab-content">
  77. <!-- Profile Settings -->
  78. <div class="tab-pane active" id="profile">
  79. <div class="row">
  80. <div class="form-group col-sm-4">
  81. <label for="update_website"><h4>Website</h4></label>
  82. <input class="form-control" id="update_website" name="update_website" placeholder="http://www.noneofyourbusiness.com/" title="enter your website" type="text" value="@Model.UserSettings.Website" />
  83. </div>
  84. <div class="form-group col-sm-8">
  85. <label for="update_quote"><h4>Quote</h4></label>
  86. <input class="form-control" id="update_quote" name="update_quote" placeholder="I have a dream!" title="enter a memorable quote" type="text" value="@Model.UserSettings.Quote" maxlength="140" />
  87. </div>
  88. </div>
  89. <div class="row">
  90. <div class="form-group col-sm-12">
  91. <label for="update_about"><h4>About Yourself</h4></label>
  92. <textarea class="form-control" name="update_about" id="update_about" placeholder="I'm awesome" title="enter any information you want to share with the world." data-provide="markdown" rows="10">@Model.UserSettings.About</textarea>
  93. </div>
  94. </div>
  95. </div>
  96. <!-- Security Settings -->
  97. <div class="tab-pane" id="security">
  98. <div class="row">
  99. <div class="col-sm-4">
  100. <div class="row">
  101. <div class="form-group col-sm-12">
  102. <label for="update_password_current"><h4>Current Password</h4></label>
  103. <input class="form-control" name="update_password_current" id="update_password_current" placeholder="current password" title="enter your current password." type="password" />
  104. </div>
  105. </div>
  106. <div class="row">
  107. <div class="form-group col-sm-12">
  108. <label for="update_password"><h4>New Password</h4></label>
  109. <input class="form-control" name="update_password" id="update_password" placeholder="new password" title="enter your password." type="password" />
  110. </div>
  111. </div>
  112. <div class="row">
  113. <div class="form-group col-sm-12">
  114. <label for="update_password_confirm"><h4>Verify New Password</h4></label>
  115. <input class="form-control" name="update_password_confirm" id="update_password_confirm" placeholder="new password confirmed" title="enter your password again." type="password" />
  116. </div>
  117. </div>
  118. </div>
  119. <div class="col-sm-8">
  120. <label for="update_pgp_public_key"><h4>Public Key</h4></label>
  121. <textarea class="form-control" id="update_pgp_public_key" name="update_pgp_public_key" placeholder="Public Key Here" title="enter your pgp public key" rows="15">@Model.SecuritySettings.PGPSignature</textarea>
  122. </div>
  123. </div>
  124. <div class="row">
  125. <div class="col-sm-4">
  126. <div class="row">
  127. <div class="form-group col-sm-12">
  128. <label for="update_recovery_email"><h4>Recovery Email</h4></label>
  129. <input class="form-control" name="update_recovery_email" id="update_recovery_email" placeholder="user@example.com" title="enter a recovery email." type="text" value="@Model.SecuritySettings.RecoveryEmail" />
  130. @if (!string.IsNullOrEmpty(Model.SecuritySettings.RecoveryEmail))
  131. {
  132. <p class="form-control-static">
  133. @if (Model.SecuritySettings.RecoveryVerified)
  134. {
  135. <span class="text-success"><i class="fa fa-check"></i> Verified</span>
  136. }
  137. else
  138. {
  139. <span class="text-danger"><i class="fa fa-ban"></i> Unverified</span> <small><a href="#" class="text-primary" id="ResendVerification"><i class="fa fa-repeat"></i> Resend</a></small>
  140. }
  141. </p>
  142. }
  143. </div>
  144. </div>
  145. </div>
  146. </div>
  147. <div class="row">
  148. <div class="col-sm-4 text-left">
  149. <label for="update_security_two_factor"><h4>Enable Two Factor Authentication</h4></label>
  150. <div class="checkbox">
  151. <label>
  152. <input id="update_security_two_factor" name="update_security_two_factor" title="whether two factor authentication should occur for this account" type="checkbox" value="true" @(Model.SecuritySettings.TwoFactorEnabled ? "checked" : string.Empty) />
  153. </label>
  154. </div>
  155. <p class="form-control-static @(Model.SecuritySettings.TwoFactorEnabled ? string.Empty : "hide")" id="setupAuthenticatorLink">
  156. <small><a href="#" class="text-primary" id="SetupAuthenticator" data-toggle="modal" data-target="#authenticatorSetup"><i class="fa fa-lock"></i> Set Up Authenticator</a></small>
  157. </p>
  158. </div>
  159. <div class="col-sm-4 text-left">
  160. <label for="update_security_allow_trusted"><h4>Allow Trusted Device Saving</h4></label>
  161. <div class="checkbox">
  162. <label>
  163. <input id="update_security_allow_trusted" name="update_security_allow_trusted" title="whether a device could be cached to bypass two factor authentication" type="checkbox" value="true" @(Model.SecuritySettings.AllowTrustedDevices ? "checked" : string.Empty) />
  164. </label>
  165. </div>
  166. </div>
  167. </div>
  168. </div>
  169. <!-- Blog Settings -->
  170. <div class="tab-pane" id="blog">
  171. <div class="row">
  172. <div class="form-group col-sm-6">
  173. <label for="update_blog_title"><h4>Title</h4></label>
  174. <input class="form-control" id="update_blog_title" name="update_blog_title" placeholder="click bait" title="enter your blog's title" type="text" value="@Model.BlogSettings.Title" />
  175. </div>
  176. <div class="form-group col-sm-6">
  177. <label for="update_blog_description"><h4>Description</h4></label>
  178. <input class="form-control" id="update_blog_description" name="update_blog_description" placeholder="This blog is not worth reading." title="enter your blog's description" type="text" value="@Model.BlogSettings.Description" />
  179. </div>
  180. </div>
  181. </div>
  182. <!-- Upload Settings -->
  183. <div class="tab-pane" id="uploads">
  184. <div class="row">
  185. <div class="col-sm-6">
  186. <div class="checkbox">
  187. <label>
  188. <label for="update_upload_saveKey"><h4>Save Key on Server</h4></label>
  189. <input id="update_upload_saveKey" name="update_upload_saveKey" title="whether the key should be saved on the server or not" type="checkbox" value="true" @(Model.UploadSettings.SaveKey ? "checked" : string.Empty) />
  190. </label>
  191. </div>
  192. </div>
  193. <div class="col-sm-6">
  194. <div class="checkbox">
  195. <label>
  196. <label for="update_upload_serverSideEncrypt"><h4>Encrypt on Server Side</h4></label>
  197. <input id="update_upload_serverSideEncrypt" name="update_upload_serverSideEncrypt" title="whether the file should be encrypted server side or client side" type="checkbox" value="true" @(Model.UploadSettings.ServerSideEncrypt ? "checked" : string.Empty) />
  198. </label>
  199. </div>
  200. </div>
  201. </div>
  202. </div>
  203. </div>
  204. <!-- Save Settings -->
  205. <div class="row">
  206. <div class="form-group col-sm-10">
  207. <br />
  208. <button class="btn btn-lg btn-success" id="update_submit" type="submit"><i class="glyphicon glyphicon-ok-sign"></i> Save</button>
  209. <button class="btn btn-lg" type="reset"><i class="glyphicon glyphicon-repeat"></i> Reset</button>
  210. </div>
  211. <div class="form-group col-sm-2">
  212. <br />
  213. <button type="button" class="btn btn-danger" id="delete_account">Delete Account</button>
  214. </div>
  215. </div>
  216. </form>
  217. </div><!--/col-9-->
  218. </div><!--/row-->
  219. }
  220. else
  221. {
  222. <div class="row">
  223. <div class="col-sm-12 text-center">
  224. <h2>Sorry, but I couldn't find that user.</h2>
  225. </div>
  226. </div>
  227. }
  228. </div>