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
class Auth { | |
/** | |
* Authenticate a user. Save a token string in Local Storage | |
* | |
* @param {string} token | |
*/ | |
/* eslint-disable no-undef */ | |
static authenticateUser (token) { | |
localStorage.setItem('token', token) | |
} |
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, { Component } from 'react' | |
import PropTypes from 'prop-types' | |
import Auth from '../../modules/auth' | |
class Session extends Component { | |
componentWillMount () { | |
const token = this.props.match.params.token | |
const referer = Auth.getReferer() | |
Auth.authenticateUser(token) |
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 express = require('express') | |
const router = express.Router() | |
const passport = require('passport') | |
const authenticationHelpers = require('../../authenticationHelpers') | |
require('../../../loading/loading') | |
const secure = require('./secure') | |
router.get('/authenticated', authenticationHelpers.isAuth) | |
router.get('/authorize/github', passport.authenticate('github', { scope: ['user:email'], accessType: 'offline' })) |
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
/** | |
* Authentication helpers to determine if a user is logged in or not | |
* before a route returns information to the response | |
*/ | |
const userExist = require('../modules/users').userExists | |
const jwt = require('jsonwebtoken') | |
function isAuthOrRedirect (req, res, next) { | |
if (req.isAuthenticated()) return next() |
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 { | |
github | |
} = require('./secrets') | |
const passport = require('passport') | |
const gitHubStrategy = require('passport-github2').Strategy | |
const LocalStrategy = require('passport-local').Strategy | |
const passportJWT = require('passport-jwt') | |
const ExtractJWT = passportJWT.ExtractJwt | |
const JWTStrategy = passportJWT.Strategy | |
const jwt = require('jsonwebtoken') |
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
git archive --format zip --output /full/path/to/zipfile.zip master |
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 express = require('express') | |
const app = express() | |
const cors = require('cors') | |
const bodyParser = require('body-parser') | |
const Notify = require('./mail') | |
if (process.env.NODE_ENV !== 'production') { | |
require('dotenv').config() | |
app.use(cors()) | |
} |
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 network | |
from machine import ADC | |
from machine import Timer | |
import urequests | |
import os | |
secret = os.environ['SECRET'] | |
def send_sensor_values(): | |
adc = ADC(0) |
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
<div className={ classes.chipContainer }> | |
<Chip | |
label=' daqui uma semana ' | |
className={ classes.chip } | |
onClick={ () => this.pickTaskDeadline(7) } | |
/> | |
<Chip | |
label=' daqui quinze dias ' | |
className={ classes.chip } | |
onClick={ () => this.pickTaskDeadline(15) } |
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 { CheckoutFormPure } from '../../src/components/checkout/checkout-form' | |
import { mount, configure } from 'enzyme' | |
import Adapter from 'enzyme-adapter-react-15' | |
configure({ adapter: new Adapter() }) | |
describe('components', () => { | |
describe('checkout component', () => { | |
it('should start a new checkout form with empty state', () => { |