Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue #14 support simplified login pages #15

Merged
merged 2 commits into from
Jan 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion tfa.form.inc
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,19 @@
*
* @param object $account
* User account object.
*
* @return array
* Form array
*/
function tfa_begin_form($account) {
return backdrop_get_form('tfa_form', $account);
$tfa_form = backdrop_get_form('tfa_form', $account);

// Function added in Backdrop 1.30.0 to support simplified login pages.
if (!function_exists('user_login_page_wrapper')) {
return $tfa_form;
}

return user_login_page_wrapper($tfa_form);
}

/**
Expand Down
19 changes: 19 additions & 0 deletions tfa.module
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,25 @@ function tfa_menu() {
return $items;
}

/**
* Implements hook_menu_alter().
*/
function tfa_menu_alter(&$items) {
// If we are using the simplified look for login pages, suppress the layout.
if (config_get('system.core', 'user_login_appearance') == 'simplified') {
$items['system/tfa/%user/%']['delivery callback'] = 'backdrop_deliver_html_page';
}
}

/**
* Implements hook_user_login_paths().
*/
function tfa_user_login_paths() {
return array(
'system/tfa/*/*' => TRUE,
);
}

/**
* Validate access to TFA code entry form.
*/
Expand Down