Persists a user as currentUser to localStorage, and into the singleton.
506860
function(user) {
      if (Parse.User._currentUser !== user) {
        Parse.User.logOut();
      }
      user._isCurrentUser = true;
      Parse.User._currentUser = user;
      Parse.User._currentUserMatchesDisk = true;

      var json = user.toJSON();
      json._id = user.id;
      json._sessionToken = user._sessionToken;
      Parse.localStorage.setItem(
          Parse._getParsePath(Parse.User._CURRENT_USER_KEY),
          JSON.stringify(json));
    }
1163202
public void setCurrentuser(String currentUser) {

        if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(currentUser)) {
            m_currentuser = Boolean.valueOf(currentUser).booleanValue();
        }
    }
1205292
def save(self, *args, **kwargs):
        
        if not self.instance.id:
            self.instance.created_by = self.user
        self.instance.last_modified_by = self.user
        return super(ChangeableContentForm, self).save(*args, **kwargs)
234115
def persist(self, context):
		""""""
		
		D = self._Document
		document = context.session[self.name]
		
		D.get_collection().replace_one(D.id == document.id, document, True)
714353
function getUserData() {
   let userData = localStorage.getItem(LOCAL_STORAGE_ID);
   if (userData === null) {
      userData = '{}';
   }

   userData = JSON.parse(userData);
   return userData;
}
563049
function Store() {
	this.cache = new LocalStash(30);
	this.ttl = getTTL();

	this._forward = function () {
		logger.error('No forwarder defined');
	};

	logger.verbose('Messages will expire after', this.ttl, 'seconds.');
}
802628
def currentUser(extras=nil)
      method = 'currentUser'
      type = User
      args = {}
      args[:extras] = extras if extras
      return_object type,method,args,true
    end
353281
function Persist(cacheFile, keys, log) {
  var pdata = (cacheFile) ? JSON.parse(fs.readFileSync(cacheFile, 'utf8')) : {}
    , guid = makeGuid(keys);

  pdata[guid] = pdata[guid] || {};

  // this is the only member that needs access to the full object and the file
  this.save = function () {
    if (cacheFile) {
      fs.writeFileSync(cacheFile, JSON.stringify(pdata));
    }
  };

  // members need only know their config object
  this.cfg = pdata[guid];
  this.cfg.opts = this.cfg.opts || {};

  // was a logger passed down?
  this.log = (type.isFunction(log)) ? log : noop;
}
335479
function(persist) {
          /**
          * is Persistant or not
          * @property {boolean} isPersisted Persistant property
          * @memberof AbstractLocalStorage
          */
          this.isPersisted = persist;

          this.myStore = null;
          /**
          * Is storage supported
          * @method isSupported
          * @memberof AbstractLocalStorage
          * @returns {boolean} Returns true if supported
          */
          this.isSupported = function() {
            return (typeof (Storage) !== "undefined");
          };

          // true = localStorage, false = sessionStorage
          if (this.isSupported()) {
            //logger.debug("AUGMENTED: localStorage exists");

            if (this.isPersisted) {
              this.myStore = localStorage;
            } else {
              this.myStore = sessionStorage;
            }
          } else {
            logger.warn("AUGMENTED: No localStorage.");
          }

          /**
          * Gets an item from storage
          * @method getItem
          * @memberof AbstractLocalStorage
          * @param {string} key The key in storage
          * @returns {object} Returns object from storage
          */
          this.getItem = function(itemKey) {
            var item = this.myStore.getItem(itemKey);
            if (item) {
              return JSON.parse(item);
            }
            return null;
          };

          /**
          * Sets an item to storage
          * @method setItem
          * @memberof AbstractLocalStorage
          * @param {string} key The key in storage
          * @param {object} object The data to set
          */
          this.setItem = function(itemKey, object) {
            this.myStore.setItem(itemKey, JSON.stringify(object));
          };

          /**
          * Removes an item from storage
          * @method removeItem
          * @memberof AbstractLocalStorage
          * @param {string} key The key in storage
          */
          this.removeItem = function(itemKey) {
            this.myStore.removeItem(itemKey);
          };

          /**
          * Clears storage - <b>Warning: Destructive in non-namespaced instances!</b>
          * @method clear
          * @memberof AbstractLocalStorage
          */
          this.clear = function() {
            this.myStore.clear();
          };

          /**
          * Gets the key from storage for index
          * @method key
          * @memberof AbstractLocalStorage
          * @param {number} i The index in storage
          * @returns {string} Returns the key from storage
          */
          this.key = function(i) {
            return this.myStore.key(i);
          };

          /**
          * The length of storage by keys
          * @method length
          * @memberof AbstractLocalStorage
          * @returns {number} Returns the length of storage by keys
          */
          this.length = function() {
            return this.myStore.length;
          };
        }
