<commit_before><?php

final class PhabricatorApplicationAuth extends PhabricatorApplication {

  public function canUninstall() {
    return false;
  }

  public function getBaseURI() {
    return '/auth/';
  }

  public function getIconName() {
    return 'authentication';
  }

  public function getHelpURI() {
    // NOTE: Although reasonable help exists for this in "Configuring Accounts
    // and Registration", specifying a help URI here means we get the menu
    // item in all the login/link interfaces, which is confusing and not
    // helpful.

    // TODO: Special case this, or split the auth and auth administration
    // applications?

    return null;
  }

  public function buildMainMenuItems(
    PhabricatorUser $user,
    PhabricatorController $controller = null) {

    $items = array();

    if ($user->isLoggedIn()) {
      $item = id(new PHUIListItemView())
        ->addClass('core-menu-item')
        ->setName(pht('Log Out'))
        ->setIcon('power')
        ->setWorkflow(true)
        ->setHref('/logout/')
        ->setSelected(($controller instanceof PhabricatorLogoutController));
      $items[] = $item;
    } else {
      if ($controller instanceof PhabricatorAuthController) {
        // Don't show the "Login" item on auth controllers, since they're
        // generally all related to logging in anyway.
      } else {
        $item = id(new PHUIListItemView())
          ->addClass('core-menu-item')
          ->setName(pht('Log In'))
          // TODO: Login icon?
          ->setIcon('power')
          ->setWorkflow(true)
          ->setHref('/auth/login/');
        $items[] = $item;
      }
    }

    return $items;
  }

  public function getApplicationGroup() {
    return self::GROUP_ADMIN;
  }

  public function getRoutes() {
    return array(
      '/auth/' => array(
        '' => 'PhabricatorAuthListController',
        'config/' => array(
          'new/' => 'PhabricatorAuthNewController',
          'new/(?P<className>[^/]+)/' => 'PhabricatorAuthEditController',
          'edit/(?P<id>\d+)/' => 'PhabricatorAuthEditController',
          '(?P<action>enable|disable)/(?P<id>\d+)/' =>
            'PhabricatorAuthDisableController',<commit_msg>Fix new logged-out "Login" button URI and workflowiness<commit_after><?php

final class PhabricatorApplicationAuth extends PhabricatorApplication {

  public function canUninstall() {
    return false;
  }

  public function getBaseURI() {
    return '/auth/';
  }

  public function getIconName() {
    return 'authentication';
  }

  public function getHelpURI() {
    // NOTE: Although reasonable help exists for this in "Configuring Accounts
    // and Registration", specifying a help URI here means we get the menu
    // item in all the login/link interfaces, which is confusing and not
    // helpful.

    // TODO: Special case this, or split the auth and auth administration
    // applications?

    return null;
  }

  public function buildMainMenuItems(
    PhabricatorUser $user,
    PhabricatorController $controller = null) {

    $items = array();

    if ($user->isLoggedIn()) {
      $item = id(new PHUIListItemView())
        ->addClass('core-menu-item')
        ->setName(pht('Log Out'))
        ->setIcon('power')
        ->setWorkflow(true)
        ->setHref('/logout/')
        ->setSelected(($controller instanceof PhabricatorLogoutController));
      $items[] = $item;
    } else {
      if ($controller instanceof PhabricatorAuthController) {
        // Don't show the "Login" item on auth controllers, since they're
        // generally all related to logging in anyway.
      } else {
        $item = id(new PHUIListItemView())
          ->addClass('core-menu-item')
          ->setName(pht('Log In'))
          // TODO: Login icon?
          ->setIcon('power')
          ->setHref('/auth/start/');
        $items[] = $item;
      }
    }

    return $items;
  }

  public function getApplicationGroup() {
    return self::GROUP_ADMIN;
  }

  public function getRoutes() {
    return array(
      '/auth/' => array(
        '' => 'PhabricatorAuthListController',
        'config/' => array(
          'new/' => 'PhabricatorAuthNewController',
          'new/(?P<className>[^/]+)/' => 'PhabricatorAuthEditController',
          'edit/(?P<id>\d+)/' => 'PhabricatorAuthEditController',
          '(?P<action>enable|disable)/(?P<id>\d+)/' =>
            'PhabricatorAuthDisableController',
{'fraction_non_alphanumeric': 0.13519021739130435, 'fraction_numerical': 0.0, 'mean_word_length': 2.570735650767987, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 48, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2142650', 'n_tokens_mistral': 1305, 'n_tokens_neox': 1263, 'n_words': 325}