From 9db1b060a62c226ef665674f537b347254b608b8 Mon Sep 17 00:00:00 2001 From: Valentin Samir Date: Tue, 10 May 2016 13:42:11 +0200 Subject: [PATCH] An empty root password disable the root password --- instances/templates/instance.html | 1 + instances/views.py | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/instances/templates/instance.html b/instances/templates/instance.html index 38b4c33..5c3b73d 100644 --- a/instances/templates/instance.html +++ b/instances/templates/instance.html @@ -257,6 +257,7 @@ {% endifequal %} +

{% trans "An empty password disable the root password." %}

diff --git a/instances/views.py b/instances/views.py index d0b4773..fbd8b34 100644 --- a/instances/views.py +++ b/instances/views.py @@ -288,7 +288,11 @@ def instance(request, compute_id, vname): if 'rootpasswd' in request.POST: passwd = request.POST.get('passwd', '') - passwd_hash = crypt.crypt(passwd, '$6$kgPoiREy') + if passwd: + passwd_hash = crypt.crypt(passwd, '$6$kgPoiREy') + # if password is empty, disable the root password + else: + passwd_hash = "*" data = {'action': 'password', 'passwd': passwd_hash, 'vname': vname} if conn.get_status() == 5: