<commit_before>'use strict';

// config/passport.js

// load all the things we need
var LocalStrategy = require('passport-local').Strategy;
// dropBox 
var DropboxOAuth2Strategy = require('passport-dropbox-oauth2').Strategy;

var DROPBOX_CLIENT_ID = 'b4zge4qvkzp1y7l';
var DROPBOX_CLIENT_SECRET = '<KEY>';

// load up the user model
var User = require('../../models/User');

// expose this function to our app using module.exports

module.exports = function(passport) {

    passport.serializeUser(function(user, done) {
        done(null, user.id);
    });

    // used to deserialize the user
    passport.deserializeUser(function(id, done) {
        User.findById(id, function(err, user) {
            done(err, user);
        });
    });

    passport.use(new DropboxOAuth2Strategy({
            clientID: DROPBOX_CLIENT_ID,
            clientSecret: DROPBOX_CLIENT_SECRET,
            callbackURL: 'http://localhost:3000/auth/dropbox/callback',
            passReqToCallback: true
        },
        function(req, accessToken, refreshToken, profile, done) {
            // User.findOrCreate({
            //     providerId: profile.id
            // }, function(err, user) {
            //     return done(err, user);
            // });
            // User.findOne({
            //     'dropbox.uid': profile._json.uid
            // }, function(err, user) {
            //     // if there are any errors, return the error
            //     if (err)
            //         return done(err);

            //     // check to see if theres already a user with that email
            //     if (user) {
            //         console.log('user already exists');
            //         //var newUser = new User();
            //         return done(404, null);
            //         // return done(null, false, req.flash('signupMessage', 'That email is already taken.'));<commit_msg>externalisation de l'url du callback de dropbox<commit_after>'use strict';

// config/passport.js

// load all the things we need
var LocalStrategy = require('passport-local').Strategy;
// dropBox 
var DropboxOAuth2Strategy = require('passport-dropbox-oauth2').Strategy;

var config = require('./../../env/config.json');
var URL_REQUEST = process.env.URL_REQUEST || config.URL_REQUEST;

var DROPBOX_CLIENT_ID = 'b4zge4qvkzp1y7l';
var DROPBOX_CLIENT_SECRET = '8n7goc4bxqy2190';

// load up the user model
var User = require('../../models/User');

// expose this function to our app using module.exports

module.exports = function(passport) {

    passport.serializeUser(function(user, done) {
        done(null, user.id);
    });

    // used to deserialize the user
    passport.deserializeUser(function(id, done) {
        User.findById(id, function(err, user) {
            done(err, user);
        });
    });

    passport.use(new DropboxOAuth2Strategy({
            clientID: DROPBOX_CLIENT_ID,
            clientSecret: DROPBOX_CLIENT_SECRET,
            callbackURL: URL_REQUEST + '/auth/dropbox/callback',
            passReqToCallback: true
        },
        function(req, accessToken, refreshToken, profile, done) {
            // User.findOrCreate({
            //     providerId: profile.id
            // }, function(err, user) {
            //     return done(err, user);
            // });
            // User.findOne({
            //     'dropbox.uid': profile._json.uid
            // }, function(err, user) {
            //     // if there are any errors, return the error
            //     if (err)
            //         return done(err);

            //     // check to see if theres already a user with that email
            //     if (user) {
            //         console.log('user already exists');
            //         //var newUser = new User();
            //         return done(404, null);
            //         // return done(null, false, req.flash('signupMessage', 'That email is already taken.'));
{'fraction_non_alphanumeric': 0.12927078021417643, 'fraction_numerical': 0.00790413054563998, 'mean_word_length': 1.8572469045884923, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, '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': '4003950', 'n_tokens_mistral': 1127, 'n_tokens_neox': 1116, 'n_words': 269}