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.

UserAreaRegistration.cs 6.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. using System.Collections.Generic;
  2. using System.Web.Mvc;
  3. using System.Web.Optimization;
  4. using Teknik.Configuration;
  5. namespace Teknik.Areas.Users
  6. {
  7. public class UserAreaRegistration : AreaRegistration
  8. {
  9. public override string AreaName
  10. {
  11. get
  12. {
  13. return "User";
  14. }
  15. }
  16. public override void RegisterArea(AreaRegistrationContext context)
  17. {
  18. Config config = Config.Load();
  19. context.MapSubdomainRoute(
  20. "User.Login", // Route name
  21. new List<string>() { "user" }, // Subdomains
  22. new List<string>() { config.Host }, // domains
  23. "Login", // URL with parameters
  24. new { controller = "User", action = "Login" }, // Parameter defaults
  25. new[] { typeof(Controllers.UserController).Namespace }
  26. );
  27. context.MapSubdomainRoute(
  28. "User.Logout", // Route name
  29. new List<string>() { "user" }, // Subdomains
  30. new List<string>() { config.Host }, // domains
  31. "Logout", // URL with parameters
  32. new { controller = "User", action = "Logout" }, // Parameter defaults
  33. new[] { typeof(Controllers.UserController).Namespace }
  34. );
  35. context.MapSubdomainRoute(
  36. "User.Register", // Route name
  37. new List<string>() { "user" }, // Subdomains
  38. new List<string>() { config.Host }, // domains
  39. "Register", // URL with parameters
  40. new { controller = "User", action = "Register" }, // Parameter defaults
  41. new[] { typeof(Controllers.UserController).Namespace }
  42. );
  43. context.MapSubdomainRoute(
  44. "User.Settings", // Route name
  45. new List<string>() { "user" }, // Subdomains
  46. new List<string>() { config.Host }, // domains
  47. "Settings", // URL with parameters
  48. new { controller = "User", action = "Settings" }, // Parameter defaults
  49. new[] { typeof(Controllers.UserController).Namespace }
  50. );
  51. context.MapSubdomainRoute(
  52. "User.ResetPassword", // Route name
  53. new List<string>() { "user" }, // Subdomains
  54. new List<string>() { config.Host }, // domains
  55. "Reset/{username}", // URL with parameters
  56. new { controller = "User", action = "ResetPassword", username = UrlParameter.Optional }, // Parameter defaults
  57. new[] { typeof(Controllers.UserController).Namespace }
  58. );
  59. context.MapSubdomainRoute(
  60. "User.VerifyResetPassword", // Route name
  61. new List<string>() { "user" }, // Subdomains
  62. new List<string>() { config.Host }, // domains
  63. "Reset/{username}/{code}", // URL with parameters
  64. new { controller = "User", action = "VerifyResetPassword" }, // Parameter defaults
  65. new[] { typeof(Controllers.UserController).Namespace }
  66. );
  67. context.MapSubdomainRoute(
  68. "User.VerifyRecoveryEmail", // Route name
  69. new List<string>() { "user" }, // Subdomains
  70. new List<string>() { config.Host }, // domains
  71. "VerifyEmail/{code}", // URL with parameters
  72. new { controller = "User", action = "VerifyRecoveryEmail" }, // Parameter defaults
  73. new[] { typeof(Controllers.UserController).Namespace }
  74. );
  75. context.MapSubdomainRoute(
  76. "User.CheckAuthenticatorCode", // Route name
  77. new List<string>() { "user" }, // Subdomains
  78. new List<string>() { config.Host }, // domains
  79. "CheckAuthCode", // URL with parameters
  80. new { controller = "User", action = "ConfirmTwoFactorAuth" }, // Parameter defaults
  81. new[] { typeof(Controllers.UserController).Namespace }
  82. );
  83. context.MapSubdomainRoute(
  84. "User.Index", // Route name
  85. new List<string>() { "user" }, // Subdomains
  86. new List<string>() { config.Host }, // domains
  87. "u/{username}", // URL with parameters
  88. new { controller = "User", action = "Index", username = UrlParameter.Optional }, // Parameter defaults
  89. new[] { typeof(Controllers.UserController).Namespace }
  90. );
  91. context.MapSubdomainRoute(
  92. "User.PGPKey", // Route name
  93. new List<string>() { "user" }, // Subdomains
  94. new List<string>() { config.Host }, // domains
  95. "u/{username}/PGP", // URL with parameters
  96. new { controller = "User", action = "ViewRawPGP" }, // Parameter defaults
  97. new[] { typeof(Controllers.UserController).Namespace }
  98. );
  99. context.MapSubdomainRoute(
  100. "User.Action", // Route name
  101. new List<string>() { "user" }, // Subdomains
  102. new List<string>() { config.Host }, // domains
  103. "Action/{action}", // URL with parameters
  104. new { controller = "User", action = "Index" }, // Parameter defaults
  105. new[] { typeof(Controllers.UserController).Namespace }
  106. );
  107. // Register Script Bundle
  108. BundleTable.Bundles.Add(new ScriptBundle("~/bundles/user").Include(
  109. "~/Scripts/bootbox/bootbox.min.js",
  110. "~/Scripts/jquery.blockUI.js",
  111. "~/Scripts/bootstrap-switch.js",
  112. "~/Areas/User/Scripts/User.js"));
  113. // Register Script Bundle
  114. BundleTable.Bundles.Add(new ScriptBundle("~/bundles/checkAuthCode").Include(
  115. "~/Areas/User/Scripts/CheckAuthCode.js"));
  116. // Register Style Bundles
  117. BundleTable.Bundles.Add(new StyleBundle("~/Content/user").Include(
  118. "~/Content/bootstrap-switch/bootstrap3/bootstrap-switch.css"));
  119. }
  120. }
  121. }