Sha256: abf64323db2738cd86397cf293abc345ba0904517391eb96034d02dbf2d58de6

Contents?: true

Size: 697 Bytes

Versions: 12

Compression:

Stored size: 697 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

12 entries across 12 versions & 1 rubygems

Version Path
spontaneous-0.2.0.beta5 application/js/authentication.js
spontaneous-0.2.0.beta4 application/js/authentication.js
spontaneous-0.2.0.beta3 application/js/authentication.js
spontaneous-0.2.0.beta2 application/js/authentication.js
spontaneous-0.2.0.beta1 application/js/authentication.js
spontaneous-0.2.0.alpha7 application/js/authentication.js
spontaneous-0.2.0.alpha6 application/js/authentication.js
spontaneous-0.2.0.alpha5 application/js/authentication.js
spontaneous-0.2.0.alpha4 application/js/authentication.js
spontaneous-0.2.0.alpha3 application/js/authentication.js
spontaneous-0.2.0.alpha2 application/js/authentication.js
spontaneous-0.2.0.alpha1 application/js/authentication.js