<commit_before><?php
namespace Firesphere\YubiAuth;

use MemberLoginForm;
use PasswordField;
use SiteConfig;

class YubikeyLoginForm extends MemberLoginForm
{

    protected $authenticator_class = 'Firesphere\\YubiAuth\\YubikeyAuthenticator';

    /**
     * @inheritdoc
     */
    public function __construct(
        $controller,
        $name,
        $fields = null,
        $actions = null,
        $checkCurrentUser = true
    ) {
        parent::__construct($controller, $name, $fields, $actions, $checkCurrentUser);

        $this->Fields()->insertAfter('Password', PasswordField::create("Yubikey",
            _t('YubikeyAuthenticater.FORMFIELDNAME', 'Yubikey Authentication')));

        if (!SiteConfig::current_site_config()->RequirePassword) {
            $this->Fields()->removeByName('Password');
        }
    }

}
<commit_msg>There's no need to have forgot password if password login is disabled.<commit_after><?php
namespace Firesphere\YubiAuth;

use MemberLoginForm;
use PasswordField;
use SiteConfig;

class YubikeyLoginForm extends MemberLoginForm
{

    protected $authenticator_class = 'Firesphere\\YubiAuth\\YubikeyAuthenticator';

    /**
     * @inheritdoc
     */
    public function __construct(
        $controller,
        $name,
        $fields = null,
        $actions = null,
        $checkCurrentUser = true
    ) {
        parent::__construct($controller, $name, $fields, $actions, $checkCurrentUser);

        $this->Fields()->insertAfter('Password', PasswordField::create("<PASSWORD>",
            _t('YubikeyAuthenticater.FORMFIELDNAME', 'Yubikey Authentication')));

        if (!SiteConfig::current_site_config()->RequirePassword) {
            $this->Fields()->removeByName(array('Password', 'forgotPassword'));
        }
    }

}

{'fraction_non_alphanumeric': 0.12803158488437677, 'fraction_numerical': 0.0, 'mean_word_length': 3.264423076923077, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 14, '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': '5193001', 'n_tokens_mistral': 521, 'n_tokens_neox': 513, 'n_words': 94}