~benji/juju-gui/login

« back to all changes in this revision

Viewing changes to app/views/login.js

  • Committer: Benji York
  • Date: 2012-12-21 20:28:25 UTC
  • Revision ID: benji.york@canonical.com-20121221202825-z5gu5lb8gpwku47l
checkpoint

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
'use strict';
2
2
 
 
3
var no_login_prompts = false;
 
4
 
3
5
YUI.add('juju-view-login', function(Y) {
4
6
 
5
7
  var views = Y.namespace('juju.views');
25
27
      this.waiting = false;
26
28
    },
27
29
 
 
30
    _prompt: function(message) {
 
31
      // no_login_prompts is a global.
 
32
      if (no_login_prompts) {
 
33
        return null;
 
34
      }
 
35
      return prompt(message);
 
36
    },
 
37
 
28
38
    promptUser: function() {
29
39
      this._prompted = true;
30
 
      this.set('user', prompt('User name'));
31
 
      this.set('password', prompt('Password'));
32
 
//      this.set('user', 'admin');
33
 
//      this.set('password', 'admin');
 
40
      this.set('user', this._prompt('User name'));
 
41
      this.set('password', this._prompt('Password'));
34
42
      this.waiting = true;
35
43
    },
36
44
 
45
53
      if (!env.get('serverReady')) {
46
54
        return;
47
55
      }
48
 
      console.log('---------- login')
49
56
      // If the credentials are known good or we are waiting to find out, exit
50
57
      // early.
51
58
      if (this.userIsAuthenticated || this.waiting) {