added JavaScript check for empty password to remove_orphaned_pages action

This commit is contained in:
Alexey Verkhovsky 2005-02-05 13:53:29 +00:00
parent bc97b8d4f7
commit 7c28e46688
2 changed files with 20 additions and 8 deletions

View file

@ -1,6 +1,7 @@
<% @title = "Edit Web" %> <% @title = "Edit Web" %>
<form action="edit_web" id="setup" method="post" onSubmit="cleanAddress(); return validateSetup()"> <form action="edit_web" id="setup" method="post"
onSubmit="cleanAddress(); return validateEditWebForm()">
<h2 style="margin-bottom: 3px">Name and address</h2> <h2 style="margin-bottom: 3px">Name and address</h2>
<div class="help"> <div class="help">
The name of the web is included in the title on all pages. The name of the web is included in the title on all pages.
@ -57,7 +58,8 @@
</small> </small>
</p> </p>
<a href="#" onClick="document.getElementById('additionalStyle').style.display='block';return false;"> <a href="#"
onClick="document.getElementById('additionalStyle').style.display='block';return false;">
Stylesheet tweaks &gt;&gt;</a> Stylesheet tweaks &gt;&gt;</a>
<small><em> <small><em>
- add or change styles used by this web; styles defined here take precedence over - add or change styles used by this web; styles defined here take precedence over
@ -90,13 +92,15 @@
The published version is accessible through URLs like /wiki/published/HomePage. The published version is accessible through URLs like /wiki/published/HomePage.
</div> </div>
<div class="inputBox"> <div class="inputBox">
<input type="checkbox" name="published" <%= 'checked="on"' if @web.published %> /> Publish this web <input type="checkbox" name="published" <%= 'checked="on"' if @web.published %> />
Publish this web
</div> </div>
<p align="right"> <p align="right">
<small> <small>
Enter system password Enter system password
<input type="password" class="disableAutoComplete" id="system_password" name="system_password" /> <input type="password" class="disableAutoComplete" id="system_password"
name="system_password" />
and and
<input type="submit" value="Update Web" /> <input type="submit" value="Update Web" />
<br/><br/> <br/><br/>
@ -109,11 +113,12 @@
<br/> <br/>
<h1>Other administrative tasks</h1> <h1>Other administrative tasks</h1>
<form action="remove_orphaned_pages" id="remove_orphaned_pages" method="post"> <form action="remove_orphaned_pages" id="remove_orphaned_pages" method="post"
onSubmit="return checkSystemPassword(document.getElementById('system_password_orphaned').value)">
<p align="right"> <p align="right">
<small> <small>
Clean up by entering system password Clean up by entering system password
<input type="password" id="system_password" name="system_password" /> <input type="password" id="system_password_orphaned" name="system_password" />
and and
<input type="submit" value="Delete Orphan Pages" /> <input type="submit" value="Delete Orphan Pages" />
</small> </small>

View file

@ -8,11 +8,18 @@ function cleanAddress() {
document.getElementById('address').value.replace(/[^a-zA-Z0-9]/g, "").toLowerCase(); document.getElementById('address').value.replace(/[^a-zA-Z0-9]/g, "").toLowerCase();
} }
function validateSetup() { function checkSystemPassword(password) {
if (document.getElementById('system_password').value == "") { if (password == "") {
alert("You must enter the system password"); alert("You must enter the system password");
return false; return false;
} }
}
function validateEditWebForm() {
if (!checkSystemPassword(document.getElementById('system_password').value))
return false
end
if (document.getElementById('name').value == "") { if (document.getElementById('name').value == "") {
alert("You must pick a name for the web"); alert("You must pick a name for the web");