<commit_before>/*
 * This file contains all the variables for a user's session.
 * It should contain 
 * These variables can modified by the client.
 *
 */

var usergrid = usergrid || {};

usergrid.session = (function() {

  /* This code block *WILL* load before the document is complete */

  function loggedIn() {
    return self.loggedInUser && self.accessToken;
  }

  function readIt() {
    self.currentOrganization = localStorage.getObject('currentOrganization');
    self.currentApplicationId = localStorage.getItem('currentApplicationId');
    self.loggedInUser = localStorage.getObject('usergridUser');
    self.accessToken = localStorage.getItem('accessToken');
  }

  function clearIt() {
    self.accessToken = null;
    self.loggedInUser = null;
    self.currentOrganizationName = null;
    self.currentApplicationId = null;
    self.currentOrganization = null;
    localStorage.removeItem('accessToken');
    localStorage.removeItem('usergridUser');
    localStorage.removeItem('currentOrganization');
    localStorage.removeItem('currentApplicationId');

    if (usergrid.client.useSSO()){
      usergrid.client.sendToSSOLogoutPage();
    }
  }

  function saveIt() {
    localStorage.setObject('currentOrganization', self.currentOrganization);
    localStorage.setItem('currentApplicationId', self.currentApplicationId);<commit_msg>temp fix for double quote issue<commit_after>/*
 * This file contains all the variables for a user's session.
 * It should contain 
 * These variables can modified by the client.
 *
 */

var usergrid = usergrid || {};

usergrid.session = (function() {

  /* This code block *WILL* load before the document is complete */

  function loggedIn() {
    return self.loggedInUser && self.accessToken;
  }

  function readIt() {
    self.currentOrganization = localStorage.getObject('currentOrganization');
    self.currentApplicationId = localStorage.getItem('currentApplicationId');
    self.loggedInUser = localStorage.getObject('usergridUser');
    self.accessToken = localStorage.getItem('accessToken');

    function removeQuotes(string){
        return string.replace(/"/g,"");
    }
    self.accessToken = removeQuotes(self.accessToken);
  }

  function clearIt() {
    self.accessToken = null;
    self.loggedInUser = null;
    self.currentOrganizationName = null;
    self.currentApplicationId = null;
    self.currentOrganization = null;
    localStorage.removeItem('accessToken');
    localStorage.removeItem('usergridUser');
    localStorage.removeItem('currentOrganization');
    localStorage.removeItem('currentApplicationId');

    if (usergrid.client.useSSO()){
      usergrid.client.sendToSSOLogoutPage();
    }
  }

  function saveIt() {
    localStorage.setObject('currentOrganization', self.currentOrganization);
    localStorage.setItem('currentApplicationId', self.currentApplicationId);
{'fraction_non_alphanumeric': 0.11356466876971609, 'fraction_numerical': 0.0, 'mean_word_length': 4.344569288389513, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '1325871', 'n_tokens_mistral': 797, 'n_tokens_neox': 783, 'n_words': 162}