<commit_before>crypto = require 'crypto'
_ = require 'underscore'
mongoose = require 'mongoose'
env = require '../config/env'
ROLES = [ 'nomination', 'contestant', 'judge', 'voter' ]
request = require('request')
util = require('util')

# auth decoration
PersonSchema = module.exports = new mongoose.Schema
  name: String
  email: String
  imageURL: String
  location: String
  company: String
  hiring: String
  twitterScreenName: String
  linkedinPath: String
  title: String
  bio: String
  admin: Boolean
  role: { type: String, enum: ROLES }
  technical: Boolean
  featured: Boolean
  slug:
    type: String
    index: true
  skippedTeamIds: [ mongoose.Schema.ObjectId ]
PersonSchema.plugin require('../lib/use-timestamps')

auth = require 'mongoose-auth'
PersonSchema.plugin auth,
  everymodule:
    everyauth:
      moduleTimeout: 30000
      findUserById: (userId, fn) -> Person.findById(userId, fn)
      handleLogout: (req, res) ->
        req.logout()
        res.redirect(req.param('returnTo') || req.header('referrer') || '/')
  github:
    everyauth:
      scope: 'user'
      redirectPath: '/login/done'<commit_msg>Contestant login should only require public github username and email.<commit_after>crypto = require 'crypto'
_ = require 'underscore'
mongoose = require 'mongoose'
env = require '../config/env'
ROLES = [ 'nomination', 'contestant', 'judge', 'voter' ]
request = require('request')
util = require('util')

# auth decoration
PersonSchema = module.exports = new mongoose.Schema
  name: String
  email: String
  imageURL: String
  location: String
  company: String
  hiring: String
  twitterScreenName: String
  linkedinPath: String
  title: String
  bio: String
  admin: Boolean
  role: { type: String, enum: ROLES }
  technical: Boolean
  featured: Boolean
  slug:
    type: String
    index: true
  skippedTeamIds: [ mongoose.Schema.ObjectId ]
PersonSchema.plugin require('../lib/use-timestamps')

auth = require 'mongoose-auth'
PersonSchema.plugin auth,
  everymodule:
    everyauth:
      moduleTimeout: 30000
      findUserById: (userId, fn) -> Person.findById(userId, fn)
      handleLogout: (req, res) ->
        req.logout()
        res.redirect(req.param('returnTo') || req.header('referrer') || '/')
  github:
    everyauth:
      scope: 'user:email'
      redirectPath: '/login/done'
{'fraction_non_alphanumeric': 0.12408444635932787, 'fraction_numerical': 0.004308487720809996, 'mean_word_length': 3.7291242362525456, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1508185', 'n_tokens_mistral': 733, 'n_tokens_neox': 737, 'n_words': 192}