Sha256: 63d2ee23b9f1d2ca1178b23a430c026f24ee760956c35fe8b0eb4f6b87262a64

Contents?: true

Size: 698 Bytes

Versions: 5

Compression:

Stored size: 698 Bytes

Contents

// console.log('Loading Authentication...')

Spontaneous.Auth = (function($, S) {
	return {
		Key: {
			key: function(site) {
				return site + '_api_key';
			},
			save: function(site, key) {
				localStorage.setItem(this.key(site), key);
			},
			load: function(site) {
				return localStorage.getItem(this.key(site)) || this.loadAutoLogin();
			},
			loadAutoLogin: function() {
				if (!this._autoLoginKey) {
					console.warn('Using auto login key for user', "'"+S.auto_login+"'");
					this._autoLoginKey = S.user_key;
				}
				return this._autoLoginKey;
			},
			remove: function(site) {
				localStorage.removeItem(this.key(site));
				return false;
			}
		}
	};
}(jQuery, Spontaneous));

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
spontaneous-0.2.0.beta10 application/js/authentication.js
spontaneous-0.2.0.beta9 application/js/authentication.js
spontaneous-0.2.0.beta8 application/js/authentication.js
spontaneous-0.2.0.beta7 application/js/authentication.js
spontaneous-0.2.0.beta6 application/js/authentication.js