[ Index ]

PHP Cross Reference of Phabricator

title

Body

[close]

/webroot/rsrc/js/application/auth/ -> behavior-persona-login.js (source)

   1  /**
   2   * @provides javelin-behavior-persona-login
   3   * @requires javelin-behavior
   4   *           javelin-resource
   5   *           javelin-stratcom
   6   *           javelin-workflow
   7   *           javelin-util
   8   */
   9  
  10  JX.behavior('persona-login', function(config) {
  11  
  12    JX.Stratcom.listen(
  13      'submit',
  14      'persona-login-form',
  15      function(e) {
  16        e.kill();
  17        navigator.id.request();
  18      });
  19  
  20    var onloaded = function() {
  21      // Before installing watch(), log the user out, because we know they don't
  22      // have a valid session if they're hitting this page. If we don't do this,
  23      // Persona may immediately trigger a login event, which prevents the user
  24      // from selecting another authentication mechanism.
  25      navigator.id.logout();
  26  
  27      navigator.id.watch({
  28        loggedInUser: null,
  29        onlogin: onlogin,
  30        onlogout: JX.bag
  31      });
  32    };
  33  
  34    var onlogin = function(assertion) {
  35      new JX.Workflow(config.loginURI, {assertion: assertion})
  36        .start();
  37    };
  38  
  39    var persona_library = 'https://login.persona.org/include.js';
  40    JX.Resource.load(persona_library, onloaded);
  41  });


Generated: Sun Nov 30 09:20:46 2014 Cross-referenced by PHPXref 0.7.1