The next generation of the Teknik Services. Written in ASP.NET. https://www.teknik.io/
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

Settings.cshtml 15KB

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