Usermod doesn't see sub theme_header even though it's defined on the theme

When you login to usermin and when (the following is important) the user exists on Webmin Users List there is UI problem happens because theme_header is not printed and old ugly one is provided by the following sub header function.

When you login as I described, this (if (defined(&theme_header))) never evaluates to true.

/usr/libexec/usermin/web-lib-funcs.pl:

sub header
{
return if ($main::done_webmin_header++);
my $ll;
my $charset = defined($main::force_charset) ? $main::force_charset
    : &get_charset();
&PrintHeader($charset);
&load_theme_library();
if (defined(&theme_header)) {
$module_name = &get_module_name();
&theme_header(@_);
$miniserv::page_capture = 1;
return;
}
...

When you login to Usermin using regular/system user credentials - all is fine.

How to reproduce the bug.

  1. Import virtual server using Virtualmin
  2. Tick create Webmin user.
  3. Login to Usermin using that user
  4. Try clicking on some modules, like Apache or Fetchmail Mail Retrieval and you see what you get.

If you use regular mode - like if there is no Webmin user, then all is fine.

Please fix this bug or correct me if I'm wrong.

Regards, Ilia

Status: 
Active

Comments

So this problem happens in usermin , but is only a problem if there is a webmin user with the same name?

That is very odd, as Usermin shouldn't even know which Webmin users exist.

Ilia's picture
Submitted by Ilia on Fri, 11/07/2014 - 04:42

The fact might be different. I just deleted that Webmin user (created by Virtualmin) - the result is the same - old header(theme_header never read, even obviously it exists).

If I go to user and groups, there is only one visible difference between working/not working users - the switch for Rename group if username changes? in not working user.

Whatever it is, I don't know what but you must definitely take a look.

I can't believe that I really see it... I just login at first with one user - all is fine. Second logout and login with the not working user, and some modules - right frame - not getting theme_header but old one.

Uuff.. Please try to reproduce the error.

Which theme are you seeing this with - the default (Virtualmin Framed), or a custom theme that you're developing?

Ilia's picture
Submitted by Ilia on Sun, 11/09/2014 - 02:56

I see it on my theme! But I wouldn't think it's a bug unless it worked with users that weren't imported by Virtualmin (but I might be wrong all about the real cause). What is for sure, that when I login to Usermin with different users, I get different result. The result is missing theme_header (which is obviously there) on one of the users.

See the screenshoots:

Normal (working) user. Not working user.

Same theme, same server, nothing is changed. Isn't it weird? What that could be?

Ok, let me give this a try on a test system.

Is your theme the same for both Webmin and Usermin? Or do you have a special Usermin-specific branch?

Ilia's picture
Submitted by Ilia on Mon, 11/10/2014 - 02:46

Alright, please try.

Yes, my theme works fine and the same for both Webmin/Usermin and even for Virtualmin module.

Regards, Ilia

So I just tested this, and on my system the theme worked fine!

Ilia's picture
Submitted by Ilia on Tue, 11/11/2014 - 02:19

Jamie, thank you for the message on the main page! :)

If it works, then fine. But I will try to find the way to re-create the bug, so if it's really there it could be fixed.

P.S. Probably logging using a user that was imported by Virtualmin makes the trick.

Regards, Ilia