This file contains hidden or 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('express').Router(); | |
| const { WebClient } = require('@slack/client'); | |
| const { | |
| SLACK_CLIENT_ID, | |
| SLACK_CLIENT_SECRET, | |
| SLACK_AUTHORIZE_URL | |
| } = require('@codedojo/core/config'); | |
| const { logger } = require('@codedojo/core/services'); | |
| const { User } = require('@codedojo/core/models'); |
This file contains hidden or 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 crypto = require('crypto'); | |
| const request = require('request'); | |
| const jwt = require('jsonwebtoken'); | |
| const ZOOM_API_URL = 'https://api.zoom.us/v2/'; | |
| function getToken(key, secret) { | |
| return jwt.sign({ | |
| iss: key, | |
| exp: Math.floor(Date.now() / 1000) + 60 |
This file contains hidden or 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 request = require('request'); | |
| module.exports = { | |
| verify(response) { | |
| return new Promise((resolve, reject) => { | |
| request({ | |
| uri: 'https://www.google.com/recaptcha/api/siteverify', | |
| method: 'POST', | |
| form: { | |
| secret: '6Lf22BgTAAAAACnRULGoRP6Di_PU3vLjWTubsiTT', |
This file contains hidden or 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 request = require('request'); | |
| module.exports = (MAILGUN_API_KEY, MAILGUN_API_URL) => ({ | |
| send({ from, to, subject, text, html, template, variables }) { | |
| return new Promise((resolve, reject) => { | |
| request.post(`${MAILGUN_API_URL}/messages`, { | |
| auth: { | |
| user: 'api', | |
| pass: MAILGUN_API_KEY | |
| }, |
This file contains hidden or 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
| 'use strict'; | |
| const request = require('request'); | |
| module.exports = { | |
| inviteToTeam({ user, channels, token }) { | |
| const body = { | |
| email: user.email, | |
| first_name: user.firstname, | |
| last_name: user.lastname, |
This file contains hidden or 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 fs = require('fs'); | |
| const https = require('https'); | |
| const ssl = { | |
| key: fs.readFileSync(__dirname + '/ssl/certificate.pem'), | |
| cert: fs.readFileSync(__dirname + '/ssl/certificate.crt') | |
| }; | |
| https.createServer(ssl, server).listen(server.get('port'), () => { | |
| console.log('Express server listening on port ' + server.get('port')); |
This file contains hidden or 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 { Route, Redirect } from 'react-router-dom'; | |
| export default function GuestRoute({ user, component: Component, ...props }) { | |
| return ( | |
| <Route {...props} render={props => | |
| user ? | |
| <Redirect to="/" /> | |
| : | |
| <Component {...props} /> |
This file contains hidden or 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 default class TextField { | |
| static DEFAULT_VALUES = { | |
| element: undefined, | |
| type: 'text', | |
| placeholder: '', | |
| required: false, | |
| onChange: Function.prototype, | |
| onInput: Function.prototype | |
| } | |
This file contains hidden or 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 testRunner = { | |
| tests: [], | |
| test(description, fn) { | |
| this.tests.push({ | |
| description, | |
| fn | |
| }); | |
| }, |
This file contains hidden or 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 form = document.querySelector('form'); | |
| const input = form.querySelector('input[type="search]"'); | |
| const cache = {}; | |
| form.addEventListener('submit', event => { | |
| event.preventDefault(); | |
| const query = input.value; |