Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chess notation #5

Merged
merged 160 commits into from
May 26, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
160 commits
Select commit Hold shift + click to select a range
19e8fc3
Merge pull request #38 from marekrydlewski/chessboard
marekrydlewski Apr 21, 2016
4beacde
Menu fix
mpanowicz Apr 22, 2016
0eb09fd
Initial database schema project
marcin-jablonski Apr 24, 2016
d654062
Merge pull request #39 from mpanowicz/master
marcin-jablonski Apr 24, 2016
6f26f6c
Removed favicon warning
marcin-jablonski Apr 24, 2016
ed3df9f
Merge pull request #41 from marcin-jablonski/favicon-warning
marcin-jablonski Apr 24, 2016
16f7e2f
Starting refactor
marekrydlewski Apr 24, 2016
7d7fe30
Refactor like a boss
marekrydlewski Apr 24, 2016
cf0faee
Taking pgn as prop
marekrydlewski Apr 24, 2016
b3c0736
Merge branch 'master' of https://github.com/marcin-jablonski/rabin-ch…
marekrydlewski Apr 24, 2016
293e0dd
Update gitignore
marekrydlewski Apr 24, 2016
eddce80
Remove webstorm
marekrydlewski Apr 24, 2016
9f5475d
Merge branch 'master' of https://github.com/marcin-jablonski/rabin-ch…
marcin-jablonski Apr 25, 2016
7215753
Expanded user entity
marcin-jablonski Apr 25, 2016
914afa7
Fix docs
marekrydlewski Apr 25, 2016
6ea355c
Update SmartChessboard.jsx
marekrydlewski Apr 26, 2016
2c81894
Merge pull request #42 from marekrydlewski/chessboard-pgn
marekrydlewski Apr 26, 2016
7c3c7f9
Merge pull request #40 from marcin-jablonski/database-project
marcin-jablonski Apr 26, 2016
cfa19d8
Database setup
marcin-jablonski Apr 26, 2016
ee01c7a
slider added to dashboard
kmatusiak Apr 26, 2016
54620ca
react-slick added to dependencies
kmatusiak Apr 26, 2016
17e9d31
react-slick added to dependencies
kmatusiak Apr 26, 2016
cf551b0
Fixed, slider shows only on dashboard page
kmatusiak Apr 27, 2016
747b15b
adding dashboard files to repo
kmatusiak Apr 27, 2016
2bd7f6e
fixed intends
kmatusiak Apr 27, 2016
1177153
fixed intends - 4 spacebars instead of tab...
kmatusiak Apr 27, 2016
80ac404
Added dashboard to menu
kmatusiak Apr 27, 2016
c9196f0
Names magic
marcin-jablonski Apr 27, 2016
799ca94
Fixed
marcin-jablonski Apr 27, 2016
5c28aff
Merge pull request #46 from marcin-jablonski/B/smart-not-found
marcin-jablonski Apr 27, 2016
d9b4bf0
more fix
marcin-jablonski Apr 27, 2016
d9b7a65
Merge pull request #47 from marcin-jablonski/B/smart-not-found
marcin-jablonski Apr 27, 2016
2a7c3d8
fixed indents
kmatusiak Apr 27, 2016
a3ced60
Pictures added to assets
kmatusiak Apr 27, 2016
3d3c0cc
Slider set to 40% window size
kmatusiak Apr 27, 2016
e816533
Slider set to 40% window size-fix1
kmatusiak Apr 27, 2016
137cb94
Login card
mpanowicz Apr 22, 2016
429ffd0
Login\signup style
mpanowicz Apr 22, 2016
744e7b0
Add login card to homepage
mpanowicz Apr 22, 2016
b1b7143
Display signup component
mpanowicz Apr 23, 2016
ac2cd98
Add label font size
mpanowicz Apr 23, 2016
79b57ba
Add icons
mpanowicz Apr 23, 2016
5d17942
Sign up card
mpanowicz Apr 23, 2016
2cfe34a
Change components to CardMedia
mpanowicz Apr 27, 2016
5835fae
Setup input and tab style
mpanowicz Apr 27, 2016
fecc066
Add Login and Signup to tabs
mpanowicz Apr 27, 2016
b40298f
Delete unused imports
mpanowicz Apr 27, 2016
3197b77
Delete unnecessary classes
mpanowicz Apr 27, 2016
54674c4
Move login/signup to appbar
mpanowicz Apr 27, 2016
cb49c1e
Add Login\Signup dialogs
mpanowicz Apr 27, 2016
aabad01
Merge pull request #43 from marcin-jablonski/database-setup
marcin-jablonski Apr 28, 2016
639a885
link moved from dashboard.jsx to index.html
kmatusiak Apr 28, 2016
975739d
Merge pull request #45 from kmatusiak/master
kmatusiak Apr 28, 2016
bae69c1
Update and rename LoginForm.jsx to LoginSignupForm.jsx
mpanowicz Apr 28, 2016
705bf19
Some fixes
mpanowicz Apr 28, 2016
62d1e2b
Add docs
mpanowicz Apr 28, 2016
3d3afba
Merge pull request #48 from mpanowicz/login-signup
mpanowicz Apr 29, 2016
0625545
Merge branch 'master' of https://github.com/marcin-jablonski/rabin-ch…
marekrydlewski Apr 29, 2016
43b18f8
Seed ui skeleton && fixes
marekrydlewski Apr 29, 2016
d705a06
A lot of stuff with ui
marekrydlewski Apr 29, 2016
8024f4f
Ultra ui stuff
marekrydlewski Apr 29, 2016
86fcb9c
Fixes
marekrydlewski Apr 29, 2016
809df0a
More fix
marekrydlewski Apr 29, 2016
233c19a
Reformat imports
marekrydlewski Apr 29, 2016
37ebcb0
Fix scroll bug
marekrydlewski Apr 29, 2016
a15ea82
Proper imports
marekrydlewski Apr 29, 2016
29794a8
Clean colors
marekrydlewski Apr 29, 2016
4082ba5
Fixes....
marekrydlewski Apr 29, 2016
e3b5ec4
FIXES FIXES
marekrydlewski Apr 29, 2016
30565df
More fixes...
marekrydlewski Apr 29, 2016
9f81023
Merge pull request #49 from marekrydlewski/chess-notation
marekrydlewski Apr 30, 2016
59bee30
First try on game list item
marcin-jablonski Apr 30, 2016
eff7381
Replaced docs with test page for testing components
marcin-jablonski Apr 30, 2016
ad19b61
Added list item avatar
marcin-jablonski Apr 30, 2016
86a42e2
Game list added
marcin-jablonski Apr 30, 2016
4f4381c
added smart component for api interaction
marcin-jablonski Apr 30, 2016
b3e2ceb
added layout component and routing
marcin-jablonski Apr 30, 2016
d6a4e7d
added buttons
marcin-jablonski Apr 30, 2016
6d1e239
Wrapped in card
marcin-jablonski May 1, 2016
1f2b2f6
Grid magic
marcin-jablonski May 3, 2016
2196f8d
Changed button colors
marcin-jablonski May 3, 2016
8fd4b22
Enlarged car title
marcin-jablonski May 3, 2016
a2a8b61
Added Name field to games
marcin-jablonski May 3, 2016
dd0d7bb
Added DataStructures project with game list item view model
marcin-jablonski May 3, 2016
c2978ec
Added game retriever
marcin-jablonski May 3, 2016
c4386b6
Sample factory pattern (may need other solution)
marcin-jablonski May 3, 2016
e8e8ef8
Api controller
marcin-jablonski May 3, 2016
a7ef9b2
Package fix
marcin-jablonski May 3, 2016
d3ef2a0
Organize logic project
marcin-jablonski May 3, 2016
f3607f1
controller cleanup
marcin-jablonski May 3, 2016
715ddce
Login first steps
marcin-jablonski May 3, 2016
0965757
Merge
marcin-jablonski May 3, 2016
54a9fae
Added user manager
marcin-jablonski May 3, 2016
89d046b
Added api authentication
marcin-jablonski May 3, 2016
7a17379
Fix
marcin-jablonski May 3, 2016
1d85b06
fixes
marcin-jablonski May 4, 2016
a00c365
Merge pull request #51 from marcin-jablonski/games-list-layout
marcin-jablonski May 5, 2016
cc126b5
Merge pull request #52 from marcin-jablonski/game-list-backend
marcin-jablonski May 5, 2016
3d4b0a9
Merge pull request #53 from marcin-jablonski/login-backend
marcin-jablonski May 5, 2016
5e69c62
Some try with undo
marekrydlewski May 7, 2016
f3dc128
Merge branch 'master' of https://github.com/marcin-jablonski/rabin-ch…
marekrydlewski May 7, 2016
1e3383f
Add move componentn && fixes
marekrydlewski May 7, 2016
619f8f5
Add full move component
marekrydlewski May 7, 2016
4fc1152
Add move with number comp
marekrydlewski May 7, 2016
eb72e89
Fix imports
marekrydlewski May 7, 2016
92dce1c
Add notation comp
marekrydlewski May 7, 2016
d8c1267
Change props
marekrydlewski May 7, 2016
c773e79
Small fixes
marekrydlewski May 7, 2016
9ba4f73
Get games of current user
marcin-jablonski May 9, 2016
633b97c
Account controller added
marcin-jablonski May 9, 2016
7a29978
csproj
marcin-jablonski May 9, 2016
80970af
Rearrange number of move
marekrydlewski May 9, 2016
24a570e
Some fixes
marekrydlewski May 9, 2016
77d096d
Merge pull request #54 from marekrydlewski/chess-notation
marekrydlewski May 9, 2016
dcc30fc
Hohohoe
marekrydlewski May 9, 2016
f8a4a8d
Remove console logs
marekrydlewski May 9, 2016
24ddf7c
Merge pull request #56 from marcin-jablonski/game-list-backend
marcin-jablonski May 11, 2016
749549a
Merge pull request #57 from marcin-jablonski/login-backend
marcin-jablonski May 11, 2016
c181072
Fix layout
marekrydlewski May 14, 2016
eab0b9f
Change colors of card
marekrydlewski May 14, 2016
fe25147
Fix
marekrydlewski May 14, 2016
0c13b34
Turbo design
marekrydlewski May 14, 2016
a807989
Add react thunk
marekrydlewski May 15, 2016
98aef8f
Merge branch 'master' of https://github.com/marcin-jablonski/rabin-ch…
marekrydlewski May 15, 2016
d925dba
Add fetch
marekrydlewski May 15, 2016
88e3431
Fix footer...
marekrydlewski May 15, 2016
4a58ed1
Fix creating store
marekrydlewski May 15, 2016
45d8ebc
Merge pull request #58 from marekrydlewski/chess-notation
marekrydlewski May 16, 2016
262697f
Merge pull request #59 from marekrydlewski/thunk
marekrydlewski May 16, 2016
630caf1
Merge pull request #60 from marekrydlewski/footer
marekrydlewski May 16, 2016
52a3ec5
Installed packages & sample test
marcin-jablonski May 16, 2016
0fdb6fd
Fixes and architecture change for easier mocking/testing
marcin-jablonski May 17, 2016
a29bc01
Merge pull request #61 from marcin-jablonski/fixes-and-architecture-c…
marcin-jablonski May 17, 2016
5b1de21
Merge branch 'fixes-and-architecture-changes' into game-list-tests
marcin-jablonski May 17, 2016
9ae234d
Better sample test
marcin-jablonski May 17, 2016
b4a1ad1
Hotfix1
marcin-jablonski May 17, 2016
2681ff7
Merge pull request #62 from marcin-jablonski/hotfixes
marcin-jablonski May 17, 2016
ff47c0d
Merge branch 'master' into game-list-tests
marcin-jablonski May 17, 2016
64f1ac5
added migrations, not working user add ?
marcin-jablonski May 17, 2016
2417d62
USer manager tests
marcin-jablonski May 17, 2016
de88d24
More game retriever methods
marcin-jablonski May 17, 2016
bd28750
Merge branch 'new-retrievers' into game-list-tests
marcin-jablonski May 17, 2016
cc8210c
New methods tests
marcin-jablonski May 17, 2016
ee5de5c
Add custom button
mpanowicz May 17, 2016
fd80b5d
Delete actions. Add onClick method to rendered components
mpanowicz May 17, 2016
c7354dd
Add foramting for icon, label when input focused
mpanowicz May 17, 2016
d484a9f
Docs everywhere
mpanowicz May 17, 2016
7d69583
Buttons too small
mpanowicz May 17, 2016
988d082
Change to custom button for undo
mpanowicz May 18, 2016
3ac1a47
More tests
marcin-jablonski May 18, 2016
bcfeff6
20 test methods :v
marcin-jablonski May 18, 2016
cc0314a
Merge pull request #66 from mpanowicz/docs
marcin-jablonski May 18, 2016
e3d6bd2
Merge pull request #65 from mpanowicz/login-signup
marekrydlewski May 18, 2016
d6a3c64
Merge pull request #63 from marcin-jablonski/game-list-tests
marekrydlewski May 18, 2016
11e0ae3
Working on next button
marekrydlewski May 26, 2016
7ed8e97
WOWOWOWOW U CAN BROWSE NEXT MOVES NOW
marekrydlewski May 26, 2016
3611055
Some styling
marekrydlewski May 26, 2016
9f09ce4
More styling
marekrydlewski May 26, 2016
2f9aa4f
Remove console logs
marekrydlewski May 26, 2016
964f89b
Switch to english
marekrydlewski May 26, 2016
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions RabinChess.Server/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -210,3 +210,9 @@ FakesAssemblies/
GeneratedArtifacts/
_Pvt_Extensions/
ModelManifest.xml

