EOF;
}
return $resendPwdHtml;
}
private static function updateNewFormResend(Form &$form)
{
/**
* The Login page is an admin page created via buffer
* We print before the forms
* to avoid a FOUC
*/
print IdentityFormsHelper::getHtmlStyleTag(self::CANONICAL);
$form->addClass(Identity::FORM_IDENTITY_CLASS . " " . self::FORM_RESEND_PWD_CLASS);
/**
* Heading
*/
$headerHTML = IdentityFormsHelper::getHeaderHTML($form, self::FORM_RESEND_PWD_CLASS);
if ($headerHTML != "") {
$form->addHTML($headerHTML, 1);
}
IdentityFormsHelper::deleteFieldSetAndBrFromForm($form);
IdentityFormsHelper::toBoostrapInputElements($form, self::FORM_RESEND_PWD_CLASS);
IdentityFormsHelper::toBootStrapSubmitButton($form);
}
private static function updateDokuFormResend(Doku_Form &$form)
{
/**
* The Login page is created via buffer
* We print before the forms
* to avoid a FOUC
*/
print IdentityFormsHelper::getHtmlStyleTag(self::CANONICAL);
/**
* @var Doku_Form $form
*/
$class = &$form->params["class"];
IdentityFormsHelper::addIdentityClass($class, self::FORM_RESEND_PWD_CLASS);
$newFormContent = [];
/**
* Header (Logo / Title)
*/
$newFormContent[] = IdentityFormsHelper::getHeaderHTML($form, self::FORM_RESEND_PWD_CLASS);
/**
* Form Attributes
*
*/
foreach ($form->_content as $field) {
if (!is_array($field)) {
continue;
}
$fieldName = $field["name"];
if ($fieldName == null) {
// this is not an input field
if ($field["type"] == "submit") {
/**
* This is important to keep the submit element intact
* for forms integration such as captcha
* The search the submit button to insert before it
*/
$classes = "btn btn-primary btn-block";
if (isset($field["class"])) {
$field["class"] = $field["class"] . " " . $classes;
} else {
$field["class"] = $classes;
}
$newFormContent[] = $field;
}
continue;
}
switch ($fieldName) {
case "login":
$loginText = $field["_text"];
$loginValue = $field["value"];
$loginHTML = <<
EOF;
$newFormContent[] = $loginHTML;
break;
default:
LogUtility::msg("The register field name($fieldName) is unknown", LogUtility::LVL_MSG_ERROR, \ComboStrap\Identity::CANONICAL);
}
}
/**
* Register and Login HTML paragraph
*/
$registerHtml = action_plugin_combo_registration::getRegisterLinkAndParagraph();
if (!empty($registerHtml)) {
$newFormContent[] = $registerHtml;
}
$loginLinkToHtmlForm = action_plugin_combo_login::getLoginParagraphWithLinkToFormPage();
if (!empty($loginLinkToHtmlForm)) {
$newFormContent[] = $loginLinkToHtmlForm;
}
/**
* Update
*/
$form->_content = $newFormContent;
}
function register(Doku_Event_Handler $controller)
{
/**
* To modify the form and add class
*
* Deprecated object passed by the event but still in use
* https://www.dokuwiki.org/devel:event:html_resendpwdform_output
*/
$controller->register_hook('HTML_RESENDPWDFORM_OUTPUT', 'BEFORE', $this, 'handle_resendpwd_html', array());
/**
* New Event
* https://www.dokuwiki.org/devel:event:form_resendpwd_output
*
*/
$controller->register_hook('FORM_RESENDPWD_OUTPUT', 'BEFORE', $this, 'handle_resendpwd_html', array());
}
function handle_resendpwd_html(&$event, $param)
{
$form = &$event->data;
$class = get_class($form);
switch ($class) {
case Doku_Form::class:
/**
* Old one
* @var Doku_Form $form
*/
self::updateDokuFormResend($form);
return;
case dokuwiki\Form\Form::class;
/**
* New One
* @var Form $form
*/
self::updateNewFormResend($form);
return;
}
}
}