1
0
mirror of https://github.com/Yubico/yubiadmin.git synced 2025-02-20 14:54:30 +01:00

Better restart of admin server.

This commit is contained in:
Dain Nilsson 2013-05-08 16:54:52 +02:00
parent 8dcd391628
commit 15f0883588
3 changed files with 12 additions and 4 deletions

View File

@ -25,6 +25,7 @@
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
from threading import Timer
from wtforms.fields import IntegerField, TextField, PasswordField
from wtforms.widgets import PasswordInput
from wtforms.validators import NumberRange, IPAddress
@ -88,8 +89,8 @@ class YubiAdmin(App):
template='admin/general')
def restart(self, request):
invoke_rc_d('yubiadmin', 'restart')
#We'll never get here, the user is unfortunately left with no response
timer = Timer(1, invoke_rc_d, args=('yubiadmin', 'restart'))
timer.start()
return self.redirect('/%s/general' % self.name)

View File

@ -7,9 +7,16 @@
<span class="label label-warning">WARNING</span> <strong>These settings may change the way you access the server, it is possible to lock yourself out!</strong>
</span>
<br />
<form action="restart" method="post">
<form action="restart" method="post" onsubmit="return restart_submit();">
<button class="btn btn-danger">Restart server</button>
</form>
<script>
function restart_submit(e) {
$.get('restart');
setTimeout('location.reload();', 1000);
return false;
}
</script>
</div>
{{ render_form(fieldsets, target) }}

View File

@ -33,7 +33,7 @@
<p>Hello world!</p>
{% endblock %}
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script>window.jQuery || document.write('<script src="/js/vendor/jquery-1.9.1.min.js"><\/script>')</script>
<script src="/js/vendor/bootstrap.min.js"></script>