8 this.inherited(arguments);
9 if (enyo.getCookie('auth') && enyo.getCookie('username')) {
11 this.username = enyo.getCookie('username');
12 // Defer the signal until everything's initialized
13 setTimeout(function() {
14 this.bubble('onLoginSuccessful', {username: this.username});
18 login: function(username, password) {
19 var req = new enyo.Ajax({
20 url: baseURL + '/login',
23 req.response(function(inSender, inResponse) {
24 if (inResponse.status == 'success') {
26 this.username = username;
27 enyo.setCookie('username', username);
28 this.bubble('onLoginSuccessful', {username: username});
30 enyo.setCookie('username', '', {"Max-Age": 0});
31 this.bubble('onLoginFailed');
40 var req = new enyo.Ajax({
41 url: baseURL + '/logout',
44 req.response(function(inSender, inResponse) {
45 this.loggedIn = false;
46 enyo.setCookie('auth', '', {"Max-Age": 0});
47 this.bubble('onLogoutSuccessful');
50 username: this.username
52 enyo.setCookie('username', '', {"Max-Age": 0});
54 requestFeedStatus: function() {
56 throw new Error('Cannot request feed status when not logged in');