login form accidentally hidden by some HTML- + JS-code in widgets:global

Solved Technical Support
  • hi.

    i added a HTML-widget to the global header section under /admin/extend/widgets with the following code

    <script>var images = [
      "/assets/uploads/system/header_0.png",
      "/assets/uploads/system/header_1.png",
      "/assets/uploads/system/header_2.png"
    ]; function getImageTag() { var randomIndex = Math.floor(Math.random() * images.length); var img = '<img src=\"' + images[randomIndex] + '\" alt=\"headerimage\" width=\"100\%\"/>'; return img; }</script><div style="padding-bottom:30px"><script>document.write(getImageTag());</script></div>
    

    which gave me the expected result: three randomly shown header images.  great!  but then i had to realize that the header image kind of overwrites the login.  in some browsers one can snatch the input form before its suddenly replaced by one of the three header images.

    is it a feature or a bug?  decide yourselves.  but it doesn't matter.  what i need for the moment is just quick help to fix the problem!

    as far as i know the HTML-widget should be found somewhere in the DB under the widgets:global keyword.  it would be great if one of you - with more experience in manipulating or changing an existing line of a DB entry - could help me with some script-code i could use from command line.  i'm still not confident in writing a small script which replaces the line which starts with "header": inside the widgets:global keyword to

    "header": "[]"
    

    which should just empty the global header section under /admin/extend/widgets and prevent the login form to be hidden by accident.  thank you.

    ober!schöne grüße,
    mrx.

  • @murcs I guess you're having trouble logging in to the ACP to disable the widget?

    You can use ./nodebb reset -w from the command line to reset all widgets. Restart after that and you should be good.

  • @pitaj you are right.  but resetting ALL widgets would mean i had to recap all (20?) other widgets.  okay.  no way to manipulate the DB from command line?

  • @murcs which db are you using? The widgets will just be moved to drafts, so they won't be too hard to put back.

  • @pitaj mongoDB.  but if they are just moved, it's okay.  you are right.  thank you.

  • @pitaj it worked.


Suggested Topics