showpass.cgi

Jamie/Joe,

From time to time I find myself referring to "Edit Virtual Server" to copy a password for a Virtual Server.

At the moment, when you click the "key" icon to show the "Username" and "Password", it can be difficult to copy the password since clicking on the popup (using Authentic Theme) the popup closes.

That said, I searched through "/usr/libexec/webmin/virtual-server/showpass.cgi" code and devised a clean fix that could be useful for others, so I thought I'd pass it along.

Near the end of the file, there's a few lines:

"<td><tt>",&html_escape($username),"</tt></td> </tr>\n";

To make the username selectable without making things too complicated, I changed the above code to read.

"<td><input size="20" style="border: 0;font-size: 12px;height: 30px;width: 150px"  type="text" value="",&html_escape($username),""></td></tr>\n";

Respectively, I changed the following code:

"<td><tt>",&html_escape($pass),"</tt></td> </tr>\n";

to

"<td><input size="20" style="border: 0;font-size: 12px;height: 30px;width: 150px" type="text" value="",&html_escape($pass),""></td></tr>\n";

While I've personally added the styling statically in the snippet, I suppose this could be globalized somewhere in the theme, but it was a quick fix to apply the styles inline for me.

Anyways, always happy to provide suggestions to further improve the product!

-Peter

Comments

Assigned: Unassigned »

Re-assigning this to Ilia, as it looks like a theme question.

tpnsolutions's picture
Submitted by tpnsolutions on Mon, 02/13/2017 - 22:24 Pro Licensee

Jamie,

Actually at first glance I thought this was the case too. But the code is generated statically in the "showpass.cgi" script, so it would seem the basic portion of the code might be more appropriate for modification in the "showpass.cgi" script itself.

I suppose styling the look and feel might be appropriately delegated to Ilia, but the basic input field itself should be put into "showpass.cgi", unless you later expose this data via another method.

Just my thought ofcourse.

-Peter

Did you check if that fix works? Because I'm not sure if showpass.cgi is being run when using the new theme.

tpnsolutions's picture
Submitted by tpnsolutions on Tue, 02/14/2017 - 20:09 Pro Licensee

Jamie,

The modification was taken from one of my own Virtualmin installs.

Yes, when you click the "key" icon in "Edit Virtual Server" page, the Authentic theme is essentially calling the "showpass.cgi" script for it's inline popup.

-Peter

Ilia, could you change the popup so that it has a separate close button? That seems like the more scalable solution, as there are several of these in Virtualmin and Cloudmin.

Ilia's picture
Submitted by Ilia on Thu, 02/16/2017 - 12:36

Yes, Jamie, I could do that.

Peter, at the moment, I made it intelligent enough to keep it opened in case user selected text. Anytime there is selected username/password, the popup will stay and wait for your action.

If you wish to have a close button it will require some extra rework but I think I can do it without making it look bad.

Ilia's picture
Submitted by Ilia on Fri, 02/17/2017 - 06:14

Project: Virtualmin Virtual Servers » Authentic Theme
tpnsolutions's picture
Submitted by tpnsolutions on Tue, 02/21/2017 - 02:18 Pro Licensee

Ilia,

When I "click" on the box, it closes. This drives me nuts. When I copy stuff, I am used to being able to "double click" some text to select it. So as I said, when I click on the box, and it closes, I want to throw drive my fist through my screen, heh heh.

Hence, I turned both the "Username" and "Password" values into "input" fields, which when clicked inside, don't close the popup, and keeping in the spirit of double clicking, actually select the contents accordingly.

Alternatively, if "clicking" inside the popup DIDN'T trigger it to close, I'd be ok with that.

*** most similar popups in other apps ONLY close when you click "outside" the popup, or when you click an "X" (or "close") button. ***

-Peter

Ilia's picture
Submitted by Ilia on Tue, 02/21/2017 - 04:39

Peter, I got it. I will fix it in 18.40.

Meanwhile, all you need to do is to click inside and do not release the left mouse button, while at the same time pulling and selecting needed text - it will stay open, if after the keyup event, there is selected text. In case of clicking straight on the text, yeah it's closes. Not convenient, I agree.

Ilia's picture
Submitted by Ilia on Sun, 03/12/2017 - 13:30

Status: Active » Closed (fixed)