...
 
Commits (18)
......@@ -415,8 +415,8 @@ class EditEmailForm(GenericForm):
"correos entrantes en tu cuenta actual "
"también tendrás que incluirla en el listado.")
givenName = forms.CharField(label=_('Nombre'), required=False)
sn = forms.CharField(label=_('Apellidos'), required=False)
givenName = forms.CharField(label=_('Nombre'), required=True)
sn = forms.CharField(label=_('Apellidos'), required=True)
password = forms.CharField(label=_('Contraseña'), widget=forms.PasswordInput(),
required=False)
password_2 = forms.CharField(label=_('Vuelve a introducir la contraseña'),
......@@ -441,7 +441,11 @@ class EditEmailForm(GenericForm):
raise forms.ValidationError(
_("Parece que uno de los correos que has introducido no es válido.")
)
forward_active = self.cleaned_data.get("forwardActive")
if (forward_active and not maildrop):
raise forms.ValidationError(
_("Si activas el reenvío automático tienes que insertar almenos una cuenta de destino.")
)
def __init__(self, *args, **kwargs):
super(EditEmailForm,self).__init__(*args, **kwargs)
......@@ -584,8 +588,8 @@ class SuperuserForm(GenericForm):
""" Form to edit superuser account """
username = forms.CharField(label=_('Nombre de usuario no editable (Para autenticación SFTP/SSH)'), required=True)
name = forms.CharField(label=_('Nombre'), required=False)
surname = forms.CharField(label=_('Apellidos'), required=False)
name = forms.CharField(label=_('Nombre'), required=True)
surname = forms.CharField(label=_('Apellidos'), required=True)
email = forms.EmailField(label=_('Correo electrónico'), required=True,
help_text=_("Introduce un correo electrónico válido. "
"Este campo se autocompletará con correos existentes en el sistema. "
......
......@@ -2,7 +2,7 @@
import datetime, time, random, os, urllib3, json, shutil, sys, hashlib, socket, re, psutil, binascii, certifi
from distutils.dir_util import copy_tree
# django
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import ugettext_lazy as _, get_language
from django.utils.encoding import force_bytes
from django.core.management import utils as django_management_utils
from django.core.mail import send_mail, EmailMessage, EmailMultiAlternatives
......@@ -1087,7 +1087,8 @@ def get_domain_deps_apps(request):
""" Cutsom method to get dependenvies from API, that have a domain dependency"""
release_info = {}
apps_with_domain = []
lang = '_' + get_language()
all_services = []
if settings.NO_API:
release_info = debug.RELEASE
puppet_status = debug.STATUS
......@@ -1095,8 +1096,15 @@ def get_domain_deps_apps(request):
release_info = get_release_info(request)
try:
if 'groups' in release_info:
# Groups have language termination in API
# Need to remove it in oreder to retun neutral groups, valid for all languages
# Get all available services, installed or not
all_services = release_info.get('groups')
#all_services = release_info.get('groups')
alllang_available_services = release_info.get('groups')
for serv in alllang_available_services:
if serv['id'].endswith(lang):
serv.update({'id': serv['id'][:-3]})
all_services.append(serv)
apps_with_domain = [service['id'] for service in all_services if "dependencies" in service and any("domain" in s for s in service['dependencies'])]
except Exception as e:
p("ServicesAvailable view", "✕ There was a problem retrieving enabled services", e)
......
......@@ -7,7 +7,7 @@ from django.http import HttpResponseRedirect, HttpResponse
from django.views.generic.edit import FormView
from django.urls import reverse_lazy, reverse
from django.utils.encoding import force_bytes
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import ugettext_lazy as _, get_language
from django.contrib import messages
# contrib
from ldap3 import HASHED_SALTED_SHA
......@@ -31,15 +31,24 @@ class AppSettings(FormView):
inputdeps = []
maintenance = False
appid=None
try:
lang = '_' + get_language()
except:
lang = '_es'
def get_success_url(self):
"""Returns the URL to redirect user after a succesful submit"""
return self.request.get_full_path()
def get(self, request, **kwargs):
self.appid = self.kwargs.get('appid', None)
try:
lang = '_' + get_language()
except:
lang = '_es'
self.groupname = self.kwargs.get('appid', None)
self.appid = self.groupname + lang
data = get_input_deps_fields(request, self.appid)
self.inputdeps = data['inputdeps']
self.inputdeps = data.get('inputdeps', None)
self.maintenance = data['maintenance']
appname = data['appname']
self.appname = appname[0]
......@@ -67,8 +76,7 @@ class AppSettings(FormView):
""" Populate dynamic dependencies form fields with vañues from ldap """
for deps in self.inputdeps:
# Get a lis of all input fields
print('dep: %s' % deps['id'])
dn = 'ou=%s,ou=%s,%s' % (deps['id'], self.appid, settings.LDAP_TREE_SERVICES);
dn = 'ou=%s,ou=%s,%s' % (deps['id'], self.groupname, settings.LDAP_TREE_SERVICES);
self.request.ldap.search(
dn,
"(objectclass=*)",
......
......@@ -158,7 +158,7 @@ class EditDomainView(FormView):
webmaster = form['webmaster'].value()
mail = form['mail_server'].value()
dkim = bool(form['dkim'].value())
old_dkim = form['old_dkim'].value()
old_dkim = utils.ldap_val(form['old_dkim'].value())
try:
self.request.ldap.modify(dn, {
......@@ -170,7 +170,6 @@ class EditDomainView(FormView):
messages.error(self.request, _('Ha habido un error modificando el dominio. '
'Si el problema persiste contacta '
'con los administrador-s'))
if dkim != old_dkim:
if dkim:
utils.add_dkim(self.request.ldap, self.domain_name)
......
......@@ -165,20 +165,26 @@ class MailAccount(FormView):
def get_form_kwargs(self):
"""Return the keyword arguments for instantiating the form."""
kwargs = super().get_form_kwargs()
try:
account = self.request.ldap.entries[0]
kwargs['initial'] = { k : utils.ldap_val(account[k].value) for k in self.ldap_attributes }
return kwargs
except Exception as e:
messages.error(self.request, _('La cuenta de correo %s no existe' % self.mail_account))
def get_form(self):
"""Return an instance of the form to be used in this view."""
domain = self.mail_account.split('@')[1]
dn='mail=%s,vd=%s,%s' % (self.mail_account,domain,settings.LDAP_TREE_HOSTING)
try:
self.request.ldap.search(
settings.LDAP_TREE_BASE,
'(mail=%s)' % self.mail_account,
dn,
'(objectClass=VirtualMailAccount)',
attributes = self.ldap_attributes
)
except Exception as e:
print(e)
messages.error(self.request, _('La cuenta de correo %s no existe' % self.mail_account))
return EditEmailForm(**self.get_form_kwargs())
def form_valid(self, form):
......@@ -196,7 +202,8 @@ class MailAccount(FormView):
'maildrop' : form['maildrop'].value(),
'vacationactive' : utils.ldap_bool( form['vacationActive'].value() ),
'vacationinfo' : form['vacationinfo'].value(),
'otherTransport' : "gnarwl:%s" % domain
'otherTransport' : "gnarwl:%s" % domain,
'mailautoreply' : self.mail_account+'.autoreply'
}
if password:
new_values['userpassword'] = hashed(HASHED_SALTED_SHA, password)
......
......@@ -662,7 +662,7 @@ class SuperUser(FormView):
email = form['email'].value()
password = form['password'].value()
# Always give superuser cron and sshd autorization
services = ['cron', 'sshd']
services = ['cron', 'sshd', 'sudo']
for service in ['openvpn', 'apache']:
if service in form.fields and form[service].value():
services.append(service)
......
......@@ -65,7 +65,7 @@ function httpGetAsync(theUrl)
//setTimeout(httpGetAsync(theUrl), 5000);
/* After old fqdn is not available anymore, wait befor showing link to new login
*/
sleep(2000);
sleep(5400);
loginform.classList.toggle("hide");
updatingform.className += " hide";
}
......
......@@ -26,7 +26,7 @@
{% trans 'Una tarea de Mantenimiento o Actualización está pendiente.' %}
</h3>
<p>{% trans 'Es necesario aplicar los cambios para que la actualización se complete.' %}</p>
<button data-launch-modal="#modal-update">
<button class="update-button" data-launch-modal="#modal-update">
{% trans 'Aplicar cambios' %}
</button>
{% elif status == 'no-updates' or status == 'last-update' %}
......
......@@ -16,14 +16,14 @@
{% cookie 'newDomain' %}
<div class="form-login hide" id="form-ready">
<h3>{% trans 'Proceso en curso' %}</h3>
<p>{% trans 'Se está confgurando la nueva página de acceso. Aceede a ella para poder entrar en el Panel de Control en cuanto el proceso esté terminado.' %}</p>
<p>{% trans 'Se está confgurando la nueva página de acceso. En unos minutos recibirás el correo de confirmación. El nuevo Panel de Control será accesible en la siguiente dirección en cuanto el proceso esté terminado.' %}</p>
<a class="form-login__fqdn-link" href="https://{% cookie 'newDomain' %}{{ path }}">
https://{% cookie 'newDomain' %}{{ path }}
</a>
</div>
<div id="form-updating" class="form-login hide">
<h3>{% trans 'Actualizando el sistema..' %}</h3>
<p>{% trans 'Esta operación tardará unos minutos. En breve aparecerá el nuevo enlace de acceso al Panel de Control.' %}</p>
<p>{% trans 'Esta operación tardará unos minutos. En cuanto el proceso termine recibirás un correo elctrónico de confirmación con la nueva dirección de acceso.' %}</p>
</div>
{% endblock %}
......
......@@ -27,6 +27,7 @@
<div id="form-updating" class="form-login hide">
<h3>{% trans 'Actualizando el sistema..' %}</h3>
<p>{% trans 'Esta operación tardará unos minutos. En cuanto el sistema esté actualizado aparecerá el formulario para volver a acceder al Panel de Control.' %}</p>
<img class="loading--login" src="{% img 'loading_bajo.gif' %}" />
</div>
{% endblock %}
......