This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const projectSchema = mongoose.Schema({ | |
title: { | |
type: String, | |
required: true | |
}, | |
description: { | |
type: String, | |
required: false | |
}, | |
projectLevel: { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import propTypes from 'prop-types'; | |
import { connect } from 'react-redux'; | |
import { bindActionCreators } from 'redux'; | |
import loginTab from '../../util/openWindow'; | |
import * as userActions from '../redux/userActions'; | |
import { STATE_KEY as USER_STATE_KEY } from '../redux/userReducer'; | |
class AppMenu extends React.Component { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// From https://gist.github.com/gauravtiwari/2ae9f44aee281c759fe5a66d5c2721a2 | |
// By https://gist.github.com/gauravtiwari | |
/* global window */ | |
const loginTab = (myUrl) => { | |
const windowArea = { | |
width: Math.floor(window.outerWidth * 0.8), | |
height: Math.floor(window.outerHeight * 0.5), | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// http://scottksmith.com/blog/2014/09/18/beer-locker-building-a-restful-api-with-node-username-and-password/ | |
const passport = require('koa-passport'); | |
const GitHubStrategy = require('passport-github2').Strategy; | |
const MockStrategy = require('./mock-strategy').Strategy; | |
const User = require('../backend/entities/users/userModel'); | |
function onSuccess(accessToken, refreshToken, profile, done) { | |
// https://stackoverflow.com/questions/20431049/what-is-function-user-findorcreate-doing-and-when-is-it-called-in-passport | |
User.findOrCreate( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html lang="en"> | |
<head> | |
<title>Login successful</title> | |
</head> | |
<body> | |
<h1>Success</h1> | |
<p>You are authenticated...</p> | |
</body> | |
<script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const Router = require('koa-router'); | |
const passport = require('koa-passport'); | |
const isAuthenticated = (ctx, next) => { | |
return ctx.isAuthenticated() ? next() : ctx.status = 403; | |
}; | |
const router = new Router(); | |
router.get('/auth/github', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const mongoose = require('mongoose'); | |
const findOrCreate = require('mongoose-findorcreate'); | |
const userSchema = mongoose.Schema({ | |
username: { | |
type: String, | |
required: true | |
}, | |
email: { | |
type: String, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const INJECT = 'INJECT_USER'; | |
export const LOGOUT = 'LOGOUT_USER'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const config = require('../../config/envs'); | |
import React from 'react'; | |
import propTypes from 'prop-types'; | |
import { connect } from 'react-redux'; | |
import { bindActionCreators } from 'redux'; | |
import { | |
Input, | |
Menu, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const skillSchema = mongoose.Schema( | |
{ | |
// This can reference another collection, but for our purposes a string is likely acceptable | |
domain: { | |
type: String, | |
trim: true, | |
required: true | |
}, | |
name: { | |
type: String, |