Browse Source

Fix 404 when loading css etc. for admins

For admins, the relative path to css etc. is '', not '../'
pull/764/merge
Christian Boltz 4 weeks ago
parent
commit
d50d171914
No known key found for this signature in database GPG Key ID: C6A682EA63C82F1C
  1. 14
      model/PFASmarty.php
  2. 2
      public/users/app-passwords.php
  3. 2
      public/users/totp-exceptions.php
  4. 2
      public/users/totp.php

14
model/PFASmarty.php

@ -58,6 +58,20 @@ class PFASmarty
$this->configureTheme('');// default to something.
}
/**
* get relative path to css etc. based on permissions (user vs. admin)
* Note: this function only works after login
*/
public function getRelPath()
{
if (authentication_has_role('user')) {
return '../';
} else {
return '';
}
}
/**
* @param string $rel_path - relative path for referenced css etc dependencies - e.g. users/edit.php needs '../' else, it's ''.
*/

2
public/users/app-passwords.php

@ -29,7 +29,7 @@
require_once('../common.php');
$smarty = PFASmarty::getInstance();
$smarty->configureTheme('../');
$smarty->configureTheme($smarty->getRelPath());
$username = authentication_get_username();
$pPassword_text = "";

2
public/users/totp-exceptions.php

@ -30,7 +30,7 @@
require_once(__DIR__ . '/../common.php');
$smarty = PFASmarty::getInstance();
$smarty->configureTheme('../');
$smarty->configureTheme($smarty->getRelPath());
$username = authentication_get_username();
list($local_part, $domain) = explode('@', $username);

2
public/users/totp.php

@ -27,7 +27,7 @@
require_once('../common.php');
$smarty = PFASmarty::getInstance();
$smarty->configureTheme('../');
$smarty->configureTheme($smarty->getRelPath());
$username = authentication_get_username();
$pPassword_password_current_text = "";

Loading…
Cancel
Save