<commit_before><?php
/**
 * Created by PhpStorm.
 * User: harrisonchow
 * Date: 6/23/16
 * Time: 8:39 PM
 */

// NOTE: THIS PAGE IS NOT TO BE CALLED DIRECTLY
use Parse\ParseClient;
use Parse\ParseObject;
use Parse\ParseException;
use Parse\ParseUser;
use Parse\ParseSessionStorage;

ParseClient::initialize($ParseAppID, '', $ParseMasterKey);
ParseClient::setServerURL($ParseServer);
ParseClient::setStorage( new ParseSessionStorage() );

// Login only works after authorized with windows-ad
if (!isset($windowsUser)) {
    header('Location:../windows-ad/Authorize.php');
}

// Try get old user first
try {
    $parseUser = ParseUser::logIn($windowsUser->{'userPrincipalName'}, $windowsUser->{'objectId'});
    // Do stuff after successful login.
} catch (ParseException $error) {
    // If failed user probably does not exist, then creating the user
    $parseUser = new ParseUser();
    $parseUser->set("username", $windowsUser->{'userPrincipalName'});
    $parseUser->set("password", $windowsUser->{'objectId'}); // Not secure but ok lol<commit_msg>try fix sessions<commit_after><?php
/**
 * Created by PhpStorm.
 * User: harrisonchow
 * Date: 6/23/16
 * Time: 8:39 PM
 */

// NOTE: THIS PAGE IS NOT TO BE CALLED DIRECTLY
use Parse\ParseClient;
use Parse\ParseObject;
use Parse\ParseException;
use Parse\ParseUser;
use Parse\ParseSessionStorage;

ParseClient::initialize($ParseAppID, '', $ParseMasterKey);
ParseClient::setServerURL($ParseServer);
//ParseClient::setStorage( new ParseSessionStorage() );

// Login only works after authorized with windows-ad
if (!isset($windowsUser)) {
    header('Location:../windows-ad/Authorize.php');
}

// Try get old user first
try {
    $parseUser = ParseUser::logIn($windowsUser->{'userPrincipalName'}, $windowsUser->{'objectId'});
    // Do stuff after successful login.
} catch (ParseException $error) {
    // If failed user probably does not exist, then creating the user
    $parseUser = new ParseUser();
    $parseUser->set("username", $windowsUser->{'userPrincipalName'});
    $parseUser->set("password", $windowsUser->{'objectId'}); // Not secure but ok lol
{'fraction_non_alphanumeric': 0.14902705268153774, 'fraction_numerical': 0.007593735168485999, 'mean_word_length': 4.807162534435261, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 15, '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': '657323', 'n_tokens_mistral': 638, 'n_tokens_neox': 619, 'n_words': 173}