# Config files
**/connectionStrings.config

# Publish profiles
RabinChess.Server.API/Properties/PublishProfiles/
51 changes: 51 additions & 0 deletions RabinChess.Server/RabinChess.Server.API/App_Start/Startup.Auth.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
using System;
using Microsoft.AspNet.Identity;
using Microsoft.Owin;
using Microsoft.Owin.Cors;
using Microsoft.Owin.Security.Cookies;
using Microsoft.Owin.Security.OAuth;
using Owin;
using RabinChess.Server.API.Models;
using RabinChess.Server.API.Providers;
using RabinChess.Server.API.Stores;

namespace RabinChess.Server.API
{
public partial class Startup
{
public static OAuthAuthorizationServerOptions OAuthOptions { get; private set; }

public static string PublicClientId { get; private set; }

public static Func<UserManager<UserModel, int>> UserManagerFactory { get; private set; }

static Startup()
{
PublicClientId = "self";

UserManagerFactory =
() => new UserManager<UserModel, int>(new UserStore()) {PasswordHasher = new Security.PasswordHasher()};

OAuthOptions = new OAuthAuthorizationServerOptions
{
TokenEndpointPath = new PathString("/api/token"),
Provider = new ApplicationOAuthProvider(PublicClientId, UserManagerFactory),
AccessTokenExpireTimeSpan = TimeSpan.FromDays(14),
AllowInsecureHttp = true
};
}

// For more information on configuring authentication, please visit http://go.microsoft.com/fwlink/?LinkId=301864
public void ConfigureAuth(IAppBuilder app)
{
app.UseCors(CorsOptions.AllowAll);
// Enable the application to use a cookie to store information for the signed in user
// and to use a cookie to temporarily store information about a user logging in with a third party login provider
app.UseCookieAuthentication(new CookieAuthenticationOptions());
app.UseExternalSignInCookie(DefaultAuthenticationTypes.ExternalCookie);

// Enable the application to use bearer tokens to authenticate users
app.UseOAuthBearerTokens(OAuthOptions);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
using System.Net.Http;
using System.Web.Http;
using Microsoft.AspNet.Identity;
using Microsoft.Owin.Security;
using Microsoft.Owin.Security.Cookies;
using RabinChess.Server.API.Models;

namespace RabinChess.Server.API.Controllers
{
[RoutePrefix("api/Account")]
public class AccountController : ApiController
{
public UserManager<UserModel, int> UserManager { get; private set; }
public ISecureDataFormat<AuthenticationTicket> AccessTokenFormat { get; private set; }

public AccountController() : this(Startup.UserManagerFactory(), Startup.OAuthOptions.AccessTokenFormat)
{
}

public AccountController(UserManager<UserModel, int> userManager,
ISecureDataFormat<AuthenticationTicket> accessTokenFormat)
{
UserManager = userManager;
AccessTokenFormat = accessTokenFormat;
}

[HttpPost]
[Route("Logout")]
public IHttpActionResult Logout()
{
Authentication.SignOut(CookieAuthenticationDefaults.AuthenticationType);
return Ok();
}

protected override void Dispose(bool disposing)
{
if (disposing)
{
UserManager.Dispose();
}

base.Dispose(disposing);
}

private IAuthenticationManager Authentication
{
get { return Request.GetOwinContext().Authentication; }
}

private IHttpActionResult GetErrorResult(IdentityResult result)
{
if (result == null)
{
return InternalServerError();
}

if (!result.Succeeded)
{
if (result.Errors != null)
{
foreach (string error in result.Errors)
{
ModelState.AddModelError("", error);
}
}

if (ModelState.IsValid)
{
// No ModelState errors are available to send, so just return an empty BadRequest.
return BadRequest();
}

return BadRequest(ModelState);
}

return null;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using System.Collections.Generic;
using System.Linq;
using System.Web.Http;
using Microsoft.AspNet.Identity;
using RabinChess.Server.API.Models;
using RubinChess.Server.Logic;

namespace RabinChess.Server.API.Controllers
{
[Route("api/Games")]
public class GamesController : ApiController
{
[Route("api/Games")]
[HttpGet]
public List<GameListItemViewModel> Get()
{
return ContextFactory.GetGamesContext().GetGames(User.Identity.GetUserId<int>()).Select(x => (GameListItemViewModel) x).ToList();
}
}
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
using System;
using System.Collections.Generic;
using RabinChess.Server.DataStructures;

namespace RabinChess.Server.API.Models
{
public class GameListItemViewModel
{
public string Name { get; set; }
public string Tags { get; set; }
public Guid Id { get; set; }

public static explicit operator GameListItemViewModel(GameListItemVM model)
{
return new GameListItemViewModel
{
Id = model.Id,
Name = model.Name,
Tags = model.Tags
};
}
}
}
41 changes: 41 additions & 0 deletions RabinChess.Server/RabinChess.Server.API/Models/UserModel.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
using Microsoft.AspNet.Identity;
using RubinChess.Server.Database.Entities;

namespace RabinChess.Server.API.Models
{
public class UserModel : IUser<int>
{
public int Id { get; private set; }
public string UserName { get; set; }
public string PasswordHash { get; set; }
public string Email { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }

public static explicit operator UserModel(User user)
{
return new UserModel
{
Email = user.Email,
FirstName = user.FirstName,
LastName = user.LastName,
Id = user.Id,
PasswordHash = user.PasswordHash,
UserName = user.UserName
};
}

public static explicit operator User(UserModel user)
{
return new User
{
Email = user.Email,
FirstName = user.FirstName,
LastName = user.LastName,
Id = user.Id,
PasswordHash = user.PasswordHash,
UserName = user.UserName
};
}
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using Microsoft.Owin;

// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
Expand Down Expand Up @@ -33,3 +34,6 @@
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

// Additional assemblies
[assembly: OwinStartup(typeof(RabinChess.Server.API.Startup))]
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
using System;
using System.Collections.Generic;
using System.Security.Claims;
using System.Threading.Tasks;
using Microsoft.AspNet.Identity;
using Microsoft.Owin.Security;
using Microsoft.Owin.Security.Cookies;
using Microsoft.Owin.Security.OAuth;
using RabinChess.Server.API.Models;

namespace RabinChess.Server.API.Providers
{
public class ApplicationOAuthProvider : OAuthAuthorizationServerProvider
{
private readonly string _publicClientId;
private readonly Func<UserManager<UserModel, int>> _userManagerFactory;

public ApplicationOAuthProvider(string publicClientId, Func<UserManager<UserModel, int>> userManagerFactory)
{
if (publicClientId == null)
{
throw new ArgumentNullException("publicClientId");
}

if (userManagerFactory == null)
{
throw new ArgumentNullException("userManagerFactory");
}

_publicClientId = publicClientId;
_userManagerFactory = userManagerFactory;
}

public override async Task GrantResourceOwnerCredentials(OAuthGrantResourceOwnerCredentialsContext context)
{
using (UserManager<UserModel, int> userManager = _userManagerFactory())
{
UserModel user = await userManager.FindAsync(context.UserName, context.Password);

if (user == null)
{
context.SetError("invalid_grant", "The user name or password is incorrect.");
return;
}

ClaimsIdentity oAuthIdentity = await userManager.CreateIdentityAsync(user,
context.Options.AuthenticationType);
ClaimsIdentity cookiesIdentity = await userManager.CreateIdentityAsync(user,
CookieAuthenticationDefaults.AuthenticationType);
AuthenticationProperties properties = CreateProperties(user.UserName);
AuthenticationTicket ticket = new AuthenticationTicket(oAuthIdentity, properties);
context.Validated(ticket);
context.Request.Context.Authentication.SignIn(cookiesIdentity);
}
}

public override Task TokenEndpoint(OAuthTokenEndpointContext context)
{
foreach (KeyValuePair<string, string> property in context.Properties.Dictionary)
{
context.AdditionalResponseParameters.Add(property.Key, property.Value);
}

return Task.FromResult<object>(null);
}

public override Task ValidateClientAuthentication(OAuthValidateClientAuthenticationContext context)
{
// Resource owner password credentials does not provide a client ID.
if (context.ClientId == null)
{
context.Validated();
}

return Task.FromResult<object>(null);
}

public override Task ValidateClientRedirectUri(OAuthValidateClientRedirectUriContext context)
{
if (context.ClientId == _publicClientId)
{
Uri expectedRootUri = new Uri(context.Request.Uri, "/");

if (expectedRootUri.AbsoluteUri == context.RedirectUri)
{
context.Validated();
}
}

return Task.FromResult<object>(null);
}

public static AuthenticationProperties CreateProperties(string userName)
{
IDictionary<string, string> data = new Dictionary<string, string>
{
{ "userName", userName }
};
return new AuthenticationProperties(data);
}
}
}
Loading