diff --git a/tfa.form.inc b/tfa.form.inc index 11aa962..fe52d68 100644 --- a/tfa.form.inc +++ b/tfa.form.inc @@ -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); } /** diff --git a/tfa.module b/tfa.module index e6bc436..1a3d89a 100644 --- a/tfa.module +++ b/tfa.module @@ -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. */