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

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