Adding banning capability to web admin

I'm trying to add the ability to ban a user to the web admin page to make it easy for our customer support people to ban offensive users. The problem is, I'm new to both ejabberd and Erlang (just started learning it last week), so I'm having a hard time understanding how to create a form and handle the data when the submit button is clicked.

I've followed the example here, and added the hooks and everything, so I can get a basic page displaying. However, being new to Erlang, I'm having a hard time tracing through the ejabberd web admin code, and I can't seem to figure out how to turn this into a working form, or how to handle the event of the submit button being clicked.

Can anybody explain to me where I go from here?

web_page_main(_, #request{path=["bans"]} = _Request) ->
   Res = [?XC("h1", "Bans page in Main section"),
      ?XC("h3", "Ban a user"),
         %%ejabberd_web_admin:make_xhtml([?XAE("form", [{"action", ""}, {"method", "post"}],
         %%   [
                 ?XC("h3", "Enter JID and click submit."),
                 %%?XE("table",
                 %%   [?XE("tr", [?XC("td", ?C("User") ++ ":"), ?XE("td", [?INPUT("text", "jid", "")])]),
                 %%    ?XE("tr", [?XC("td", ?C("Reason") ++ ":"), ?XE("td", [?INPUT("text", "reason", "")])]),
                 %%    ?XE("tr", [?XC("td", ?C("Banned By") ++ ":"), ?XE("td", [?INPUT("text", "banned_by", "")])])
                 %%   ]
                 %%),
                 ?BR,
                 ?C("JID: "),
                 ?BR,
                 ?INPUT("text", "jid", ""),
                 ?BR,
                 ?C("Reason: "),
                 ?BR,
                 ?INPUT("text", "reason", ""),
                 ?BR,
                 ?C("Banned By: "),
                 ?BR,
                 ?INPUT("text", "banned_by", ""),
                 ?BR,
                 ?INPUT("submit", "submit", "Submit")
         %%   ])
         %%])
      ],
   {stop, Res};
web_page_main(Acc, _) -> Acc.

How to ban a user: Go to

How to ban a user: Go to webadmin, the ACL page, and add:
blocked
user
badboy@example.com

Since then, that user cannot login until you remove that ACL.

Syndicate content