472236
function save() {
      var value, data = '';

      // localStorage can be disabled on WebKit/Gecko so make a dummy storage
      if (!hasOldIEDataSupport) {
        return;
      }

      for (var key in items) {
        value = items[key];
        data += (data ? ',' : '') + key.length.toString(32) + ',' + key + ',' + value.length.toString(32) + ',' + value;
      }

      storageElm.setAttribute(userDataKey, data);

      try {
        storageElm.save(userDataKey);
      } catch (ex) {
        // Ignore disk full
      }

      updateKeys();
    }
895359
def createSessionForKey(self, key, user):
        
        PersistentSession(
            store=self.store,
            sessionKey=key,
            authenticatedAs=user)
427893
private void save() {
    Preferences pref = Preferences
        .userNodeForPackage(ConnectionDialog.class);

    pref.put("host", getHost());
    pref.put("user", getUser());

    boolean remember = getRememberPasswordCheckBox().isSelected();
    if (remember) {
      try {
        Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
        KeyGenerator keygen = KeyGenerator.getInstance("AES");
        SecureRandom random = SecureRandom.getInstance("SHA1PRNG");
        random.setSeed(new byte[]{
          0x60, (byte) 0xFD, 0x28, 0x07, 0x35, 0x4A, 0x0D, 0x3B
        });
        byte[] iv = new byte[16];
        random.nextBytes(iv);
        IvParameterSpec spec = new IvParameterSpec(iv);
        keygen.init(128, random);
        cipher.init(Cipher.ENCRYPT_MODE, keygen.generateKey(), spec);
        byte[] clearText = getPassword().getBytes();
        byte[] cipherText = cipher.doFinal(clearText);
        pref.putByteArray("password", cipherText);
        pref.putBoolean("remember", true);
      } catch (Exception e) {
        logger.error("Could not encrypt password", e);
        pref.remove("password");
        pref.putBoolean("remember", false);
      }
    } else {
      pref.remove("password");
      pref.putBoolean("remember", false);
    }
  }
134790
public synchronized void persist() throws KeyStoreException, NoSuchAlgorithmException, CertificateException {
		try
		{
			FileOutputStream kso = new FileOutputStream(new File(root, _caPrivateKeystore));
			_ks.store(kso, _keystorepass);
			kso.flush();
			kso.close();
			persistCertMap();
			persistSubjectMap();
			persistKeyPairMap();
			persistPublicKeyMap();
		}
		catch(IOException ioe)
		{
			ioe.printStackTrace();
		}
	}
545237
@SuppressWarnings("unchecked")
    public <T> T persist(T object) {
        pm.currentTransaction().begin();
        pm.makePersistent(object);
        pm.currentTransaction().commit();
        pm.getFetchPlan().setDetachmentOptions(FetchPlan.DETACH_LOAD_FIELDS);
        pm.refresh(object);
        return object;
    }
1264931
function store(name, val) {
        if (typeof (Storage) !== 'undefined') {
            localStorage.setItem(name, val)
        } else {
            window.alert('Please use a modern browser to properly view this template!')
        }
    }
138894
protected function initializeCurrentUsername()
    {
        if (isset($this->currentUsername)) {
            return;
        }

        $currentUser = $this->userDomainService->getCurrentUser();
        if (!$currentUser instanceof User) {
            return;
        }

        $this->currentUsername = $this->userDomainService->getUsername($currentUser);
    }
1194029
def current_user
      if (user_id = session[:user_id])
        @current_user ||= User.find_by(id: user_id)
      elsif (user_id = cookies.signed[:user_id])
        user = User.find_by(id: user_id)
        if user && user.authenticated?(cookies[:remember_token])
          log_in user
          @current_user = user
        end
      end
    end