mirror of
https://gitlab.com/buildfeed/BuildFeed.git
synced 2024-03-22 21:10:34 +08:00
Initial Commit
This commit is contained in:
parent
83f3e37309
commit
51b17f6b57
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -6,6 +6,9 @@
|
|||
*.user
|
||||
*.sln.docstates
|
||||
|
||||
# Publish Profiles
|
||||
[Pp]roperties/[Pp]ublish[Pp]rofiles/
|
||||
|
||||
# Build results
|
||||
[Dd]ebug/
|
||||
[Dd]ebugPublic/
|
||||
|
|
20
App_Code/BuildDateTimeModelBinder.cs
Normal file
20
App_Code/BuildDateTimeModelBinder.cs
Normal file
|
@ -0,0 +1,20 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Web.Mvc;
|
||||
|
||||
namespace BuildFeed
|
||||
{
|
||||
public class BuildDateTimeModelBinder : DefaultModelBinder
|
||||
{
|
||||
public override object BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext)
|
||||
{
|
||||
var value = bindingContext.ValueProvider.GetValue(bindingContext.ModelName);
|
||||
DateTime retValue;
|
||||
bool success = DateTime.TryParseExact(value.AttemptedValue, "yyMMdd-HHmm", CultureInfo.InvariantCulture, DateTimeStyles.AllowWhiteSpaces, out retValue);
|
||||
return success ? retValue as DateTime? : null as DateTime?;
|
||||
}
|
||||
}
|
||||
}
|
25
App_Start/BundleConfig.cs
Normal file
25
App_Start/BundleConfig.cs
Normal file
|
@ -0,0 +1,25 @@
|
|||
using System.Web;
|
||||
using System.Web.Optimization;
|
||||
|
||||
namespace BuildFeed
|
||||
{
|
||||
public class BundleConfig
|
||||
{
|
||||
// For more information on bundling, visit http://go.microsoft.com/fwlink/?LinkId=301862
|
||||
public static void RegisterBundles(BundleCollection bundles)
|
||||
{
|
||||
bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
|
||||
"~/Scripts/jquery-{version}.js"));
|
||||
|
||||
bundles.Add(new ScriptBundle("~/bundles/jqueryval").Include(
|
||||
"~/Scripts/jquery.validate*"));
|
||||
|
||||
bundles.Add(new StyleBundle("~/content/css").Include(
|
||||
"~/content/style.css"));
|
||||
|
||||
// Set EnableOptimizations to false for debugging. For more information,
|
||||
// visit http://go.microsoft.com/fwlink/?LinkId=301862
|
||||
BundleTable.EnableOptimizations = true;
|
||||
}
|
||||
}
|
||||
}
|
36
App_Start/DatabaseConfig.cs
Normal file
36
App_Start/DatabaseConfig.cs
Normal file
|
@ -0,0 +1,36 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Configuration;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
|
||||
namespace BuildFeed
|
||||
{
|
||||
public static class DatabaseConfig
|
||||
{
|
||||
public static string Host { get; private set; }
|
||||
public static int Port { get; private set; }
|
||||
public static long Database { get; private set; }
|
||||
|
||||
static DatabaseConfig()
|
||||
{
|
||||
Host = ConfigurationManager.AppSettings["data:ServerHost"];
|
||||
|
||||
int _port;
|
||||
bool success = int.TryParse(ConfigurationManager.AppSettings["data:ServerPort"], out _port);
|
||||
if(!success)
|
||||
{
|
||||
_port = 6379; // redis default port
|
||||
}
|
||||
Port = _port;
|
||||
|
||||
long _db;
|
||||
success = long.TryParse(ConfigurationManager.AppSettings["data:ServerDB"], out _db);
|
||||
if (!success)
|
||||
{
|
||||
_db = 0; // redis default db
|
||||
}
|
||||
Database = _db;
|
||||
}
|
||||
}
|
||||
}
|
13
App_Start/FilterConfig.cs
Normal file
13
App_Start/FilterConfig.cs
Normal file
|
@ -0,0 +1,13 @@
|
|||
using System.Web;
|
||||
using System.Web.Mvc;
|
||||
|
||||
namespace BuildFeed
|
||||
{
|
||||
public class FilterConfig
|
||||
{
|
||||
public static void RegisterGlobalFilters(GlobalFilterCollection filters)
|
||||
{
|
||||
filters.Add(new HandleErrorAttribute());
|
||||
}
|
||||
}
|
||||
}
|
104
App_Start/RouteConfig.cs
Normal file
104
App_Start/RouteConfig.cs
Normal file
|
@ -0,0 +1,104 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.Mvc;
|
||||
using System.Web.Routing;
|
||||
using System.Web.Http;
|
||||
|
||||
namespace BuildFeed
|
||||
{
|
||||
public class RouteConfig
|
||||
{
|
||||
public static void RegisterRoutes(RouteCollection routes)
|
||||
{
|
||||
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
|
||||
|
||||
routes.AppendTrailingSlash = true;
|
||||
|
||||
routes.MapRoute(
|
||||
name: "Site Root",
|
||||
url: "",
|
||||
defaults: new { controller = "Build", action = "Index", page = 1 }
|
||||
);
|
||||
|
||||
routes.MapRoute(
|
||||
name: "Pagination",
|
||||
url: "page/{page}/",
|
||||
defaults: new { controller = "Build", action = "Index", page = 1 }
|
||||
);
|
||||
|
||||
routes.MapRoute(
|
||||
name: "Lab Root",
|
||||
url: "lab/{lab}/",
|
||||
defaults: new { controller = "Build", action = "Lab", page = 1 }
|
||||
);
|
||||
|
||||
routes.MapRoute(
|
||||
name: "Lab",
|
||||
url: "lab/{lab}/page/{page}/",
|
||||
defaults: new { controller = "Build", action = "Lab", page = 1 }
|
||||
);
|
||||
|
||||
routes.MapRoute(
|
||||
name: "Version Root",
|
||||
url: "version/{major}.{minor}/",
|
||||
defaults: new { controller = "Build", action = "Version", page = 1 }
|
||||
);
|
||||
|
||||
routes.MapRoute(
|
||||
name: "Version",
|
||||
url: "version/{major}.{minor}/page/{page}/",
|
||||
defaults: new { controller = "Build", action = "Version", page = 1 }
|
||||
);
|
||||
|
||||
routes.MapRoute(
|
||||
name: "Year Root",
|
||||
url: "year/{year}/",
|
||||
defaults: new { controller = "Build", action = "Year", page = 1 }
|
||||
);
|
||||
|
||||
routes.MapRoute(
|
||||
name: "Year",
|
||||
url: "year/{year}/{page}/",
|
||||
defaults: new { controller = "Build", action = "Year", page = 1 }
|
||||
);
|
||||
|
||||
routes.MapRoute(
|
||||
name: "Source Root",
|
||||
url: "source/{source}/",
|
||||
defaults: new { controller = "Build", action = "Source", page = 1 }
|
||||
);
|
||||
|
||||
routes.MapRoute(
|
||||
name: "Source",
|
||||
url: "source/{source}/{page}/",
|
||||
defaults: new { controller = "Build", action = "Source", page = 1 }
|
||||
);
|
||||
|
||||
routes.MapRoute(
|
||||
name: "RSS",
|
||||
url: "rss/{action}",
|
||||
defaults: new { controller = "rss", action = "Index" }
|
||||
);
|
||||
|
||||
routes.MapRoute(
|
||||
name: "Support",
|
||||
url: "support/{action}/",
|
||||
defaults: new { controller = "Support", action = "Index" }
|
||||
);
|
||||
|
||||
routes.MapHttpRoute(
|
||||
name: "API",
|
||||
routeTemplate: "api/{action}/{id}",
|
||||
defaults: new { controller = "api", action = "GetBuilds", id = UrlParameter.Optional }
|
||||
);
|
||||
|
||||
routes.MapRoute(
|
||||
name: "Actions",
|
||||
url: "actions/{action}/{id}",
|
||||
defaults: new { controller = "Build", action = "Index", id = UrlParameter.Optional }
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
34
Areas/admin/Controllers/usersController.cs
Normal file
34
Areas/admin/Controllers/usersController.cs
Normal file
|
@ -0,0 +1,34 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.Mvc;
|
||||
using System.Web.Security;
|
||||
using BuildFeed.Auth;
|
||||
|
||||
namespace BuildFeed.Areas.admin.Controllers
|
||||
{
|
||||
[Authorize(Users = "hounsell")]
|
||||
public class usersController : Controller
|
||||
{
|
||||
// GET: admin/users
|
||||
public ActionResult Index()
|
||||
{
|
||||
return View(Membership.GetAllUsers().Cast<MembershipUser>().OrderBy(m => m.UserName));
|
||||
}
|
||||
|
||||
public ActionResult Approve(Guid id)
|
||||
{
|
||||
var provider = (Membership.Provider as RedisMembershipProvider);
|
||||
provider.ChangeApproval(id, true);
|
||||
return RedirectToAction("Index");
|
||||
}
|
||||
|
||||
public ActionResult Unapprove(Guid id)
|
||||
{
|
||||
var provider = (Membership.Provider as RedisMembershipProvider);
|
||||
provider.ChangeApproval(id, false);
|
||||
return RedirectToAction("Index");
|
||||
}
|
||||
}
|
||||
}
|
3
Areas/admin/Views/_ViewStart.cshtml
Normal file
3
Areas/admin/Views/_ViewStart.cshtml
Normal file
|
@ -0,0 +1,3 @@
|
|||
@{
|
||||
Layout = "~/Views/shared/_default.cshtml";
|
||||
}
|
42
Areas/admin/Views/users/index.cshtml
Normal file
42
Areas/admin/Views/users/index.cshtml
Normal file
|
@ -0,0 +1,42 @@
|
|||
@model IEnumerable<System.Web.Security.MembershipUser>
|
||||
|
||||
@{
|
||||
ViewBag.Title = "User Administration | BuildFeed";
|
||||
}
|
||||
|
||||
<h2>User Administration</h2>
|
||||
|
||||
<table class="table table-striped table-bordered">
|
||||
<tr>
|
||||
<th>
|
||||
Username
|
||||
</th>
|
||||
<th>
|
||||
Email Address
|
||||
</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
|
||||
@foreach (MembershipUser mu in Model)
|
||||
{
|
||||
<tr>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => mu.UserName)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => mu.Email)
|
||||
</td>
|
||||
<td class="text-right">
|
||||
@if (mu.IsApproved)
|
||||
{
|
||||
@Html.ActionLink("Unapprove", "unapprove", new { id = mu.ProviderUserKey }, new { @class = "btn btn-danger", style = "width:90px;" })
|
||||
}
|
||||
else
|
||||
{
|
||||
@Html.ActionLink("Approve", "approve", new { id = mu.ProviderUserKey }, new { @class = "btn btn-success", style = "width:90px;" })
|
||||
}
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
|
||||
</table>
|
36
Areas/admin/Views/web.config
Normal file
36
Areas/admin/Views/web.config
Normal file
|
@ -0,0 +1,36 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
<configuration>
|
||||
<configSections>
|
||||
<sectionGroup name="system.web.webPages.razor" type="System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
|
||||
<section name="host" type="System.Web.WebPages.Razor.Configuration.HostSection, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
|
||||
<section name="pages" type="System.Web.WebPages.Razor.Configuration.RazorPagesSection, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
|
||||
</sectionGroup>
|
||||
</configSections>
|
||||
|
||||
<system.web.webPages.razor>
|
||||
<host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=5.2.2.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
|
||||
<pages pageBaseType="System.Web.Mvc.WebViewPage">
|
||||
<namespaces>
|
||||
<add namespace="System.Web.Mvc" />
|
||||
<add namespace="System.Web.Mvc.Ajax" />
|
||||
<add namespace="System.Web.Mvc.Html" />
|
||||
<add namespace="System.Web.Routing" />
|
||||
<add namespace="System.Web.Optimization" />
|
||||
<add namespace="BuildFeed" />
|
||||
|
||||
</namespaces>
|
||||
</pages>
|
||||
</system.web.webPages.razor>
|
||||
|
||||
<appSettings>
|
||||
<add key="webpages:Enabled" value="false" />
|
||||
</appSettings>
|
||||
|
||||
<system.webServer>
|
||||
<handlers>
|
||||
<remove name="BlockViewHandler"/>
|
||||
<add name="BlockViewHandler" path="*" verb="*" preCondition="integratedMode" type="System.Web.HttpNotFoundHandler" />
|
||||
</handlers>
|
||||
</system.webServer>
|
||||
</configuration>
|
24
Areas/admin/adminAreaRegistration.cs
Normal file
24
Areas/admin/adminAreaRegistration.cs
Normal file
|
@ -0,0 +1,24 @@
|
|||
using System.Web.Mvc;
|
||||
|
||||
namespace BuildFeed.Areas.admin
|
||||
{
|
||||
public class adminAreaRegistration : AreaRegistration
|
||||
{
|
||||
public override string AreaName
|
||||
{
|
||||
get
|
||||
{
|
||||
return "admin";
|
||||
}
|
||||
}
|
||||
|
||||
public override void RegisterArea(AreaRegistrationContext context)
|
||||
{
|
||||
context.MapRoute(
|
||||
"admin_default",
|
||||
"admin/{controller}/{action}/{id}",
|
||||
new { action = "Index", id = UrlParameter.Optional }
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
396
Auth/RedisMembershipProvider.cs
Normal file
396
Auth/RedisMembershipProvider.cs
Normal file
|
@ -0,0 +1,396 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
using System.Web;
|
||||
using System.Web.Security;
|
||||
using NServiceKit.DataAnnotations;
|
||||
using NServiceKit.DesignPatterns.Model;
|
||||
using NServiceKit.Redis;
|
||||
using Required = System.ComponentModel.DataAnnotations.RequiredAttribute;
|
||||
|
||||
namespace BuildFeed.Auth
|
||||
{
|
||||
public class RedisMembershipProvider : MembershipProvider
|
||||
{
|
||||
public override string ApplicationName
|
||||
{
|
||||
get { return ""; }
|
||||
set { }
|
||||
}
|
||||
|
||||
public override bool EnablePasswordReset
|
||||
{
|
||||
get { return true; }
|
||||
}
|
||||
|
||||
public override bool EnablePasswordRetrieval
|
||||
{
|
||||
get { return false; }
|
||||
}
|
||||
|
||||
public override int MaxInvalidPasswordAttempts
|
||||
{
|
||||
get { return 5; }
|
||||
}
|
||||
|
||||
public override int MinRequiredNonAlphanumericCharacters
|
||||
{
|
||||
get { return 1; }
|
||||
}
|
||||
|
||||
public override int MinRequiredPasswordLength
|
||||
{
|
||||
get { return 12; }
|
||||
}
|
||||
|
||||
public override int PasswordAttemptWindow
|
||||
{
|
||||
get { return 60; }
|
||||
}
|
||||
|
||||
public override MembershipPasswordFormat PasswordFormat
|
||||
{
|
||||
get { return MembershipPasswordFormat.Hashed; }
|
||||
}
|
||||
|
||||
public override string PasswordStrengthRegularExpression
|
||||
{
|
||||
get { return ""; }
|
||||
}
|
||||
|
||||
public override bool RequiresQuestionAndAnswer
|
||||
{
|
||||
get { return false; }
|
||||
}
|
||||
|
||||
public override bool RequiresUniqueEmail
|
||||
{
|
||||
get { return true; }
|
||||
}
|
||||
|
||||
public override bool ChangePassword(string username, string oldPassword, string newPassword)
|
||||
{
|
||||
bool isAuthenticated = ValidateUser(username, oldPassword);
|
||||
|
||||
if (isAuthenticated)
|
||||
{
|
||||
using (RedisClient rClient = new RedisClient(DatabaseConfig.Host, DatabaseConfig.Port, db: DatabaseConfig.Database))
|
||||
{
|
||||
var client = rClient.As<RedisMember>();
|
||||
var rm = client.GetAll().SingleOrDefault(m => m.UserName.ToLower() == username.ToLower());
|
||||
|
||||
byte[] salt = new byte[24];
|
||||
byte[] hash = calculateHash(newPassword, ref salt);
|
||||
|
||||
rm.PassSalt = salt;
|
||||
rm.PassHash = hash;
|
||||
|
||||
client.Store(rm);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public override bool ChangePasswordQuestionAndAnswer(string username, string password, string newPasswordQuestion, string newPasswordAnswer)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public override MembershipUser CreateUser(string username, string password, string email, string passwordQuestion, string passwordAnswer, bool isApproved, object providerUserKey, out MembershipCreateStatus status)
|
||||
{
|
||||
if (password.Length < MinRequiredPasswordLength)
|
||||
{
|
||||
status = MembershipCreateStatus.InvalidPassword;
|
||||
return null;
|
||||
}
|
||||
|
||||
MembershipUser mu = null;
|
||||
|
||||
using (RedisClient rClient = new RedisClient(DatabaseConfig.Host, DatabaseConfig.Port, db: DatabaseConfig.Database))
|
||||
{
|
||||
var client = rClient.As<RedisMember>();
|
||||
var users = client.GetAll();
|
||||
|
||||
if (users.Any(m => m.UserName.ToLower() == username.ToLower()))
|
||||
{
|
||||
status = MembershipCreateStatus.DuplicateUserName;
|
||||
}
|
||||
else if (users.Any(m => m.EmailAddress.ToLower() == email.ToLower()))
|
||||
{
|
||||
status = MembershipCreateStatus.DuplicateEmail;
|
||||
}
|
||||
else
|
||||
{
|
||||
byte[] salt = new byte[24];
|
||||
byte[] hash = calculateHash(password, ref salt);
|
||||
|
||||
RedisMember rm = new RedisMember()
|
||||
{
|
||||
Id = Guid.NewGuid(),
|
||||
UserName = username,
|
||||
PassHash = hash,
|
||||
PassSalt = salt,
|
||||
EmailAddress = email,
|
||||
|
||||
IsApproved = false,
|
||||
IsLockedOut = false,
|
||||
|
||||
CreationDate = DateTime.Now,
|
||||
LastLoginDate = DateTime.MinValue,
|
||||
LastActivityDate = DateTime.MinValue,
|
||||
LastLockoutDate = DateTime.MinValue
|
||||
};
|
||||
|
||||
client.Store(rm);
|
||||
|
||||
status = MembershipCreateStatus.Success;
|
||||
mu = new MembershipUser(this.Name, rm.UserName, rm.Id, rm.EmailAddress, "", "", rm.IsApproved, rm.IsLockedOut, rm.CreationDate, rm.LastLoginDate, rm.LastActivityDate, DateTime.MinValue, rm.LastLockoutDate);
|
||||
}
|
||||
}
|
||||
|
||||
return mu;
|
||||
}
|
||||
|
||||
private static byte[] calculateHash(string password, ref byte[] salt)
|
||||
{
|
||||
if (!salt.Any(v => v != 0))
|
||||
{
|
||||
RNGCryptoServiceProvider rng = new RNGCryptoServiceProvider();
|
||||
rng.GetBytes(salt);
|
||||
}
|
||||
|
||||
byte[] passwordBytes = Encoding.UTF8.GetBytes(password);
|
||||
|
||||
byte[] hashPlaintext = new byte[salt.Length + passwordBytes.Length];
|
||||
|
||||
passwordBytes.CopyTo(hashPlaintext, 0);
|
||||
salt.CopyTo(hashPlaintext, passwordBytes.Length);
|
||||
|
||||
SHA512CryptoServiceProvider sha = new SHA512CryptoServiceProvider();
|
||||
byte[] hash = sha.ComputeHash(hashPlaintext);
|
||||
|
||||
return hash;
|
||||
}
|
||||
|
||||
public override bool DeleteUser(string username, bool deleteAllRelatedData)
|
||||
{
|
||||
using (RedisClient rClient = new RedisClient(DatabaseConfig.Host, DatabaseConfig.Port, db: DatabaseConfig.Database))
|
||||
{
|
||||
var client = rClient.As<RedisMember>();
|
||||
var user = client.GetAll().SingleOrDefault(m => m.UserName.ToLower() == username.ToLower());
|
||||
|
||||
if (user != null)
|
||||
{
|
||||
client.DeleteById(user.Id);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override MembershipUserCollection FindUsersByEmail(string emailToMatch, int pageIndex, int pageSize, out int totalRecords)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public override MembershipUserCollection FindUsersByName(string usernameToMatch, int pageIndex, int pageSize, out int totalRecords)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public override MembershipUserCollection GetAllUsers(int pageIndex, int pageSize, out int totalRecords)
|
||||
{
|
||||
MembershipUserCollection muc = new MembershipUserCollection();
|
||||
|
||||
using (RedisClient rClient = new RedisClient(DatabaseConfig.Host, DatabaseConfig.Port, db: DatabaseConfig.Database))
|
||||
{
|
||||
var client = rClient.As<RedisMember>();
|
||||
var users = client.GetAll();
|
||||
|
||||
totalRecords = users.Count;
|
||||
var pageItems = users.Skip(pageIndex * pageSize).Take(pageSize);
|
||||
|
||||
foreach (var rm in pageItems)
|
||||
{
|
||||
muc.Add(new MembershipUser(this.Name, rm.UserName, rm.Id, rm.EmailAddress, "", "", rm.IsApproved, rm.IsLockedOut, rm.CreationDate, rm.LastLoginDate, rm.LastActivityDate, DateTime.MinValue, rm.LastLockoutDate));
|
||||
}
|
||||
}
|
||||
|
||||
return muc;
|
||||
}
|
||||
|
||||
public override int GetNumberOfUsersOnline()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public override string GetPassword(string username, string answer)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public override MembershipUser GetUser(string username, bool userIsOnline)
|
||||
{
|
||||
using (RedisClient rClient = new RedisClient(DatabaseConfig.Host, DatabaseConfig.Port, db: DatabaseConfig.Database))
|
||||
{
|
||||
var client = rClient.As<RedisMember>();
|
||||
var rm = client.GetAll().SingleOrDefault(m => m.UserName.ToLower() == username.ToLower());
|
||||
|
||||
if (rm == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
else
|
||||
{
|
||||
return new MembershipUser(this.Name, rm.UserName, rm.Id, rm.EmailAddress, "", "", rm.IsApproved, rm.IsLockedOut, rm.CreationDate, rm.LastLoginDate, rm.LastActivityDate, DateTime.MinValue, rm.LastLockoutDate);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override MembershipUser GetUser(object providerUserKey, bool userIsOnline)
|
||||
{
|
||||
using (RedisClient rClient = new RedisClient(DatabaseConfig.Host, DatabaseConfig.Port, db: DatabaseConfig.Database))
|
||||
{
|
||||
var client = rClient.As<RedisMember>();
|
||||
var rm = client.GetById(providerUserKey);
|
||||
|
||||
if (rm == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
else
|
||||
{
|
||||
return new MembershipUser(this.Name, rm.UserName, rm.Id, rm.EmailAddress, "", "", rm.IsApproved, rm.IsLockedOut, rm.CreationDate, rm.LastLoginDate, rm.LastActivityDate, DateTime.MinValue, rm.LastLockoutDate);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override string GetUserNameByEmail(string email)
|
||||
{
|
||||
using (RedisClient rClient = new RedisClient(DatabaseConfig.Host, DatabaseConfig.Port, db: DatabaseConfig.Database))
|
||||
{
|
||||
var client = rClient.As<RedisMember>();
|
||||
var rm = client.GetAll().SingleOrDefault(m => m.EmailAddress.ToLower() == email.ToLower());
|
||||
|
||||
if (rm == null)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
else
|
||||
{
|
||||
return rm.UserName;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override string ResetPassword(string username, string answer)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void ChangeApproval(Guid Id, bool newStatus)
|
||||
{
|
||||
using (RedisClient rClient = new RedisClient(DatabaseConfig.Host, DatabaseConfig.Port, db: DatabaseConfig.Database))
|
||||
{
|
||||
var client = rClient.As<RedisMember>();
|
||||
var rm = client.GetById(Id);
|
||||
|
||||
if (rm != null)
|
||||
{
|
||||
rm.IsApproved = newStatus;
|
||||
client.Store(rm);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override bool UnlockUser(string userName)
|
||||
{
|
||||
using (RedisClient rClient = new RedisClient(DatabaseConfig.Host, DatabaseConfig.Port, db: DatabaseConfig.Database))
|
||||
{
|
||||
var client = rClient.As<RedisMember>();
|
||||
var rm = client.GetAll().SingleOrDefault(m => m.UserName.ToLower() == userName.ToLower());
|
||||
|
||||
rm.IsLockedOut = false;
|
||||
|
||||
client.Store(rm);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public override void UpdateUser(MembershipUser user)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public override bool ValidateUser(string username, string password)
|
||||
{
|
||||
using (RedisClient rClient = new RedisClient(DatabaseConfig.Host, DatabaseConfig.Port, db: DatabaseConfig.Database))
|
||||
{
|
||||
var client = rClient.As<RedisMember>();
|
||||
var rm = client.GetAll().SingleOrDefault(m => m.UserName.ToLower() == username.ToLower());
|
||||
|
||||
if (rm == null || !rm.IsApproved)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
byte[] salt = rm.PassSalt;
|
||||
byte[] hash = calculateHash(password, ref salt);
|
||||
|
||||
bool isFail = false;
|
||||
|
||||
for (int i = 0; i > hash.Length; i++)
|
||||
{
|
||||
isFail |= (hash[i] != rm.PassHash[i]);
|
||||
}
|
||||
|
||||
return !isFail;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[DataObject]
|
||||
public class RedisMember : IHasId<Guid>
|
||||
{
|
||||
[Key]
|
||||
[Index]
|
||||
public Guid Id { get; set; }
|
||||
|
||||
[@Required]
|
||||
[DisplayName("Username")]
|
||||
[Key]
|
||||
public string UserName { get; set; }
|
||||
|
||||
[@Required]
|
||||
[MaxLength(512)]
|
||||
public byte[] PassHash { get; set; }
|
||||
|
||||
[@Required]
|
||||
[MaxLength(24)]
|
||||
public byte[] PassSalt { get; set; }
|
||||
|
||||
[@Required]
|
||||
[DisplayName("Email Address")]
|
||||
[Key]
|
||||
public string EmailAddress { get; set; }
|
||||
|
||||
public bool IsApproved { get; set; }
|
||||
public bool IsLockedOut { get; set; }
|
||||
|
||||
public DateTime CreationDate { get; set; }
|
||||
public DateTime LastActivityDate { get; set; }
|
||||
public DateTime LastLockoutDate { get; set; }
|
||||
public DateTime LastLoginDate { get; set; }
|
||||
}
|
||||
}
|
257
BuildFeed.csproj
Normal file
257
BuildFeed.csproj
Normal file
|
@ -0,0 +1,257 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProductVersion>
|
||||
</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{CDDCF754-ECAA-4A66-ADAA-62957A57A51B}</ProjectGuid>
|
||||
<ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>BuildFeed</RootNamespace>
|
||||
<AssemblyName>BuildFeed</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||
<MvcBuildViews>false</MvcBuildViews>
|
||||
<UseIISExpress>true</UseIISExpress>
|
||||
<IISExpressSSLPort />
|
||||
<IISExpressAnonymousAuthentication />
|
||||
<IISExpressWindowsAuthentication />
|
||||
<IISExpressUseClassicPipelineMode />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<CodeAnalysisRuleSet>ExtendedDesignGuidelineRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Antlr3.Runtime, Version=3.5.0.2, Culture=neutral, PublicKeyToken=eb42632606e9261f, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\packages\Antlr.3.5.0.2\lib\Antlr3.Runtime.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Elmah">
|
||||
<HintPath>..\packages\elmah.corelibrary.1.2.1\lib\Elmah.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Elmah.Mvc">
|
||||
<HintPath>..\packages\Elmah.MVC.2.1.1\lib\net40\Elmah.Mvc.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\packages\Newtonsoft.Json.6.0.5\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="NServiceKit.Common">
|
||||
<HintPath>..\packages\NServiceKit.Common.1.0.11\lib\net35\NServiceKit.Common.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="NServiceKit.Interfaces">
|
||||
<HintPath>..\packages\NServiceKit.Common.1.0.11\lib\net35\NServiceKit.Interfaces.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="NServiceKit.Redis">
|
||||
<HintPath>..\packages\NServiceKit.Redis.1.0.7\lib\net35\NServiceKit.Redis.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="NServiceKit.Text">
|
||||
<HintPath>..\packages\NServiceKit.Text.1.0.10\lib\net35\NServiceKit.Text.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="RouteDebugger">
|
||||
<HintPath>..\packages\routedebugger.2.1.4.0\lib\net40\RouteDebugger.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Net.Http.Formatting">
|
||||
<HintPath>..\packages\Microsoft.AspNet.WebApi.Client.5.2.2\lib\net45\System.Net.Http.Formatting.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.ServiceModel" />
|
||||
<Reference Include="System.Web.DynamicData" />
|
||||
<Reference Include="System.Web.Entity" />
|
||||
<Reference Include="System.Web.ApplicationServices" />
|
||||
<Reference Include="System.ComponentModel.DataAnnotations" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="System.Web.Helpers, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\packages\Microsoft.AspNet.WebPages.3.2.2\lib\net45\System.Web.Helpers.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Web.Http">
|
||||
<HintPath>..\packages\Microsoft.AspNet.WebApi.Core.5.2.2\lib\net45\System.Web.Http.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Web.Http.WebHost">
|
||||
<HintPath>..\packages\Microsoft.AspNet.WebApi.WebHost.5.2.2\lib\net45\System.Web.Http.WebHost.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Web.Mvc, Version=5.2.2.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\packages\Microsoft.AspNet.Mvc.5.2.2\lib\net45\System.Web.Mvc.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Web.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\packages\Microsoft.AspNet.Razor.3.2.2\lib\net45\System.Web.Razor.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Web.WebPages, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\packages\Microsoft.AspNet.WebPages.3.2.2\lib\net45\System.Web.WebPages.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Web.WebPages.Deployment, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\packages\Microsoft.AspNet.WebPages.3.2.2\lib\net45\System.Web.WebPages.Deployment.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\packages\Microsoft.AspNet.WebPages.3.2.2\lib\net45\System.Web.WebPages.Razor.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Web" />
|
||||
<Reference Include="System.Web.Extensions" />
|
||||
<Reference Include="System.Web.Abstractions" />
|
||||
<Reference Include="System.Web.Routing" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System.Configuration" />
|
||||
<Reference Include="System.Web.Services" />
|
||||
<Reference Include="System.EnterpriseServices" />
|
||||
<Reference Include="Microsoft.Web.Infrastructure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<Private>True</Private>
|
||||
<HintPath>..\packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Net.Http">
|
||||
</Reference>
|
||||
<Reference Include="System.Net.Http.WebRequest">
|
||||
</Reference>
|
||||
<Reference Include="System.Web.Optimization">
|
||||
<HintPath>..\packages\Microsoft.AspNet.Web.Optimization.1.1.3\lib\net40\System.Web.Optimization.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="WebGrease, Version=1.6.5135.21930, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\packages\WebGrease.1.6.0\lib\WebGrease.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="X.Web.RSS">
|
||||
<HintPath>..\packages\xwebrss.1.2.1.130\lib\net40-client\X.Web.RSS.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="App_Code\BuildDateTimeModelBinder.cs" />
|
||||
<Compile Include="App_Start\BundleConfig.cs" />
|
||||
<Compile Include="App_Start\DatabaseConfig.cs" />
|
||||
<Compile Include="App_Start\FilterConfig.cs" />
|
||||
<Compile Include="App_Start\RouteConfig.cs" />
|
||||
<Compile Include="Areas\admin\adminAreaRegistration.cs" />
|
||||
<Compile Include="Areas\admin\Controllers\usersController.cs" />
|
||||
<Compile Include="Auth\RedisMembershipProvider.cs" />
|
||||
<Compile Include="Controllers\apiController.cs" />
|
||||
<Compile Include="Controllers\buildController.cs" />
|
||||
<Compile Include="Controllers\pageController.cs" />
|
||||
<Compile Include="Controllers\rssController.cs" />
|
||||
<Compile Include="Controllers\supportController.cs" />
|
||||
<Compile Include="Global.asax.cs">
|
||||
<DependentUpon>Global.asax</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Models\Build.cs" />
|
||||
<Compile Include="Models\ViewModel\LoginUser.cs" />
|
||||
<Compile Include="Models\ViewModel\ChangePassword.cs" />
|
||||
<Compile Include="Models\ViewModel\RegistrationUser.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="browserconfig.xml" />
|
||||
<Content Include="favicon.ico" />
|
||||
<Content Include="Global.asax" />
|
||||
<Content Include="content\style.css" />
|
||||
<Content Include="Areas\admin\Views\web.config" />
|
||||
<Content Include="Areas\admin\Views\users\index.cshtml" />
|
||||
<Content Include="Areas\admin\Views\_ViewStart.cshtml" />
|
||||
<Content Include="content\tile\wide.png" />
|
||||
<Content Include="content\Web.config" />
|
||||
<None Include="Properties\PublishProfiles\Milestone 1 FTP.pubxml" />
|
||||
<None Include="Scripts\jquery-2.1.1.intellisense.js" />
|
||||
<Content Include="googleacffc6da14c53e15.html" />
|
||||
<Content Include="content\tile\large.png" />
|
||||
<Content Include="Scripts\jquery-2.1.1.js" />
|
||||
<Content Include="Scripts\jquery-2.1.1.min.js" />
|
||||
<Content Include="Scripts\jquery-2.1.1.min.map" />
|
||||
<None Include="Scripts\jquery.validate-vsdoc.js" />
|
||||
<Content Include="Scripts\jquery.validate.js" />
|
||||
<Content Include="Scripts\jquery.validate.min.js" />
|
||||
<Content Include="Scripts\jquery.validate.unobtrusive.js" />
|
||||
<Content Include="Scripts\jquery.validate.unobtrusive.min.js" />
|
||||
<Content Include="Scripts\_references.js" />
|
||||
<Content Include="content\tile\square.png" />
|
||||
<Content Include="content\tile\tiny.png" />
|
||||
<Content Include="Web.config">
|
||||
<SubType>Designer</SubType>
|
||||
</Content>
|
||||
<Content Include="Web.Debug.config">
|
||||
<DependentUpon>Web.config</DependentUpon>
|
||||
</Content>
|
||||
<Content Include="Web.Release.config">
|
||||
<DependentUpon>Web.config</DependentUpon>
|
||||
</Content>
|
||||
<Content Include="Views\Web.config" />
|
||||
<Content Include="Views\_ViewStart.cshtml" />
|
||||
<Content Include="Views\shared\error.cshtml" />
|
||||
<Content Include="Views\shared\_default.cshtml" />
|
||||
<Content Include="Views\build\create.cshtml" />
|
||||
<Content Include="Views\build\index.cshtml" />
|
||||
<Content Include="Views\shared\DisplayTemplates\Enumeration.cshtml" />
|
||||
<Content Include="Views\shared\EditorTemplates\Enumeration.cshtml" />
|
||||
<Content Include="Views\support\register.cshtml" />
|
||||
<Content Include="Views\support\login.cshtml" />
|
||||
<Content Include="Views\build\info.cshtml" />
|
||||
<Content Include="Views\support\password.cshtml" />
|
||||
<Content Include="Views\support\thanks_register.cshtml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="App_Data\" />
|
||||
<Folder Include="Areas\admin\Models\" />
|
||||
<Folder Include="Areas\admin\Views\Shared\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<PropertyGroup>
|
||||
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
|
||||
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
<Import Project="$(VSToolsPath)\WebApplications\Microsoft.WebApplication.targets" Condition="'$(VSToolsPath)' != ''" />
|
||||
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" Condition="false" />
|
||||
<Target Name="MvcBuildViews" AfterTargets="AfterBuild" Condition="'$(MvcBuildViews)'=='true'">
|
||||
<AspNetCompiler VirtualPath="temp" PhysicalPath="$(WebProjectOutputDir)" />
|
||||
</Target>
|
||||
<ProjectExtensions>
|
||||
<VisualStudio>
|
||||
<FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}">
|
||||
<WebProjectProperties>
|
||||
<UseIIS>True</UseIIS>
|
||||
<AutoAssignPort>True</AutoAssignPort>
|
||||
<DevelopmentServerPort>50468</DevelopmentServerPort>
|
||||
<DevelopmentServerVPath>/</DevelopmentServerVPath>
|
||||
<IISUrl>http://localhost:50468/</IISUrl>
|
||||
<NTLMAuthentication>False</NTLMAuthentication>
|
||||
<UseCustomServer>False</UseCustomServer>
|
||||
<CustomServerUrl>
|
||||
</CustomServerUrl>
|
||||
<SaveServerSettingsInUserFile>False</SaveServerSettingsInUserFile>
|
||||
</WebProjectProperties>
|
||||
</FlavorProperties>
|
||||
</VisualStudio>
|
||||
</ProjectExtensions>
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target> -->
|
||||
</Project>
|
18
Controllers/apiController.cs
Normal file
18
Controllers/apiController.cs
Normal file
|
@ -0,0 +1,18 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Web.Http;
|
||||
using BuildFeed.Models;
|
||||
|
||||
namespace BuildFeed.Controllers
|
||||
{
|
||||
public class apiController : ApiController
|
||||
{
|
||||
public IEnumerable<Build> GetBuilds()
|
||||
{
|
||||
return Build.SelectInBuildOrder();
|
||||
}
|
||||
}
|
||||
}
|
155
Controllers/buildController.cs
Normal file
155
Controllers/buildController.cs
Normal file
|
@ -0,0 +1,155 @@
|
|||
using BuildFeed.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.Mvc;
|
||||
|
||||
namespace BuildFeed.Controllers
|
||||
{
|
||||
public class buildController : Controller
|
||||
{
|
||||
public int pageSize { get { return 12; } }
|
||||
//
|
||||
// GET: /build/
|
||||
|
||||
public ActionResult Index(int page = 1)
|
||||
{
|
||||
var builds = Build.SelectInBuildOrder();
|
||||
var pageBuilds = builds.Skip((page - 1) * pageSize).Take(pageSize);
|
||||
|
||||
ViewBag.PageNumber = page;
|
||||
ViewBag.PageCount = Math.Ceiling(Convert.ToDouble(builds.Count()) / Convert.ToDouble(pageSize));
|
||||
|
||||
return View(pageBuilds);
|
||||
}
|
||||
|
||||
public ActionResult Year(int year, int page = 1)
|
||||
{
|
||||
var builds = Build.SelectInBuildOrder().Where(b => b.BuildTime.HasValue && b.BuildTime.Value.Year == year);
|
||||
var pageBuilds = builds.Skip((page - 1) * pageSize).Take(pageSize);
|
||||
|
||||
ViewBag.PageNumber = page;
|
||||
ViewBag.PageCount = Math.Ceiling(Convert.ToDouble(builds.Count()) / Convert.ToDouble(pageSize));
|
||||
|
||||
return View("Index", pageBuilds);
|
||||
}
|
||||
|
||||
public ActionResult Lab(string lab, int page = 1)
|
||||
{
|
||||
var builds = Build.SelectInBuildOrder().Where(b => b.Lab != null && (b.Lab.ToLower() == lab.ToLower()));
|
||||
var pageBuilds = builds.Skip((page - 1) * pageSize).Take(pageSize);
|
||||
|
||||
ViewBag.PageNumber = page;
|
||||
ViewBag.PageCount = Math.Ceiling(Convert.ToDouble(builds.Count()) / Convert.ToDouble(pageSize));
|
||||
|
||||
return View("Index", pageBuilds);
|
||||
}
|
||||
|
||||
public ActionResult Version(int major, int minor, int page = 1)
|
||||
{
|
||||
var builds = Build.SelectInBuildOrder().Where(b => b.MajorVersion == major && b.MinorVersion == minor);
|
||||
var pageBuilds = builds.Skip((page - 1) * pageSize).Take(pageSize);
|
||||
|
||||
ViewBag.PageNumber = page;
|
||||
ViewBag.PageCount = Math.Ceiling(Convert.ToDouble(builds.Count()) / Convert.ToDouble(pageSize));
|
||||
|
||||
return View("Index", pageBuilds);
|
||||
}
|
||||
|
||||
public ActionResult Source(TypeOfSource source, int page = 1)
|
||||
{
|
||||
var builds = Build.SelectInBuildOrder().Where(b => b.SourceType == source);
|
||||
var pageBuilds = builds.Skip((page - 1) * pageSize).Take(pageSize);
|
||||
|
||||
ViewBag.PageNumber = page;
|
||||
ViewBag.PageCount = Math.Ceiling(Convert.ToDouble(builds.Count()) / Convert.ToDouble(pageSize));
|
||||
|
||||
return View("Index", pageBuilds);
|
||||
}
|
||||
|
||||
//
|
||||
// GET: /build/Info/5
|
||||
|
||||
public ActionResult Info(int id)
|
||||
{
|
||||
Build b = Build.SelectById(id);
|
||||
return View(b);
|
||||
}
|
||||
|
||||
//
|
||||
// GET: /build/Create
|
||||
[Authorize]
|
||||
public ActionResult Create()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
//
|
||||
// POST: /build/Create
|
||||
[Authorize]
|
||||
[HttpPost]
|
||||
public ActionResult Create(Build build)
|
||||
{
|
||||
if (ModelState.IsValid)
|
||||
{
|
||||
try
|
||||
{
|
||||
build.Added = DateTime.Now;
|
||||
Build.Insert(build);
|
||||
}
|
||||
catch
|
||||
{
|
||||
return View(build);
|
||||
}
|
||||
return RedirectToAction("Index");
|
||||
}
|
||||
else
|
||||
{
|
||||
return View(build);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// GET: /build/Edit/5
|
||||
[Authorize]
|
||||
public ActionResult Edit(long id)
|
||||
{
|
||||
Build b = Build.SelectById(id);
|
||||
return View("Create", b);
|
||||
}
|
||||
|
||||
//
|
||||
// POST: /build/Edit/5
|
||||
[Authorize]
|
||||
[HttpPost]
|
||||
public ActionResult Edit(long id, Build build)
|
||||
{
|
||||
if (ModelState.IsValid)
|
||||
{
|
||||
try
|
||||
{
|
||||
Build.Update(build);
|
||||
}
|
||||
catch
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
return RedirectToAction("Index");
|
||||
}
|
||||
else
|
||||
{
|
||||
return View("Create", build);
|
||||
}
|
||||
}
|
||||
|
||||
[Authorize(Users = "hounsell")]
|
||||
public ActionResult Delete(long id)
|
||||
{
|
||||
Build.DeleteById(id);
|
||||
return Redirect("/");
|
||||
}
|
||||
}
|
||||
}
|
16
Controllers/pageController.cs
Normal file
16
Controllers/pageController.cs
Normal file
|
@ -0,0 +1,16 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.Mvc;
|
||||
|
||||
namespace BuildFeed.Controllers
|
||||
{
|
||||
public class pageController : Controller
|
||||
{
|
||||
public ActionResult Index()
|
||||
{
|
||||
return new RedirectResult("/", true);
|
||||
}
|
||||
}
|
||||
}
|
125
Controllers/rssController.cs
Normal file
125
Controllers/rssController.cs
Normal file
|
@ -0,0 +1,125 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.ServiceModel.Syndication;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web.Mvc;
|
||||
using BuildFeed.Models;
|
||||
using X.Web.RSS;
|
||||
using X.Web.RSS.Enumerators;
|
||||
using X.Web.RSS.Structure;
|
||||
using X.Web.RSS.Structure.Validators;
|
||||
|
||||
namespace BuildFeed.Controllers
|
||||
{
|
||||
public class rssController : Controller
|
||||
{
|
||||
//
|
||||
// GET: /rss/
|
||||
public async Task<ActionResult> Index()
|
||||
{
|
||||
var builds = Build.SelectInBuildOrder().Take(20);
|
||||
|
||||
RssDocument rdoc = new RssDocument()
|
||||
{
|
||||
Channel = new RssChannel()
|
||||
{
|
||||
Title = "BuildFeed RSS - Recently Compiled",
|
||||
Description = "",
|
||||
Generator = "BuildFeed.net RSS Controller",
|
||||
Link = new RssUrl(string.Format("{0}://{1}", Request.Url.Scheme, Request.Url.Authority)),
|
||||
SkipHours = new List<Hour>(),
|
||||
SkipDays = new List<Day>(),
|
||||
|
||||
Items = (from build in builds
|
||||
select new RssItem()
|
||||
{
|
||||
Title = build.FullBuildString,
|
||||
Link = new RssUrl(string.Format("{0}://{1}{2}", Request.Url.Scheme, Request.Url.Authority, Url.Action("Info", new { controller = "Build", id = build.Id }))),
|
||||
Guid = new RssGuid() { IsPermaLink = true, Value = string.Format("{0}://{1}{2}", Request.Url.Scheme, Request.Url.Authority, Url.Action("Info", new { controller = "Build", id = build.Id })) },
|
||||
}).ToList()
|
||||
}
|
||||
};
|
||||
|
||||
Response.ContentType = "application/rss+xml";
|
||||
|
||||
await Response.Output.WriteAsync(rdoc.ToXml());
|
||||
|
||||
return new EmptyResult();
|
||||
}
|
||||
|
||||
public async Task<ActionResult> Added()
|
||||
{
|
||||
var builds = Build.Select().OrderByDescending(b => b.Added).Take(20);
|
||||
|
||||
RssDocument rdoc = new RssDocument()
|
||||
{
|
||||
Channel = new RssChannel()
|
||||
{
|
||||
Title = "BuildFeed RSS - Recently Added",
|
||||
Description = "",
|
||||
Generator = "BuildFeed.net RSS Controller",
|
||||
Link = new RssUrl(string.Format("{0}://{1}", Request.Url.Scheme, Request.Url.Authority)),
|
||||
SkipHours = new List<Hour>(),
|
||||
SkipDays = new List<Day>(),
|
||||
|
||||
Items = (from build in builds
|
||||
select new RssItem()
|
||||
{
|
||||
Title = build.FullBuildString,
|
||||
Link = new RssUrl(string.Format("{0}://{1}{2}", Request.Url.Scheme, Request.Url.Authority, Url.Action("Info", new { controller = "Build", id = build.Id }))),
|
||||
Guid = new RssGuid() { IsPermaLink = true, Value = string.Format("{0}://{1}{2}", Request.Url.Scheme, Request.Url.Authority, Url.Action("Info", new { controller = "Build", id = build.Id })) },
|
||||
PubDate = build.Added
|
||||
}).ToList()
|
||||
}
|
||||
};
|
||||
|
||||
Response.ContentType = "application/rss+xml";
|
||||
|
||||
await Response.Output.WriteAsync(rdoc.ToXml());
|
||||
|
||||
return new EmptyResult();
|
||||
}
|
||||
|
||||
|
||||
public async Task<ActionResult> Version()
|
||||
{
|
||||
var builds = Build.Select()
|
||||
.OrderByDescending(b => b.MajorVersion)
|
||||
.ThenByDescending(b => b.MinorVersion)
|
||||
.ThenByDescending(b => b.Number)
|
||||
.ThenByDescending(b => b.Revision)
|
||||
.ThenByDescending(b => b.BuildTime)
|
||||
.Take(20);
|
||||
|
||||
|
||||
RssDocument rdoc = new RssDocument()
|
||||
{
|
||||
Channel = new RssChannel()
|
||||
{
|
||||
Title = "BuildFeed RSS - Highest Version",
|
||||
Description = "",
|
||||
Generator = "BuildFeed.net RSS Controller",
|
||||
Link = new RssUrl(string.Format("{0}://{1}", Request.Url.Scheme, Request.Url.Authority)),
|
||||
SkipHours = new List<Hour>(),
|
||||
SkipDays = new List<Day>(),
|
||||
|
||||
Items = (from build in builds
|
||||
select new RssItem()
|
||||
{
|
||||
Title = build.FullBuildString,
|
||||
Link = new RssUrl(string.Format("{0}://{1}{2}", Request.Url.Scheme, Request.Url.Authority, Url.Action("Info", new { controller = "Build", id = build.Id }))),
|
||||
Guid = new RssGuid() { IsPermaLink = true, Value = string.Format("{0}://{1}{2}", Request.Url.Scheme, Request.Url.Authority, Url.Action("Info", new { controller = "Build", id = build.Id })) },
|
||||
}).ToList()
|
||||
}
|
||||
};
|
||||
|
||||
Response.ContentType = "application/rss+xml";
|
||||
|
||||
await Response.Output.WriteAsync(rdoc.ToXml());
|
||||
|
||||
return new EmptyResult();
|
||||
}
|
||||
}
|
||||
}
|
115
Controllers/supportController.cs
Normal file
115
Controllers/supportController.cs
Normal file
|
@ -0,0 +1,115 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.Mvc;
|
||||
using System.Web.Security;
|
||||
using BuildFeed.Models.ViewModel;
|
||||
|
||||
namespace BuildFeed.Controllers
|
||||
{
|
||||
public class supportController : Controller
|
||||
{
|
||||
// GET: support
|
||||
public ActionResult Index()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
public ActionResult Login()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public ActionResult Login(LoginUser ru)
|
||||
{
|
||||
if (ModelState.IsValid)
|
||||
{
|
||||
bool isAuthenticated = Membership.ValidateUser(ru.UserName, ru.Password);
|
||||
|
||||
if (isAuthenticated)
|
||||
{
|
||||
FormsAuthentication.SetAuthCookie(ru.UserName, ru.RememberMe);
|
||||
|
||||
string returnUrl = string.IsNullOrEmpty(Request.QueryString["ReturnUrl"]) ? "/" : Request.QueryString["ReturnUrl"];
|
||||
|
||||
return Redirect(returnUrl);
|
||||
}
|
||||
}
|
||||
|
||||
ViewData["ErrorMessage"] = "The username and password are not valid.";
|
||||
return View(ru);
|
||||
}
|
||||
|
||||
[Authorize]
|
||||
public ActionResult Password()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public ActionResult Password(ChangePassword cp)
|
||||
{
|
||||
if (ModelState.IsValid)
|
||||
{
|
||||
var user = Membership.GetUser();
|
||||
bool success = user.ChangePassword(cp.OldPassword, cp.NewPassword);
|
||||
|
||||
if (success)
|
||||
{
|
||||
return Redirect("/");
|
||||
}
|
||||
}
|
||||
|
||||
ViewData["ErrorMessage"] = "There was an error changing your password.";
|
||||
return View(cp);
|
||||
}
|
||||
|
||||
public ActionResult Logout()
|
||||
{
|
||||
FormsAuthentication.SignOut();
|
||||
return Redirect("/");
|
||||
}
|
||||
|
||||
public ActionResult Register()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public ActionResult Register(RegistrationUser ru)
|
||||
{
|
||||
if (ModelState.IsValid)
|
||||
{
|
||||
MembershipCreateStatus status;
|
||||
Membership.CreateUser(ru.UserName, ru.Password, ru.EmailAddress, "THIS WILL BE IGNORED", "I WILL BE IGNORED", false, out status);
|
||||
|
||||
switch (status)
|
||||
{
|
||||
case MembershipCreateStatus.Success:
|
||||
return RedirectToAction("thanks_register");
|
||||
case MembershipCreateStatus.InvalidPassword:
|
||||
ViewData["ErrorMessage"] = "The password is invalid.";
|
||||
break;
|
||||
case MembershipCreateStatus.DuplicateEmail:
|
||||
ViewData["ErrorMessage"] = "A user account with this email address already exists.";
|
||||
break;
|
||||
case MembershipCreateStatus.DuplicateUserName:
|
||||
ViewData["ErrorMessage"] = "A user account with this user name already exists.";
|
||||
break;
|
||||
default:
|
||||
ViewData["ErrorMessage"] = "Unspecified error.";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return View(ru);
|
||||
}
|
||||
|
||||
public ActionResult thanks_register()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
}
|
||||
}
|
1
Global.asax
Normal file
1
Global.asax
Normal file
|
@ -0,0 +1 @@
|
|||
<%@ Application Codebehind="Global.asax.cs" Inherits="BuildFeed.MvcApplication" Language="C#" %>
|
26
Global.asax.cs
Normal file
26
Global.asax.cs
Normal file
|
@ -0,0 +1,26 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.Mvc;
|
||||
using System.Web.Optimization;
|
||||
using System.Web.Routing;
|
||||
|
||||
namespace BuildFeed
|
||||
{
|
||||
public class MvcApplication : System.Web.HttpApplication
|
||||
{
|
||||
protected void Application_Start()
|
||||
{
|
||||
AreaRegistration.RegisterAllAreas();
|
||||
FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
|
||||
RouteConfig.RegisterRoutes(RouteTable.Routes);
|
||||
BundleConfig.RegisterBundles(BundleTable.Bundles);
|
||||
|
||||
BuildDateTimeModelBinder b = new BuildDateTimeModelBinder();
|
||||
|
||||
ModelBinders.Binders.Add(typeof(DateTime), b);
|
||||
ModelBinders.Binders.Add(typeof(DateTime?), b);
|
||||
}
|
||||
}
|
||||
}
|
265
Models/Build.cs
Normal file
265
Models/Build.cs
Normal file
|
@ -0,0 +1,265 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using NServiceKit.DataAnnotations;
|
||||
using NServiceKit.DesignPatterns.Model;
|
||||
using NServiceKit.Redis;
|
||||
|
||||
using Required = System.ComponentModel.DataAnnotations.RequiredAttribute;
|
||||
|
||||
namespace BuildFeed.Models
|
||||
{
|
||||
[DataObject]
|
||||
public class Build : IHasId<long>
|
||||
{
|
||||
[Key]
|
||||
[AutoIncrement]
|
||||
[Index]
|
||||
public long Id { get; set; }
|
||||
|
||||
[@Required]
|
||||
[DisplayName("Major Version")]
|
||||
public byte MajorVersion { get; set; }
|
||||
|
||||
[@Required]
|
||||
[DisplayName("Minor Version")]
|
||||
public byte MinorVersion { get; set; }
|
||||
|
||||
[@Required]
|
||||
[DisplayName("Build Number")]
|
||||
public ushort Number { get; set; }
|
||||
|
||||
[DisplayName("Build Revision")]
|
||||
[DisplayFormat(ConvertEmptyStringToNull = true)]
|
||||
public ushort? Revision { get; set; }
|
||||
|
||||
[DisplayName("Lab String")]
|
||||
public string Lab { get; set; }
|
||||
|
||||
[DisplayName("Build Time")]
|
||||
[DisplayFormat(ConvertEmptyStringToNull = true, ApplyFormatInEditMode = true, DataFormatString = "{0:yyMMdd-HHmm}")]
|
||||
public DateTime? BuildTime { get; set; }
|
||||
|
||||
|
||||
[@Required]
|
||||
[DisplayName("Time Added")]
|
||||
public DateTime Added { get; set; }
|
||||
|
||||
[@Required]
|
||||
[DisplayName("Source Type")]
|
||||
[EnumDataType(typeof(TypeOfSource))]
|
||||
public TypeOfSource SourceType { get; set; }
|
||||
|
||||
[DisplayName("Source Details")]
|
||||
public string SourceDetails { get; set; }
|
||||
|
||||
|
||||
[RegularExpression("http://betawiki\\.net/.+")]
|
||||
[DisplayName("BetaWiki (Client)")]
|
||||
public Uri BetaWikiUri { get; set; }
|
||||
|
||||
[RegularExpression("http://betawiki\\.net/.+")]
|
||||
[DisplayName("BetaWiki (Server)")]
|
||||
public Uri BetaWikiServerUri { get; set; }
|
||||
|
||||
[RegularExpression("http://www\\.betaarchive\\.com/wiki/.+")]
|
||||
[DisplayName("BetaArchive Wiki")]
|
||||
public Uri BetaArchiveUri { get; set; }
|
||||
|
||||
[RegularExpression("http://longhorn\\.ms/.+")]
|
||||
[DisplayName("Longhorn.ms")]
|
||||
public Uri LonghornMsUri { get; set; }
|
||||
|
||||
[RegularExpression("https://winworldpc\\.com/.+")]
|
||||
[DisplayName("WinWorldPC Library")]
|
||||
public Uri WinWorldPCUri { get; set; }
|
||||
|
||||
public string FullBuildString
|
||||
{
|
||||
get
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.AppendFormat("{0}.{1}.{2}", MajorVersion, MinorVersion, Number);
|
||||
|
||||
if (Revision.HasValue)
|
||||
{
|
||||
sb.AppendFormat(".{0}", Revision);
|
||||
}
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(Lab))
|
||||
{
|
||||
sb.AppendFormat(".{0}", Lab);
|
||||
}
|
||||
|
||||
if (BuildTime.HasValue)
|
||||
{
|
||||
sb.AppendFormat(".{0:yyMMdd-HHmm}", BuildTime);
|
||||
}
|
||||
|
||||
return sb.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
[DataObjectMethod(DataObjectMethodType.Select, true)]
|
||||
public static IEnumerable<Build> Select()
|
||||
{
|
||||
using (RedisClient rClient = new RedisClient(DatabaseConfig.Host, DatabaseConfig.Port, db: DatabaseConfig.Database))
|
||||
{
|
||||
var client = rClient.As<Build>();
|
||||
return client.GetAll();
|
||||
}
|
||||
}
|
||||
|
||||
[DataObjectMethod(DataObjectMethodType.Select, false)]
|
||||
public static Build SelectById(long id)
|
||||
{
|
||||
using (RedisClient rClient = new RedisClient(DatabaseConfig.Host, DatabaseConfig.Port, db: DatabaseConfig.Database))
|
||||
{
|
||||
var client = rClient.As<Build>();
|
||||
return client.GetById(id);
|
||||
}
|
||||
}
|
||||
|
||||
[DataObjectMethod(DataObjectMethodType.Select, false)]
|
||||
public static IEnumerable<Build> SelectInBuildOrder()
|
||||
{
|
||||
using (RedisClient rClient = new RedisClient(DatabaseConfig.Host, DatabaseConfig.Port, db: DatabaseConfig.Database))
|
||||
{
|
||||
var client = rClient.As<Build>();
|
||||
return client.GetAll()
|
||||
.OrderByDescending(b => b.BuildTime)
|
||||
.ThenByDescending(b => b.MajorVersion)
|
||||
.ThenByDescending(b => b.MinorVersion)
|
||||
.ThenByDescending(b => b.Number)
|
||||
.ThenByDescending(b => b.Revision);
|
||||
}
|
||||
}
|
||||
|
||||
[DataObjectMethod(DataObjectMethodType.Select, false)]
|
||||
public static IEnumerable<BuildVersion> SelectBuildVersions()
|
||||
{
|
||||
using (RedisClient rClient = new RedisClient(DatabaseConfig.Host, DatabaseConfig.Port, db: DatabaseConfig.Database))
|
||||
{
|
||||
var client = rClient.As<Build>();
|
||||
var results = client.GetAll()
|
||||
.GroupBy(b => new BuildVersion() { Major = b.MajorVersion, Minor = b.MinorVersion })
|
||||
.Select(b => new BuildVersion() { Major = b.First().MajorVersion, Minor = b.First().MinorVersion })
|
||||
.OrderByDescending(y => y.Major)
|
||||
.ThenByDescending(y => y.Minor);
|
||||
return results;
|
||||
}
|
||||
}
|
||||
|
||||
[DataObjectMethod(DataObjectMethodType.Select, false)]
|
||||
public static IEnumerable<int> SelectBuildYears()
|
||||
{
|
||||
using (RedisClient rClient = new RedisClient(DatabaseConfig.Host, DatabaseConfig.Port, db: DatabaseConfig.Database))
|
||||
{
|
||||
var client = rClient.As<Build>();
|
||||
var results = client.GetAll().Where(b => b.BuildTime.HasValue)
|
||||
.GroupBy(b => b.BuildTime.Value.Year)
|
||||
.Select(b => b.First().BuildTime.Value.Year)
|
||||
.OrderByDescending(y => y);
|
||||
return results;
|
||||
}
|
||||
}
|
||||
|
||||
[DataObjectMethod(DataObjectMethodType.Select, false)]
|
||||
public static IEnumerable<string> SelectBuildLabs()
|
||||
{
|
||||
using (RedisClient rClient = new RedisClient(DatabaseConfig.Host, DatabaseConfig.Port, db: DatabaseConfig.Database))
|
||||
{
|
||||
var client = rClient.As<Build>();
|
||||
var results = client.GetAll()
|
||||
.Where(b => !string.IsNullOrWhiteSpace(b.Lab))
|
||||
.GroupBy(b => b.Lab.ToLower())
|
||||
.Select(b => b.First().Lab.ToLower())
|
||||
.OrderBy(s => s);
|
||||
return results;
|
||||
}
|
||||
}
|
||||
|
||||
[DataObjectMethod(DataObjectMethodType.Insert, true)]
|
||||
public static void Insert(Build item)
|
||||
{
|
||||
using (RedisClient rClient = new RedisClient(DatabaseConfig.Host, DatabaseConfig.Port, db: DatabaseConfig.Database))
|
||||
{
|
||||
var client = rClient.As<Build>();
|
||||
item.Id = client.GetNextSequence();
|
||||
client.Store(item);
|
||||
}
|
||||
}
|
||||
|
||||
[DataObjectMethod(DataObjectMethodType.Update, true)]
|
||||
public static void Update(Build item)
|
||||
{
|
||||
Build old = Build.SelectById(item.Id);
|
||||
item.Added = old.Added;
|
||||
|
||||
using (RedisClient rClient = new RedisClient(DatabaseConfig.Host, DatabaseConfig.Port, db: DatabaseConfig.Database))
|
||||
{
|
||||
var client = rClient.As<Build>();
|
||||
client.Store(item);
|
||||
}
|
||||
}
|
||||
|
||||
[DataObjectMethod(DataObjectMethodType.Insert, false)]
|
||||
public static void InsertAll(IEnumerable<Build> items)
|
||||
{
|
||||
using (RedisClient rClient = new RedisClient(DatabaseConfig.Host, DatabaseConfig.Port, db: DatabaseConfig.Database))
|
||||
{
|
||||
var client = rClient.As<Build>();
|
||||
client.StoreAll(items);
|
||||
}
|
||||
}
|
||||
|
||||
[DataObjectMethod(DataObjectMethodType.Delete, true)]
|
||||
public static void DeleteById(long id)
|
||||
{
|
||||
using (RedisClient rClient = new RedisClient(DatabaseConfig.Host, DatabaseConfig.Port, db: DatabaseConfig.Database))
|
||||
{
|
||||
var client = rClient.As<Build>();
|
||||
client.DeleteById(id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public enum TypeOfSource
|
||||
{
|
||||
[Display(Name = "Public Release")]
|
||||
PublicRelease,
|
||||
|
||||
[Display(Name = "Public Leak")]
|
||||
InternalLeak,
|
||||
|
||||
[Display(Name = "Update (GDR)")]
|
||||
UpdateGDR,
|
||||
|
||||
[Display(Name = "Update (LDR)")]
|
||||
UpdateLDR,
|
||||
|
||||
[Display(Name = "App Package")]
|
||||
AppPackage,
|
||||
|
||||
[Display(Name = "Build Tools")]
|
||||
BuildTools,
|
||||
|
||||
[Display(Name = "Documentation")]
|
||||
Documentation,
|
||||
|
||||
[Display(Name = "Logging")]
|
||||
Logging,
|
||||
|
||||
[Display(Name = "Private Leak")]
|
||||
PrivateLeak
|
||||
}
|
||||
|
||||
public struct BuildVersion
|
||||
{
|
||||
public byte Major { get; set; }
|
||||
public byte Minor { get; set; }
|
||||
}
|
||||
}
|
28
Models/ViewModel/ChangePassword.cs
Normal file
28
Models/ViewModel/ChangePassword.cs
Normal file
|
@ -0,0 +1,28 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
|
||||
namespace BuildFeed.Models.ViewModel
|
||||
{
|
||||
public class ChangePassword
|
||||
{
|
||||
[Required]
|
||||
[MinLength(12)]
|
||||
[DisplayName("Enter Old Password")]
|
||||
public string OldPassword { get; set; }
|
||||
|
||||
[Required]
|
||||
[MinLength(12)]
|
||||
[DisplayName("Enter New Password")]
|
||||
public string NewPassword { get; set; }
|
||||
|
||||
[Required]
|
||||
[MinLength(12)]
|
||||
[DisplayName("Confirm New Password")]
|
||||
[Compare("NewPassword")]
|
||||
public string ConfirmNewPassword { get; set; }
|
||||
}
|
||||
}
|
23
Models/ViewModel/LoginUser.cs
Normal file
23
Models/ViewModel/LoginUser.cs
Normal file
|
@ -0,0 +1,23 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
|
||||
namespace BuildFeed.Models.ViewModel
|
||||
{
|
||||
public class LoginUser
|
||||
{
|
||||
[Required]
|
||||
[DisplayName("Username")]
|
||||
public string UserName { get; set; }
|
||||
|
||||
[Required]
|
||||
[DisplayName("Password")]
|
||||
public string Password { get; set; }
|
||||
|
||||
[DisplayName("Remember me")]
|
||||
public bool RememberMe { get; set; }
|
||||
}
|
||||
}
|
32
Models/ViewModel/RegistrationUser.cs
Normal file
32
Models/ViewModel/RegistrationUser.cs
Normal file
|
@ -0,0 +1,32 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
|
||||
namespace BuildFeed.Models.ViewModel
|
||||
{
|
||||
public class RegistrationUser
|
||||
{
|
||||
[Required]
|
||||
[DisplayName("Username")]
|
||||
public string UserName { get; set; }
|
||||
|
||||
[Required]
|
||||
[MinLength(12)]
|
||||
[DisplayName("Enter Password")]
|
||||
public string Password { get; set; }
|
||||
|
||||
[Required]
|
||||
[MinLength(12)]
|
||||
[DisplayName("Confirm Password")]
|
||||
[Compare("Password")]
|
||||
public string ConfirmPassword { get; set; }
|
||||
|
||||
[Required]
|
||||
[EmailAddress]
|
||||
[DisplayName("Email Address")]
|
||||
public string EmailAddress { get; set; }
|
||||
}
|
||||
}
|
35
Properties/AssemblyInfo.cs
Normal file
35
Properties/AssemblyInfo.cs
Normal file
|
@ -0,0 +1,35 @@
|
|||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("BuildFeed")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("BuildFeed")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2014")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("6c5846cb-43ac-4818-a9b5-a6cd1d6983a3")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Revision and Build Numbers
|
||||
// by using the '*' as shown below:
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
4
Scripts/_references.js
Normal file
4
Scripts/_references.js
Normal file
|
@ -0,0 +1,4 @@
|
|||
/// <autosync enabled="true" />
|
||||
/// <reference path="jquery-2.1.1.js" />
|
||||
/// <reference path="jquery.validate.js" />
|
||||
/// <reference path="jquery.validate.unobtrusive.js" />
|
2670
Scripts/jquery-2.1.1.intellisense.js
vendored
Normal file
2670
Scripts/jquery-2.1.1.intellisense.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
9190
Scripts/jquery-2.1.1.js
vendored
Normal file
9190
Scripts/jquery-2.1.1.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
4
Scripts/jquery-2.1.1.min.js
vendored
Normal file
4
Scripts/jquery-2.1.1.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
Scripts/jquery-2.1.1.min.map
Normal file
1
Scripts/jquery-2.1.1.min.map
Normal file
File diff suppressed because one or more lines are too long
1288
Scripts/jquery.validate-vsdoc.js
vendored
Normal file
1288
Scripts/jquery.validate-vsdoc.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1357
Scripts/jquery.validate.js
vendored
Normal file
1357
Scripts/jquery.validate.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
4
Scripts/jquery.validate.min.js
vendored
Normal file
4
Scripts/jquery.validate.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
410
Scripts/jquery.validate.unobtrusive.js
vendored
Normal file
410
Scripts/jquery.validate.unobtrusive.js
vendored
Normal file
|
@ -0,0 +1,410 @@
|
|||
/* NUGET: BEGIN LICENSE TEXT
|
||||
*
|
||||
* Microsoft grants you the right to use these script files for the sole
|
||||
* purpose of either: (i) interacting through your browser with the Microsoft
|
||||
* website or online service, subject to the applicable licensing or use
|
||||
* terms; or (ii) using the files as included with a Microsoft product subject
|
||||
* to that product's license terms. Microsoft reserves all other rights to the
|
||||
* files not expressly granted by Microsoft, whether by implication, estoppel
|
||||
* or otherwise. Insofar as a script file is dual licensed under GPL,
|
||||
* Microsoft neither took the code under GPL nor distributes it thereunder but
|
||||
* under the terms set out in this paragraph. All notices and licenses
|
||||
* below are for informational purposes only.
|
||||
*
|
||||
* NUGET: END LICENSE TEXT */
|
||||
/*!
|
||||
** Unobtrusive validation support library for jQuery and jQuery Validate
|
||||
** Copyright (C) Microsoft Corporation. All rights reserved.
|
||||
*/
|
||||
|
||||
/*jslint white: true, browser: true, onevar: true, undef: true, nomen: true, eqeqeq: true, plusplus: true, bitwise: true, regexp: true, newcap: true, immed: true, strict: false */
|
||||
/*global document: false, jQuery: false */
|
||||
|
||||
(function ($) {
|
||||
var $jQval = $.validator,
|
||||
adapters,
|
||||
data_validation = "unobtrusiveValidation";
|
||||
|
||||
function setValidationValues(options, ruleName, value) {
|
||||
options.rules[ruleName] = value;
|
||||
if (options.message) {
|
||||
options.messages[ruleName] = options.message;
|
||||
}
|
||||
}
|
||||
|
||||
function splitAndTrim(value) {
|
||||
return value.replace(/^\s+|\s+$/g, "").split(/\s*,\s*/g);
|
||||
}
|
||||
|
||||
function escapeAttributeValue(value) {
|
||||
// As mentioned on http://api.jquery.com/category/selectors/
|
||||
return value.replace(/([!"#$%&'()*+,./:;<=>?@\[\\\]^`{|}~])/g, "\\$1");
|
||||
}
|
||||
|
||||
function getModelPrefix(fieldName) {
|
||||
return fieldName.substr(0, fieldName.lastIndexOf(".") + 1);
|
||||
}
|
||||
|
||||
function appendModelPrefix(value, prefix) {
|
||||
if (value.indexOf("*.") === 0) {
|
||||
value = value.replace("*.", prefix);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
function onError(error, inputElement) { // 'this' is the form element
|
||||
var container = $(this).find("[data-valmsg-for='" + escapeAttributeValue(inputElement[0].name) + "']"),
|
||||
replaceAttrValue = container.attr("data-valmsg-replace"),
|
||||
replace = replaceAttrValue ? $.parseJSON(replaceAttrValue) !== false : null;
|
||||
|
||||
container.removeClass("field-validation-valid").addClass("field-validation-error");
|
||||
error.data("unobtrusiveContainer", container);
|
||||
|
||||
if (replace) {
|
||||
container.empty();
|
||||
error.removeClass("input-validation-error").appendTo(container);
|
||||
}
|
||||
else {
|
||||
error.hide();
|
||||
}
|
||||
}
|
||||
|
||||
function onErrors(event, validator) { // 'this' is the form element
|
||||
var container = $(this).find("[data-valmsg-summary=true]"),
|
||||
list = container.find("ul");
|
||||
|
||||
if (list && list.length && validator.errorList.length) {
|
||||
list.empty();
|
||||
container.addClass("validation-summary-errors").removeClass("validation-summary-valid");
|
||||
|
||||
$.each(validator.errorList, function () {
|
||||
$("<li />").html(this.message).appendTo(list);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function onSuccess(error) { // 'this' is the form element
|
||||
var container = error.data("unobtrusiveContainer"),
|
||||
replaceAttrValue = container.attr("data-valmsg-replace"),
|
||||
replace = replaceAttrValue ? $.parseJSON(replaceAttrValue) : null;
|
||||
|
||||
if (container) {
|
||||
container.addClass("field-validation-valid").removeClass("field-validation-error");
|
||||
error.removeData("unobtrusiveContainer");
|
||||
|
||||
if (replace) {
|
||||
container.empty();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function onReset(event) { // 'this' is the form element
|
||||
var $form = $(this);
|
||||
$form.data("validator").resetForm();
|
||||
$form.find(".validation-summary-errors")
|
||||
.addClass("validation-summary-valid")
|
||||
.removeClass("validation-summary-errors");
|
||||
$form.find(".field-validation-error")
|
||||
.addClass("field-validation-valid")
|
||||
.removeClass("field-validation-error")
|
||||
.removeData("unobtrusiveContainer")
|
||||
.find(">*") // If we were using valmsg-replace, get the underlying error
|
||||
.removeData("unobtrusiveContainer");
|
||||
}
|
||||
|
||||
function validationInfo(form) {
|
||||
var $form = $(form),
|
||||
result = $form.data(data_validation),
|
||||
onResetProxy = $.proxy(onReset, form),
|
||||
defaultOptions = $jQval.unobtrusive.options || {},
|
||||
execInContext = function (name, args) {
|
||||
var func = defaultOptions[name];
|
||||
func && $.isFunction(func) && func.apply(form, args);
|
||||
}
|
||||
|
||||
if (!result) {
|
||||
result = {
|
||||
options: { // options structure passed to jQuery Validate's validate() method
|
||||
errorClass: defaultOptions.errorClass || "input-validation-error",
|
||||
errorElement: defaultOptions.errorElement || "span",
|
||||
errorPlacement: function () {
|
||||
onError.apply(form, arguments);
|
||||
execInContext("errorPlacement", arguments);
|
||||
},
|
||||
invalidHandler: function () {
|
||||
onErrors.apply(form, arguments);
|
||||
execInContext("invalidHandler", arguments);
|
||||
},
|
||||
messages: {},
|
||||
rules: {},
|
||||
success: function () {
|
||||
onSuccess.apply(form, arguments);
|
||||
execInContext("success", arguments);
|
||||
}
|
||||
},
|
||||
attachValidation: function () {
|
||||
$form
|
||||
.off("reset." + data_validation, onResetProxy)
|
||||
.on("reset." + data_validation, onResetProxy)
|
||||
.validate(this.options);
|
||||
},
|
||||
validate: function () { // a validation function that is called by unobtrusive Ajax
|
||||
$form.validate();
|
||||
return $form.valid();
|
||||
}
|
||||
};
|
||||
$form.data(data_validation, result);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
$jQval.unobtrusive = {
|
||||
adapters: [],
|
||||
|
||||
parseElement: function (element, skipAttach) {
|
||||
/// <summary>
|
||||
/// Parses a single HTML element for unobtrusive validation attributes.
|
||||
/// </summary>
|
||||
/// <param name="element" domElement="true">The HTML element to be parsed.</param>
|
||||
/// <param name="skipAttach" type="Boolean">[Optional] true to skip attaching the
|
||||
/// validation to the form. If parsing just this single element, you should specify true.
|
||||
/// If parsing several elements, you should specify false, and manually attach the validation
|
||||
/// to the form when you are finished. The default is false.</param>
|
||||
var $element = $(element),
|
||||
form = $element.parents("form")[0],
|
||||
valInfo, rules, messages;
|
||||
|
||||
if (!form) { // Cannot do client-side validation without a form
|
||||
return;
|
||||
}
|
||||
|
||||
valInfo = validationInfo(form);
|
||||
valInfo.options.rules[element.name] = rules = {};
|
||||
valInfo.options.messages[element.name] = messages = {};
|
||||
|
||||
$.each(this.adapters, function () {
|
||||
var prefix = "data-val-" + this.name,
|
||||
message = $element.attr(prefix),
|
||||
paramValues = {};
|
||||
|
||||
if (message !== undefined) { // Compare against undefined, because an empty message is legal (and falsy)
|
||||
prefix += "-";
|
||||
|
||||
$.each(this.params, function () {
|
||||
paramValues[this] = $element.attr(prefix + this);
|
||||
});
|
||||
|
||||
this.adapt({
|
||||
element: element,
|
||||
form: form,
|
||||
message: message,
|
||||
params: paramValues,
|
||||
rules: rules,
|
||||
messages: messages
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
$.extend(rules, { "__dummy__": true });
|
||||
|
||||
if (!skipAttach) {
|
||||
valInfo.attachValidation();
|
||||
}
|
||||
},
|
||||
|
||||
parse: function (selector) {
|
||||
/// <summary>
|
||||
/// Parses all the HTML elements in the specified selector. It looks for input elements decorated
|
||||
/// with the [data-val=true] attribute value and enables validation according to the data-val-*
|
||||
/// attribute values.
|
||||
/// </summary>
|
||||
/// <param name="selector" type="String">Any valid jQuery selector.</param>
|
||||
|
||||
// $forms includes all forms in selector's DOM hierarchy (parent, children and self) that have at least one
|
||||
// element with data-val=true
|
||||
var $selector = $(selector),
|
||||
$forms = $selector.parents()
|
||||
.addBack()
|
||||
.filter("form")
|
||||
.add($selector.find("form"))
|
||||
.has("[data-val=true]");
|
||||
|
||||
$selector.find("[data-val=true]").each(function () {
|
||||
$jQval.unobtrusive.parseElement(this, true);
|
||||
});
|
||||
|
||||
$forms.each(function () {
|
||||
var info = validationInfo(this);
|
||||
if (info) {
|
||||
info.attachValidation();
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
adapters = $jQval.unobtrusive.adapters;
|
||||
|
||||
adapters.add = function (adapterName, params, fn) {
|
||||
/// <summary>Adds a new adapter to convert unobtrusive HTML into a jQuery Validate validation.</summary>
|
||||
/// <param name="adapterName" type="String">The name of the adapter to be added. This matches the name used
|
||||
/// in the data-val-nnnn HTML attribute (where nnnn is the adapter name).</param>
|
||||
/// <param name="params" type="Array" optional="true">[Optional] An array of parameter names (strings) that will
|
||||
/// be extracted from the data-val-nnnn-mmmm HTML attributes (where nnnn is the adapter name, and
|
||||
/// mmmm is the parameter name).</param>
|
||||
/// <param name="fn" type="Function">The function to call, which adapts the values from the HTML
|
||||
/// attributes into jQuery Validate rules and/or messages.</param>
|
||||
/// <returns type="jQuery.validator.unobtrusive.adapters" />
|
||||
if (!fn) { // Called with no params, just a function
|
||||
fn = params;
|
||||
params = [];
|
||||
}
|
||||
this.push({ name: adapterName, params: params, adapt: fn });
|
||||
return this;
|
||||
};
|
||||
|
||||
adapters.addBool = function (adapterName, ruleName) {
|
||||
/// <summary>Adds a new adapter to convert unobtrusive HTML into a jQuery Validate validation, where
|
||||
/// the jQuery Validate validation rule has no parameter values.</summary>
|
||||
/// <param name="adapterName" type="String">The name of the adapter to be added. This matches the name used
|
||||
/// in the data-val-nnnn HTML attribute (where nnnn is the adapter name).</param>
|
||||
/// <param name="ruleName" type="String" optional="true">[Optional] The name of the jQuery Validate rule. If not provided, the value
|
||||
/// of adapterName will be used instead.</param>
|
||||
/// <returns type="jQuery.validator.unobtrusive.adapters" />
|
||||
return this.add(adapterName, function (options) {
|
||||
setValidationValues(options, ruleName || adapterName, true);
|
||||
});
|
||||
};
|
||||
|
||||
adapters.addMinMax = function (adapterName, minRuleName, maxRuleName, minMaxRuleName, minAttribute, maxAttribute) {
|
||||
/// <summary>Adds a new adapter to convert unobtrusive HTML into a jQuery Validate validation, where
|
||||
/// the jQuery Validate validation has three potential rules (one for min-only, one for max-only, and
|
||||
/// one for min-and-max). The HTML parameters are expected to be named -min and -max.</summary>
|
||||
/// <param name="adapterName" type="String">The name of the adapter to be added. This matches the name used
|
||||
/// in the data-val-nnnn HTML attribute (where nnnn is the adapter name).</param>
|
||||
/// <param name="minRuleName" type="String">The name of the jQuery Validate rule to be used when you only
|
||||
/// have a minimum value.</param>
|
||||
/// <param name="maxRuleName" type="String">The name of the jQuery Validate rule to be used when you only
|
||||
/// have a maximum value.</param>
|
||||
/// <param name="minMaxRuleName" type="String">The name of the jQuery Validate rule to be used when you
|
||||
/// have both a minimum and maximum value.</param>
|
||||
/// <param name="minAttribute" type="String" optional="true">[Optional] The name of the HTML attribute that
|
||||
/// contains the minimum value. The default is "min".</param>
|
||||
/// <param name="maxAttribute" type="String" optional="true">[Optional] The name of the HTML attribute that
|
||||
/// contains the maximum value. The default is "max".</param>
|
||||
/// <returns type="jQuery.validator.unobtrusive.adapters" />
|
||||
return this.add(adapterName, [minAttribute || "min", maxAttribute || "max"], function (options) {
|
||||
var min = options.params.min,
|
||||
max = options.params.max;
|
||||
|
||||
if (min && max) {
|
||||
setValidationValues(options, minMaxRuleName, [min, max]);
|
||||
}
|
||||
else if (min) {
|
||||
setValidationValues(options, minRuleName, min);
|
||||
}
|
||||
else if (max) {
|
||||
setValidationValues(options, maxRuleName, max);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
adapters.addSingleVal = function (adapterName, attribute, ruleName) {
|
||||
/// <summary>Adds a new adapter to convert unobtrusive HTML into a jQuery Validate validation, where
|
||||
/// the jQuery Validate validation rule has a single value.</summary>
|
||||
/// <param name="adapterName" type="String">The name of the adapter to be added. This matches the name used
|
||||
/// in the data-val-nnnn HTML attribute(where nnnn is the adapter name).</param>
|
||||
/// <param name="attribute" type="String">[Optional] The name of the HTML attribute that contains the value.
|
||||
/// The default is "val".</param>
|
||||
/// <param name="ruleName" type="String" optional="true">[Optional] The name of the jQuery Validate rule. If not provided, the value
|
||||
/// of adapterName will be used instead.</param>
|
||||
/// <returns type="jQuery.validator.unobtrusive.adapters" />
|
||||
return this.add(adapterName, [attribute || "val"], function (options) {
|
||||
setValidationValues(options, ruleName || adapterName, options.params[attribute]);
|
||||
});
|
||||
};
|
||||
|
||||
$jQval.addMethod("__dummy__", function (value, element, params) {
|
||||
return true;
|
||||
});
|
||||
|
||||
$jQval.addMethod("regex", function (value, element, params) {
|
||||
var match;
|
||||
if (this.optional(element)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
match = new RegExp(params).exec(value);
|
||||
return (match && (match.index === 0) && (match[0].length === value.length));
|
||||
});
|
||||
|
||||
$jQval.addMethod("nonalphamin", function (value, element, nonalphamin) {
|
||||
var match;
|
||||
if (nonalphamin) {
|
||||
match = value.match(/\W/g);
|
||||
match = match && match.length >= nonalphamin;
|
||||
}
|
||||
return match;
|
||||
});
|
||||
|
||||
if ($jQval.methods.extension) {
|
||||
adapters.addSingleVal("accept", "mimtype");
|
||||
adapters.addSingleVal("extension", "extension");
|
||||
} else {
|
||||
// for backward compatibility, when the 'extension' validation method does not exist, such as with versions
|
||||
// of JQuery Validation plugin prior to 1.10, we should use the 'accept' method for
|
||||
// validating the extension, and ignore mime-type validations as they are not supported.
|
||||
adapters.addSingleVal("extension", "extension", "accept");
|
||||
}
|
||||
|
||||
adapters.addSingleVal("regex", "pattern");
|
||||
adapters.addBool("creditcard").addBool("date").addBool("digits").addBool("email").addBool("number").addBool("url");
|
||||
adapters.addMinMax("length", "minlength", "maxlength", "rangelength").addMinMax("range", "min", "max", "range");
|
||||
adapters.addMinMax("minlength", "minlength").addMinMax("maxlength", "minlength", "maxlength");
|
||||
adapters.add("equalto", ["other"], function (options) {
|
||||
var prefix = getModelPrefix(options.element.name),
|
||||
other = options.params.other,
|
||||
fullOtherName = appendModelPrefix(other, prefix),
|
||||
element = $(options.form).find(":input").filter("[name='" + escapeAttributeValue(fullOtherName) + "']")[0];
|
||||
|
||||
setValidationValues(options, "equalTo", element);
|
||||
});
|
||||
adapters.add("required", function (options) {
|
||||
// jQuery Validate equates "required" with "mandatory" for checkbox elements
|
||||
if (options.element.tagName.toUpperCase() !== "INPUT" || options.element.type.toUpperCase() !== "CHECKBOX") {
|
||||
setValidationValues(options, "required", true);
|
||||
}
|
||||
});
|
||||
adapters.add("remote", ["url", "type", "additionalfields"], function (options) {
|
||||
var value = {
|
||||
url: options.params.url,
|
||||
type: options.params.type || "GET",
|
||||
data: {}
|
||||
},
|
||||
prefix = getModelPrefix(options.element.name);
|
||||
|
||||
$.each(splitAndTrim(options.params.additionalfields || options.element.name), function (i, fieldName) {
|
||||
var paramName = appendModelPrefix(fieldName, prefix);
|
||||
value.data[paramName] = function () {
|
||||
return $(options.form).find(":input").filter("[name='" + escapeAttributeValue(paramName) + "']").val();
|
||||
};
|
||||
});
|
||||
|
||||
setValidationValues(options, "remote", value);
|
||||
});
|
||||
adapters.add("password", ["min", "nonalphamin", "regex"], function (options) {
|
||||
if (options.params.min) {
|
||||
setValidationValues(options, "minlength", options.params.min);
|
||||
}
|
||||
if (options.params.nonalphamin) {
|
||||
setValidationValues(options, "nonalphamin", options.params.nonalphamin);
|
||||
}
|
||||
if (options.params.regex) {
|
||||
setValidationValues(options, "regex", options.params.regex);
|
||||
}
|
||||
});
|
||||
|
||||
$(function () {
|
||||
$jQval.unobtrusive.parse(document);
|
||||
});
|
||||
}(jQuery));
|
19
Scripts/jquery.validate.unobtrusive.min.js
vendored
Normal file
19
Scripts/jquery.validate.unobtrusive.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
35
Views/Web.config
Normal file
35
Views/Web.config
Normal file
|
@ -0,0 +1,35 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
<configuration>
|
||||
<configSections>
|
||||
<sectionGroup name="system.web.webPages.razor" type="System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
|
||||
<section name="host" type="System.Web.WebPages.Razor.Configuration.HostSection, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
|
||||
<section name="pages" type="System.Web.WebPages.Razor.Configuration.RazorPagesSection, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
|
||||
</sectionGroup>
|
||||
</configSections>
|
||||
|
||||
<system.web.webPages.razor>
|
||||
<host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=5.2.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
|
||||
<pages pageBaseType="System.Web.Mvc.WebViewPage">
|
||||
<namespaces>
|
||||
<add namespace="System.Web.Mvc" />
|
||||
<add namespace="System.Web.Mvc.Ajax" />
|
||||
<add namespace="System.Web.Mvc.Html" />
|
||||
<add namespace="System.Web.Optimization"/>
|
||||
<add namespace="System.Web.Routing" />
|
||||
<add namespace="BuildFeed" />
|
||||
</namespaces>
|
||||
</pages>
|
||||
</system.web.webPages.razor>
|
||||
|
||||
<appSettings>
|
||||
<add key="webpages:Enabled" value="false" />
|
||||
</appSettings>
|
||||
|
||||
<system.webServer>
|
||||
<handlers>
|
||||
<remove name="BlockViewHandler"/>
|
||||
<add name="BlockViewHandler" path="*" verb="*" preCondition="integratedMode" type="System.Web.HttpNotFoundHandler" />
|
||||
</handlers>
|
||||
</system.webServer>
|
||||
</configuration>
|
3
Views/_ViewStart.cshtml
Normal file
3
Views/_ViewStart.cshtml
Normal file
|
@ -0,0 +1,3 @@
|
|||
@{
|
||||
Layout = "~/Views/shared/_default.cshtml";
|
||||
}
|
24
Views/shared/DisplayTemplates/Enumeration.cshtml
Normal file
24
Views/shared/DisplayTemplates/Enumeration.cshtml
Normal file
|
@ -0,0 +1,24 @@
|
|||
@using System.ComponentModel.DataAnnotations
|
||||
|
||||
@model BuildFeed.Models.TypeOfSource
|
||||
|
||||
@{
|
||||
|
||||
Func<object, string> GetDisplayName = o =>
|
||||
{
|
||||
var result = null as string;
|
||||
var display = o.GetType()
|
||||
.GetMember(o.ToString()).First()
|
||||
.GetCustomAttributes(false)
|
||||
.OfType<DisplayAttribute>()
|
||||
.LastOrDefault();
|
||||
if (display != null)
|
||||
{
|
||||
result = display.GetName();
|
||||
}
|
||||
|
||||
return result ?? o.ToString();
|
||||
};
|
||||
}
|
||||
|
||||
@GetDisplayName(ViewData.Model)
|
32
Views/shared/EditorTemplates/Enumeration.cshtml
Normal file
32
Views/shared/EditorTemplates/Enumeration.cshtml
Normal file
|
@ -0,0 +1,32 @@
|
|||
@using System.ComponentModel.DataAnnotations
|
||||
|
||||
@model Enum
|
||||
|
||||
@{
|
||||
|
||||
Func<object, string> GetDisplayName = o =>
|
||||
{
|
||||
var result = null as string;
|
||||
var display = o.GetType()
|
||||
.GetMember(o.ToString()).First()
|
||||
.GetCustomAttributes(false)
|
||||
.OfType<DisplayAttribute>()
|
||||
.LastOrDefault();
|
||||
if (display != null)
|
||||
{
|
||||
result = display.GetName();
|
||||
}
|
||||
|
||||
return result ?? o.ToString();
|
||||
};
|
||||
|
||||
var values = Enum.GetValues(ViewData.ModelMetadata.ModelType).Cast<object>()
|
||||
.Select(v => new SelectListItem
|
||||
{
|
||||
Selected = v.Equals(Model),
|
||||
Text = GetDisplayName(v),
|
||||
Value = v.ToString()
|
||||
});
|
||||
}
|
||||
|
||||
@Html.DropDownList("", values, new { @class = "form-control" })
|
69
Views/shared/_default.cshtml
Normal file
69
Views/shared/_default.cshtml
Normal file
|
@ -0,0 +1,69 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta name="viewport" content="width=device-width" />
|
||||
<link href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css" rel="stylesheet" />
|
||||
<link href="//maxcdn.bootstrapcdn.com/bootswatch/3.2.0/yeti/bootstrap.min.css" rel="stylesheet" />
|
||||
<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet" />
|
||||
<link href="//fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,700,400italic" rel="stylesheet" type="text/css" />
|
||||
<link rel="shortcut icon" href="~/favicon.ico" />
|
||||
<link rel="icon" href="~/favicon.ico" />
|
||||
<meta name="application-name" content="BuildFeed" />
|
||||
|
||||
@Styles.Render("~/content/css")
|
||||
<title>@ViewBag.Title</title>
|
||||
@RenderSection("head", false)
|
||||
</head>
|
||||
<body>
|
||||
<script>
|
||||
(function (i, s, o, g, r, a, m) {
|
||||
i['GoogleAnalyticsObject'] = r; i[r] = i[r] || function () {
|
||||
(i[r].q = i[r].q || []).push(arguments)
|
||||
}, i[r].l = 1 * new Date(); a = s.createElement(o),
|
||||
m = s.getElementsByTagName(o)[0]; a.async = 1; a.src = g; m.parentNode.insertBefore(a, m)
|
||||
})(window, document, 'script', '//www.google-analytics.com/analytics.js', 'ga');
|
||||
|
||||
ga('create', 'UA-55417692-1', 'auto');
|
||||
ga('require', 'displayfeatures');
|
||||
ga('require', 'linkid', 'linkid.js');
|
||||
ga('send', 'pageview');
|
||||
</script>
|
||||
<div class="container">
|
||||
<header id="page-header">
|
||||
<div class="row">
|
||||
<div class="col-sm-9">
|
||||
<h1>@Html.ActionLink("BuildFeed", "Index", new { controller = "build", area = "", page = 1 })</h1>
|
||||
</div>
|
||||
<div class="col-sm-3 text-right">
|
||||
<p class="social-links">
|
||||
<a href="https://twitter.com/buildfeed" title="Twitter" target="_blank"><i class="fa fa-2x fa-twitter"></i></a>
|
||||
<a href="@Url.Action("Index", new { controller = "rss", area = "" })" title="Recently compiled"><i class="fa fa-2x fa-rss"></i></a>
|
||||
<a href="@Url.Action("Added", new { controller = "rss", area = "" })" title="Recently added to BuildFeed"><i class="fa fa-2x fa-rss"></i></a>
|
||||
<a href="@Url.Action("Version", new { controller = "rss", area = "" })" title="Highest version"><i class="fa fa-2x fa-rss"></i></a>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
<article id="page-content">
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
@RenderBody()
|
||||
</div>
|
||||
</div>
|
||||
</article>
|
||||
<footer id="page-footer">
|
||||
<div class="row">
|
||||
<div class="col-sm-4 col-sm-offset-8 text-right">
|
||||
<p>
|
||||
© 2013 - 2014, BuildFeed<br />
|
||||
Developed by <a href="https://twitter.com/tomhounsell" target="_blank">Thomas Hounsell</a>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
</div>
|
||||
@Scripts.Render("~/bundles/jquery")
|
||||
<script type="text/javascript" src="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
|
||||
@RenderSection("scripts", required: false)
|
||||
</body>
|
||||
</html>
|
63
Views/shared/error.cshtml
Normal file
63
Views/shared/error.cshtml
Normal file
|
@ -0,0 +1,63 @@
|
|||
@{
|
||||
Layout = null;
|
||||
}
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta name="viewport" content="width=device-width" />
|
||||
<link href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css" rel="stylesheet" />
|
||||
<link href="//maxcdn.bootstrapcdn.com/bootswatch/3.2.0/yeti/bootstrap.min.css" rel="stylesheet" />
|
||||
<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet" />
|
||||
<link href="//fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,700,400italic" rel="stylesheet" type="text/css" />
|
||||
<link rel="shortcut icon" href="~/favicon.ico" />
|
||||
<link rel="icon" href="~/favicon.ico">
|
||||
<meta name="application-name" content="BuildFeed" />
|
||||
|
||||
<title>Error | BuildFeed</title>
|
||||
</head>
|
||||
<body>
|
||||
<script>
|
||||
(function (i, s, o, g, r, a, m) {
|
||||
i['GoogleAnalyticsObject'] = r; i[r] = i[r] || function () {
|
||||
(i[r].q = i[r].q || []).push(arguments)
|
||||
}, i[r].l = 1 * new Date(); a = s.createElement(o),
|
||||
m = s.getElementsByTagName(o)[0]; a.async = 1; a.src = g; m.parentNode.insertBefore(a, m)
|
||||
})(window, document, 'script', '//www.google-analytics.com/analytics.js', 'ga');
|
||||
|
||||
ga('create', 'UA-55417692-1', 'auto');
|
||||
ga('require', 'displayfeatures');
|
||||
ga('require', 'linkid', 'linkid.js');
|
||||
ga('send', 'pageview');
|
||||
</script>
|
||||
<div class="container">
|
||||
<header id="page-header">
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
<h1>@Html.ActionLink("BuildFeed", "Index", new { controller = "build", area = "", page = 1 })</h1>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
<article id="page-content">
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
<h2>Error.</h2>
|
||||
<p>An error occurred while processing your request.</p>
|
||||
</div>
|
||||
</div>
|
||||
</article>
|
||||
<footer id="page-footer">
|
||||
<div class="row">
|
||||
<div class="col-sm-4 col-sm-offset-8 text-right">
|
||||
<p>
|
||||
© 2013 - 2014, BuildFeed<br />
|
||||
Developed by <a href="https://twitter.com/tomhounsell" target="_blank">Thomas Hounsell</a>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
</div>
|
||||
@Scripts.Render("~/bundles/jquery")
|
||||
<script type="text/javascript" src="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
|
||||
</body>
|
||||
</html>
|
68
Views/support/login.cshtml
Normal file
68
Views/support/login.cshtml
Normal file
|
@ -0,0 +1,68 @@
|
|||
@model BuildFeed.Models.ViewModel.LoginUser
|
||||
|
||||
@{
|
||||
ViewBag.Title = "Login | BuildFeed";
|
||||
Html.EnableClientValidation();
|
||||
Html.EnableUnobtrusiveJavaScript();
|
||||
}
|
||||
|
||||
<h2>Login to BuildFeed</h2>
|
||||
|
||||
@using (Html.BeginForm())
|
||||
{
|
||||
@Html.AntiForgeryToken()
|
||||
|
||||
if (ViewData["ErrorMessage"] != null)
|
||||
{
|
||||
<p class="text-danger">
|
||||
@ViewData["ErrorMessage"]
|
||||
</p>
|
||||
}
|
||||
|
||||
<div class="form-horizontal">
|
||||
<div class="form-group">
|
||||
@Html.LabelFor(model => model.UserName, new { @class = "control-label col-md-2" })
|
||||
<div class="col-md-10">
|
||||
<div class="row">
|
||||
<div class="col-sm-6">
|
||||
@Html.TextBoxFor(model => model.UserName, new { @class = "form-control" })
|
||||
</div>
|
||||
</div>
|
||||
@Html.ValidationMessageFor(model => model.UserName)
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
@Html.LabelFor(model => model.Password, new { @class = "control-label col-md-2" })
|
||||
<div class="col-md-10">
|
||||
<div class="row">
|
||||
<div class="col-sm-6">
|
||||
@Html.PasswordFor(model => model.Password, new { @class = "form-control" })
|
||||
</div>
|
||||
</div>
|
||||
@Html.ValidationMessageFor(model => model.Password)
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<div class="col-md-10 col-md-offset-2">
|
||||
<div class="row">
|
||||
<div class="col-sm-6">
|
||||
<label for="RememberMe" class="checkbox checkbox-inline">@Html.CheckBoxFor(model => model.RememberMe) @Html.DisplayNameFor(model => model.RememberMe)</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<div class="col-md-offset-2 col-md-10">
|
||||
<input type="submit" value="Login" class="btn btn-primary" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
|
||||
@section Scripts
|
||||
{
|
||||
@Scripts.Render("~/bundles/jqueryval");
|
||||
}
|
70
Views/support/password.cshtml
Normal file
70
Views/support/password.cshtml
Normal file
|
@ -0,0 +1,70 @@
|
|||
@model BuildFeed.Models.ViewModel.ChangePassword
|
||||
|
||||
@{
|
||||
ViewBag.Title = "Change your password | BuildFeed";
|
||||
Html.EnableClientValidation();
|
||||
Html.EnableUnobtrusiveJavaScript();
|
||||
}
|
||||
|
||||
<h2>Change your password</h2>
|
||||
|
||||
@using (Html.BeginForm())
|
||||
{
|
||||
@Html.AntiForgeryToken()
|
||||
|
||||
if(ViewData["ErrorMessage"] != null)
|
||||
{
|
||||
<p class="text-danger">
|
||||
@ViewData["ErrorMessage"]
|
||||
</p>
|
||||
}
|
||||
|
||||
<div class="form-horizontal">
|
||||
<div class="form-group">
|
||||
@Html.LabelFor(model => model.OldPassword, new { @class = "control-label col-md-2" })
|
||||
<div class="col-md-10">
|
||||
<div class="row">
|
||||
<div class="col-sm-6">
|
||||
@Html.PasswordFor(model => model.OldPassword, new { @class = "form-control" })
|
||||
</div>
|
||||
</div>
|
||||
@Html.ValidationMessageFor(model => model.OldPassword)
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
@Html.LabelFor(model => model.NewPassword, new { @class = "control-label col-md-2" })
|
||||
<div class="col-md-10">
|
||||
<div class="row">
|
||||
<div class="col-sm-6">
|
||||
@Html.PasswordFor(model => model.NewPassword, new { @class = "form-control" })
|
||||
</div>
|
||||
</div>
|
||||
@Html.ValidationMessageFor(model => model.NewPassword)
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
@Html.LabelFor(model => model.ConfirmNewPassword, new { @class = "control-label col-md-2" })
|
||||
<div class="col-md-10">
|
||||
<div class="row">
|
||||
<div class="col-sm-6">
|
||||
@Html.PasswordFor(model => model.ConfirmNewPassword, new { @class = "form-control" })
|
||||
</div>
|
||||
</div>
|
||||
@Html.ValidationMessageFor(model => model.ConfirmNewPassword)
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<div class="col-md-offset-2 col-md-10">
|
||||
<input type="submit" value="Change Password" class="btn btn-primary" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
|
||||
@section Scripts
|
||||
{
|
||||
@Scripts.Render("~/bundles/jqueryval");
|
||||
}
|
82
Views/support/register.cshtml
Normal file
82
Views/support/register.cshtml
Normal file
|
@ -0,0 +1,82 @@
|
|||
@model BuildFeed.Models.ViewModel.RegistrationUser
|
||||
|
||||
@{
|
||||
ViewBag.Title = "Register for an account | BuildFeed";
|
||||
Html.EnableClientValidation();
|
||||
Html.EnableUnobtrusiveJavaScript();
|
||||
}
|
||||
|
||||
<h2>Register for an account</h2>
|
||||
|
||||
@using (Html.BeginForm())
|
||||
{
|
||||
@Html.AntiForgeryToken()
|
||||
|
||||
if(ViewData["ErrorMessage"] != null)
|
||||
{
|
||||
<p class="text-danger">
|
||||
@ViewData["ErrorMessage"]
|
||||
</p>
|
||||
}
|
||||
|
||||
<div class="form-horizontal">
|
||||
<div class="form-group">
|
||||
@Html.LabelFor(model => model.UserName, new { @class = "control-label col-md-2" })
|
||||
<div class="col-md-10">
|
||||
<div class="row">
|
||||
<div class="col-sm-6">
|
||||
@Html.TextBoxFor(model => model.UserName, new { @class = "form-control" })
|
||||
</div>
|
||||
</div>
|
||||
@Html.ValidationMessageFor(model => model.UserName)
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
@Html.LabelFor(model => model.Password, new { @class = "control-label col-md-2" })
|
||||
<div class="col-md-10">
|
||||
<div class="row">
|
||||
<div class="col-sm-6">
|
||||
@Html.PasswordFor(model => model.Password, new { @class = "form-control" })
|
||||
</div>
|
||||
</div>
|
||||
@Html.ValidationMessageFor(model => model.Password)
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
@Html.LabelFor(model => model.ConfirmPassword, new { @class = "control-label col-md-2" })
|
||||
<div class="col-md-10">
|
||||
<div class="row">
|
||||
<div class="col-sm-6">
|
||||
@Html.PasswordFor(model => model.ConfirmPassword, new { @class = "form-control" })
|
||||
</div>
|
||||
</div>
|
||||
@Html.ValidationMessageFor(model => model.ConfirmPassword)
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
@Html.LabelFor(model => model.EmailAddress, new { @class = "control-label col-md-2" })
|
||||
<div class="col-md-10">
|
||||
<div class="row">
|
||||
<div class="col-sm-6">
|
||||
@Html.TextBoxFor(model => model.EmailAddress, new { @class = "form-control" })
|
||||
</div>
|
||||
</div>
|
||||
@Html.ValidationMessageFor(model => model.EmailAddress)
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<div class="col-md-offset-2 col-md-10">
|
||||
<input type="submit" value="Register" class="btn btn-primary" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
|
||||
@section Scripts
|
||||
{
|
||||
@Scripts.Render("~/bundles/jqueryval");
|
||||
}
|
7
Views/support/thanks_register.cshtml
Normal file
7
Views/support/thanks_register.cshtml
Normal file
|
@ -0,0 +1,7 @@
|
|||
|
||||
@{
|
||||
ViewBag.Title = "Thank you for registering | BuildFeed";
|
||||
}
|
||||
|
||||
<h2>Thank you for registering with BuildFeed</h2>
|
||||
<p>Every account is validated by an Administrator, so be patient and check again later.</p>
|
30
Web.Debug.config
Normal file
30
Web.Debug.config
Normal file
|
@ -0,0 +1,30 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
<!-- For more information on using Web.config transformation visit http://go.microsoft.com/fwlink/?LinkId=301874 -->
|
||||
|
||||
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
|
||||
<!--
|
||||
In the example below, the "SetAttributes" transform will change the value of
|
||||
"connectionString" to use "ReleaseSQLServer" only when the "Match" locator
|
||||
finds an attribute "name" that has a value of "MyDB".
|
||||
|
||||
<connectionStrings>
|
||||
<add name="MyDB"
|
||||
connectionString="Data Source=ReleaseSQLServer;Initial Catalog=MyReleaseDB;Integrated Security=True"
|
||||
xdt:Transform="SetAttributes" xdt:Locator="Match(name)"/>
|
||||
</connectionStrings>
|
||||
-->
|
||||
<system.web>
|
||||
<!--
|
||||
In the example below, the "Replace" transform will replace the entire
|
||||
<customErrors> section of your Web.config file.
|
||||
Note that because there is only one customErrors section under the
|
||||
<system.web> node, there is no need to use the "xdt:Locator" attribute.
|
||||
|
||||
<customErrors defaultRedirect="GenericError.htm"
|
||||
mode="RemoteOnly" xdt:Transform="Replace">
|
||||
<error statusCode="500" redirect="InternalError.htm"/>
|
||||
</customErrors>
|
||||
-->
|
||||
</system.web>
|
||||
</configuration>
|
45
Web.Release.config
Normal file
45
Web.Release.config
Normal file
|
@ -0,0 +1,45 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
<!-- For more information on using Web.config transformation visit http://go.microsoft.com/fwlink/?LinkId=301874 -->
|
||||
|
||||
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
|
||||
<!--
|
||||
In the example below, the "SetAttributes" transform will change the value of
|
||||
"connectionString" to use "ReleaseSQLServer" only when the "Match" locator
|
||||
finds an attribute "name" that has a value of "MyDB".
|
||||
|
||||
<connectionStrings>
|
||||
<add name="MyDB"
|
||||
connectionString="Data Source=ReleaseSQLServer;Initial Catalog=MyReleaseDB;Integrated Security=True"
|
||||
xdt:Transform="SetAttributes" xdt:Locator="Match(name)"/>
|
||||
</connectionStrings>
|
||||
-->
|
||||
<system.web>
|
||||
<compilation xdt:Transform="RemoveAttributes(debug)" />
|
||||
<!--
|
||||
In the example below, the "Replace" transform will replace the entire
|
||||
<customErrors> section of your Web.config file.
|
||||
Note that because there is only one customErrors section under the
|
||||
<system.web> node, there is no need to use the "xdt:Locator" attribute.
|
||||
|
||||
<customErrors defaultRedirect="GenericError.htm"
|
||||
mode="RemoteOnly" xdt:Transform="Replace">
|
||||
<error statusCode="500" redirect="InternalError.htm"/>
|
||||
</customErrors>
|
||||
-->
|
||||
</system.web>
|
||||
<system.webServer>
|
||||
<rewrite xdt:Transform="Insert">
|
||||
<rules>
|
||||
<rule name="CanonicalHost" stopProcessing="true">
|
||||
<match url="(.*)" />
|
||||
<conditions logicalGrouping="MatchAny">
|
||||
<add input="{HTTP_HOST}" pattern="^buildfeed\.net$" negate="true" />
|
||||
<add input="{HTTPS}" pattern="off" />
|
||||
</conditions>
|
||||
<action type="Redirect" url="https://buildfeed.net/{R:1}" />
|
||||
</rule>
|
||||
</rules>
|
||||
</rewrite>
|
||||
</system.webServer>
|
||||
</configuration>
|
104
Web.config
Normal file
104
Web.config
Normal file
|
@ -0,0 +1,104 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
For more information on how to configure your ASP.NET application, please visit
|
||||
http://go.microsoft.com/fwlink/?LinkId=301880
|
||||
-->
|
||||
<configuration>
|
||||
<configSections>
|
||||
<sectionGroup name="elmah">
|
||||
<section name="security" requirePermission="false" type="Elmah.SecuritySectionHandler, Elmah" />
|
||||
<section name="errorLog" requirePermission="false" type="Elmah.ErrorLogSectionHandler, Elmah" />
|
||||
<section name="errorMail" requirePermission="false" type="Elmah.ErrorMailSectionHandler, Elmah" />
|
||||
<section name="errorFilter" requirePermission="false" type="Elmah.ErrorFilterSectionHandler, Elmah" />
|
||||
</sectionGroup>
|
||||
</configSections>
|
||||
<appSettings>
|
||||
<add key="webpages:Version" value="3.0.0.0" />
|
||||
<add key="webpages:Enabled" value="false" />
|
||||
<add key="PreserveLoginUrl" value="true" />
|
||||
<add key="ClientValidationEnabled" value="true" />
|
||||
<add key="UnobtrusiveJavaScriptEnabled" value="true" />
|
||||
<add key="data:ServerHost" value="localhost" />
|
||||
<add key="data:ServerPort" value="6379" />
|
||||
<add key="data:ServerDB" value="1" />
|
||||
<add key="RouteDebugger:Enabled" value="false" />
|
||||
<add key="elmah.mvc.disableHandler" value="false" />
|
||||
<add key="elmah.mvc.disableHandleErrorFilter" value="false" />
|
||||
<add key="elmah.mvc.requiresAuthentication" value="true" />
|
||||
<add key="elmah.mvc.IgnoreDefaultRoute" value="false" />
|
||||
<add key="elmah.mvc.allowedRoles" value="*" />
|
||||
<add key="elmah.mvc.allowedUsers" value="hounsell" />
|
||||
<add key="elmah.mvc.route" value="elmah" />
|
||||
</appSettings>
|
||||
<system.web>
|
||||
<compilation debug="true" targetFramework="4.5" />
|
||||
<httpRuntime targetFramework="4.5" />
|
||||
<trace enabled="false" requestLimit="40" pageOutput="true" />
|
||||
<sessionState cookieless="UseCookies" />
|
||||
<anonymousIdentification cookieless="UseCookies" enabled="false" />
|
||||
<authentication mode="Forms">
|
||||
<forms loginUrl="/support/login/" cookieless="UseCookies" name="BuildFeedAuth" />
|
||||
</authentication>
|
||||
<membership defaultProvider="BuildFeedMemberProvider">
|
||||
<providers>
|
||||
<clear />
|
||||
<add name="BuildFeedMemberProvider" type="BuildFeed.Auth.RedisMembershipProvider" />
|
||||
</providers>
|
||||
</membership>
|
||||
<httpModules>
|
||||
<add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah" />
|
||||
<add name="ErrorMail" type="Elmah.ErrorMailModule, Elmah" />
|
||||
<add name="ErrorFilter" type="Elmah.ErrorFilterModule, Elmah" />
|
||||
</httpModules>
|
||||
</system.web>
|
||||
<runtime>
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Newtonsoft.Json" culture="neutral" publicKeyToken="30ad4fe6b2a6aeed" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Web.Optimization" publicKeyToken="31bf3856ad364e35" />
|
||||
<bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="1.1.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-1.6.5135.21930" newVersion="1.6.5135.21930" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Antlr3.Runtime" publicKeyToken="eb42632606e9261f" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-3.5.0.2" newVersion="3.5.0.2" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
|
||||
<bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" />
|
||||
<bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-5.2.2.0" newVersion="5.2.2.0" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
<system.webServer>
|
||||
<handlers>
|
||||
<remove name="ExtensionlessUrlHandler-Integrated-4.0" />
|
||||
<remove name="OPTIONSVerbHandler" />
|
||||
<remove name="TRACEVerbHandler" />
|
||||
<add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="*" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
|
||||
</handlers>
|
||||
<validation validateIntegratedModeConfiguration="false" />
|
||||
<modules>
|
||||
<add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah" preCondition="managedHandler" />
|
||||
<add name="ErrorMail" type="Elmah.ErrorMailModule, Elmah" preCondition="managedHandler" />
|
||||
<add name="ErrorFilter" type="Elmah.ErrorFilterModule, Elmah" preCondition="managedHandler" />
|
||||
</modules>
|
||||
<urlCompression doDynamicCompression="true" />
|
||||
</system.webServer>
|
||||
<elmah>
|
||||
<security allowRemoteAccess="yes" />
|
||||
</elmah>
|
||||
</configuration>
|
21
browserconfig.xml
Normal file
21
browserconfig.xml
Normal file
|
@ -0,0 +1,21 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<browserconfig>
|
||||
<msapplication>
|
||||
<tile>
|
||||
<square70x70logo src="content/tile/tiny.png"/>
|
||||
<square150x150logo src="content/tile/square.png"/>
|
||||
<wide310x150logo src="content/tile/wide.png"/>
|
||||
<square310x310logo src="content/tile/large.png"/>
|
||||
<TileColor>#5bc0de</TileColor>
|
||||
</tile>
|
||||
<notification>
|
||||
<polling-uri src="http://notifications.buildmypinnedsite.com/?feed=https://buildfeed.net/rss/Added/&id=1"/>
|
||||
<polling-uri2 src="http://notifications.buildmypinnedsite.com/?feed=https://buildfeed.net/rss/Added/&id=2"/>
|
||||
<polling-uri3 src="http://notifications.buildmypinnedsite.com/?feed=https://buildfeed.net/rss/Added/&id=3"/>
|
||||
<polling-uri4 src="http://notifications.buildmypinnedsite.com/?feed=https://buildfeed.net/rss/Added/&id=4"/>
|
||||
<polling-uri5 src="http://notifications.buildmypinnedsite.com/?feed=https://buildfeed.net/rss/Added/&id=5"/>
|
||||
<frequency>30</frequency>
|
||||
<cycle>1</cycle>
|
||||
</notification>
|
||||
</msapplication>
|
||||
</browserconfig>
|
8
content/Web.config
Normal file
8
content/Web.config
Normal file
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<configuration>
|
||||
<system.webServer>
|
||||
<staticContent>
|
||||
<clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="7.00:00:00" />
|
||||
</staticContent>
|
||||
</system.webServer>
|
||||
</configuration>
|
99
content/style.css
Normal file
99
content/style.css
Normal file
|
@ -0,0 +1,99 @@
|
|||
body, h1, h2, h3 {
|
||||
font-family: 'Source Sans Pro', sans-serif;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 48px;
|
||||
font-weight: 300;
|
||||
}
|
||||
|
||||
h1 a {
|
||||
text-decoration: none;
|
||||
color: #000;
|
||||
}
|
||||
|
||||
.social-links {
|
||||
margin: 30px 0 6px;
|
||||
}
|
||||
|
||||
.social-links a {
|
||||
margin-left: 1em;
|
||||
}
|
||||
|
||||
.build-head {
|
||||
margin-bottom: 0.33em;
|
||||
}
|
||||
|
||||
.build-head h3 {
|
||||
margin: 0;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.build-head .btn {
|
||||
display: inline-block;
|
||||
margin-right: 0.66em;
|
||||
vertical-align: text-bottom;
|
||||
padding: 2px 6px;
|
||||
}
|
||||
|
||||
.build-foot {
|
||||
margin-bottom: 2em;
|
||||
}
|
||||
|
||||
.build-foot .badge {
|
||||
border-radius: 4px;
|
||||
font-weight: normal;
|
||||
color: #666 !important;
|
||||
}
|
||||
|
||||
.build-foot .badge:first-child {
|
||||
min-width: 90px;
|
||||
}
|
||||
|
||||
li:last-child .build-foot {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.fa-sm {
|
||||
font-size: 0.7em;
|
||||
vertical-align: 1px;
|
||||
margin-right: 0.12em;
|
||||
}
|
||||
|
||||
.field-validation-error {
|
||||
color: #ff4136;
|
||||
}
|
||||
|
||||
.form-details label {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.panel-heading h4 {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.pagination {
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
.pagination > li > a,
|
||||
.pagination > li > span {
|
||||
padding: 2px 7px;
|
||||
margin-left: 2px;
|
||||
}
|
||||
|
||||
#page-footer {
|
||||
margin-top: 1em;
|
||||
}
|
||||
|
||||
.form-horizontal .control-label {
|
||||
padding-top: 8px;
|
||||
}
|
||||
|
||||
label, .control-label, .help-block, .checkbox, .radio {
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.table .btn {
|
||||
padding: 4px 9px;
|
||||
}
|
BIN
content/tile/large.png
Normal file
BIN
content/tile/large.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 42 KiB |
BIN
content/tile/square.png
Normal file
BIN
content/tile/square.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 42 KiB |
BIN
content/tile/tiny.png
Normal file
BIN
content/tile/tiny.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 42 KiB |
BIN
content/tile/wide.png
Normal file
BIN
content/tile/wide.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 23 KiB |
BIN
favicon.ico
Normal file
BIN
favicon.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 157 KiB |
1
googleacffc6da14c53e15.html
Normal file
1
googleacffc6da14c53e15.html
Normal file
|
@ -0,0 +1 @@
|
|||
google-site-verification: googleacffc6da14c53e15.html
|
25
packages.config
Normal file
25
packages.config
Normal file
|
@ -0,0 +1,25 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Antlr" version="3.5.0.2" targetFramework="net45" />
|
||||
<package id="elmah.corelibrary" version="1.2.1" targetFramework="net45" />
|
||||
<package id="Elmah.MVC" version="2.1.1" targetFramework="net45" />
|
||||
<package id="jQuery" version="2.1.1" targetFramework="net45" />
|
||||
<package id="jQuery.Validation" version="1.13.0" targetFramework="net45" />
|
||||
<package id="Microsoft.AspNet.Mvc" version="5.2.2" targetFramework="net45" />
|
||||
<package id="Microsoft.AspNet.Razor" version="3.2.2" targetFramework="net45" />
|
||||
<package id="Microsoft.AspNet.Web.Optimization" version="1.1.3" targetFramework="net45" />
|
||||
<package id="Microsoft.AspNet.WebApi" version="5.2.2" targetFramework="net45" />
|
||||
<package id="Microsoft.AspNet.WebApi.Client" version="5.2.2" targetFramework="net45" />
|
||||
<package id="Microsoft.AspNet.WebApi.Core" version="5.2.2" targetFramework="net45" />
|
||||
<package id="Microsoft.AspNet.WebApi.WebHost" version="5.2.2" targetFramework="net45" />
|
||||
<package id="Microsoft.AspNet.WebPages" version="3.2.2" targetFramework="net45" />
|
||||
<package id="Microsoft.jQuery.Unobtrusive.Validation" version="3.2.2" targetFramework="net45" />
|
||||
<package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net45" />
|
||||
<package id="Newtonsoft.Json" version="6.0.5" targetFramework="net45" />
|
||||
<package id="NServiceKit.Common" version="1.0.11" targetFramework="net45" />
|
||||
<package id="NServiceKit.Redis" version="1.0.7" targetFramework="net45" />
|
||||
<package id="NServiceKit.Text" version="1.0.10" targetFramework="net45" />
|
||||
<package id="routedebugger" version="2.1.4.0" targetFramework="net45" />
|
||||
<package id="WebGrease" version="1.6.0" targetFramework="net45" />
|
||||
<package id="xwebrss" version="1.2.1.130" targetFramework="net45" />
|
||||
</packages>
|
Loading…
Reference in New Issue
Block a user