mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-11-23 11:53:12 +00:00
Merge branch 'commentaires' into 'master'
Commentaires See merge request federez/re2o!67
This commit is contained in:
commit
891014babd
3 changed files with 74 additions and 18 deletions
|
@ -28,14 +28,22 @@ setup_ldap() {
|
|||
|
||||
|
||||
install_re2o_server() {
|
||||
echo "Installation de Re2o !
|
||||
Cet utilitaire va procéder à l'installation initiale de re2o. Le serveur présent doit être vierge.
|
||||
Preconfiguration..."
|
||||
|
||||
|
||||
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
apt-get -y install sudo dialog
|
||||
|
||||
HEIGHT=15
|
||||
WIDTH=40
|
||||
init=$(dialog --clear \
|
||||
--title "Installation de Re2o !" \
|
||||
--msgbox "Cet utilitaire va procéder à l'installation initiale de re2o. Le serveur présent doit être vierge de préférence. Preconfiguration..." \
|
||||
$HEIGHT $WIDTH \
|
||||
2>&1 >/dev/tty)
|
||||
|
||||
|
||||
HEIGHT=15
|
||||
WIDTH=40
|
||||
CHOICE_HEIGHT=4
|
||||
|
@ -145,7 +153,14 @@ ldap_is_local=$(dialog --clear \
|
|||
"${OPTIONS[@]}" \
|
||||
2>&1 >/dev/tty)
|
||||
|
||||
echo "Vous devrez fournir un login/host dans le cas où le ldap est non local"
|
||||
|
||||
HEIGHT=15
|
||||
WIDTH=40
|
||||
instal_ldap=$(dialog --clear \
|
||||
--title "Installation de Re2o !" \
|
||||
--msgbox "Vous devrez fournir un login/host dans le cas où le ldap est non local" \
|
||||
$HEIGHT $WIDTH \
|
||||
2>&1 >/dev/tty)
|
||||
|
||||
TITLE="Mot de passe ldap"
|
||||
ldap_password=$(dialog --title "$TITLE" \
|
||||
|
@ -213,8 +228,14 @@ ldap_cn+=$ldap_dn
|
|||
ldap_host="localhost"
|
||||
fi
|
||||
|
||||
HEIGHT=15
|
||||
WIDTH=40
|
||||
install_base=$(dialog --clear \
|
||||
--title "Installation de Re2o !" \
|
||||
--msgbox "Installation des paquets de base" \
|
||||
$HEIGHT $WIDTH \
|
||||
2>&1 >/dev/tty)
|
||||
|
||||
echo "Installation des paquets de base"
|
||||
apt-get -y install python3-django python3-dateutil texlive-latex-base texlive-fonts-recommended python3-djangorestframework python3-django-reversion python3-pip libsasl2-dev libldap2-dev libssl-dev
|
||||
pip3 install django-bootstrap3
|
||||
pip3 install django-ldapdb
|
||||
|
@ -270,8 +291,14 @@ then
|
|||
setup_ldap $ldap_password $ldap_dn
|
||||
|
||||
else
|
||||
echo "Vous devrez manuellement effectuer les opérations de setup de la base ldap sur le serveurs distant.
|
||||
Lancez la commande : ./install_re2o.sh ldap $ldap_password $ldap_dn"
|
||||
|
||||
HEIGHT=15
|
||||
WIDTH=40
|
||||
ldap_setup=$(dialog --clear \
|
||||
--title "Setup ldap" \
|
||||
--msgbox "Vous devrez manuellement effectuer les opérations de setup de la base ldap sur le serveurs distant. Lancez la commande : ./install_re2o.sh ldap $ldap_password $ldap_dn" \
|
||||
$HEIGHT $WIDTH \
|
||||
2>&1 >/dev/tty)
|
||||
fi
|
||||
|
||||
echo "Ecriture de settings_local"
|
||||
|
@ -298,10 +325,22 @@ sed -i 's/example.org/'"$extension_locale"'/g' re2o/settings_local.py
|
|||
sed -i 's/MY_EMAIL_HOST/'"$email_host"'/g' re2o/settings_local.py
|
||||
sed -i 's/MY_EMAIL_PORT/'"$email_port"'/g' re2o/settings_local.py
|
||||
|
||||
echo "Application des migrations"
|
||||
HEIGHT=15
|
||||
WIDTH=40
|
||||
migrations=$(dialog --clear \
|
||||
--title "Setup django" \
|
||||
--msgbox "Application des migrations" \
|
||||
$HEIGHT $WIDTH \
|
||||
2>&1 >/dev/tty)
|
||||
python3 manage.py migrate
|
||||
|
||||
echo "Collecte des statics"
|
||||
HEIGHT=15
|
||||
WIDTH=40
|
||||
static=$(dialog --clear \
|
||||
--title "Setup django" \
|
||||
--msgbox "Collecte des statiques" \
|
||||
$HEIGHT $WIDTH \
|
||||
2>&1 >/dev/tty)
|
||||
python3 manage.py collectstatic
|
||||
|
||||
BACKTITLE="Fin de l'installation"
|
||||
|
@ -319,7 +358,7 @@ web_serveur=$(dialog --clear \
|
|||
|
||||
clear
|
||||
|
||||
TITLE="Url où servir le serveur web (ex : re2o.example.org)"
|
||||
TITLE="Url où servir le serveur web (ex : re2o.example.org). Assurez-vous que ce tld existe bien et répond auprès du DNS"
|
||||
url_server=$(dialog --title "$TITLE" \
|
||||
--backtitle "$BACKTITLE" \
|
||||
--inputbox "$TITLE" $HEIGHT $WIDTH \
|
||||
|
@ -365,11 +404,25 @@ sed -i 's|PATH|'"$current_path"'|g' /etc/apache2/sites-available/re2o.conf
|
|||
a2ensite re2o
|
||||
service apache2 reload
|
||||
else
|
||||
echo "Nginx non supporté, vous devrez installer manuellement"
|
||||
HEIGHT=15
|
||||
WIDTH=40
|
||||
web_server=$(dialog --clear \
|
||||
--title "Setup serveur web" \
|
||||
--msgbox "Nginx non supporté, vous devrez installer manuellement" \
|
||||
$HEIGHT $WIDTH \
|
||||
2>&1 >/dev/tty)
|
||||
|
||||
fi
|
||||
|
||||
python3 manage.py createsuperuser
|
||||
|
||||
HEIGHT=15
|
||||
WIDTH=40
|
||||
end=$(dialog --clear \
|
||||
--title "Installation terminée" \
|
||||
--msgbox "Vous pouvez à présent vous rendre sur $url_server, et vous connecter. Votre utilisateur dispose des privilèges superuser" \
|
||||
$HEIGHT $WIDTH \
|
||||
2>&1 >/dev/tty)
|
||||
}
|
||||
|
||||
main_function() {
|
||||
|
|
|
@ -53,12 +53,12 @@ DATABASES = {
|
|||
}
|
||||
}
|
||||
|
||||
# Security settings
|
||||
SECURE_CONTENT_TYPE_NOSNIFF = True
|
||||
SECURE_BROWSER_XSS_FILTER = True
|
||||
SESSION_COOKIE_SECURE = True
|
||||
CSRF_COOKIE_SECURE = True
|
||||
CSRF_COOKIE_HTTPONLY = True
|
||||
# Security settings, à activer une fois https en place
|
||||
SECURE_CONTENT_TYPE_NOSNIFF = False
|
||||
SECURE_BROWSER_XSS_FILTER = False
|
||||
SESSION_COOKIE_SECURE = False
|
||||
CSRF_COOKIE_SECURE = False
|
||||
CSRF_COOKIE_HTTPONLY = False
|
||||
X_FRAME_OPTIONS = 'DENY'
|
||||
SESSION_COOKIE_AGE = 60 * 60 * 3
|
||||
|
||||
|
|
|
@ -143,9 +143,10 @@ class UserManager(BaseUserManager):
|
|||
if not linux_user_check(pseudo):
|
||||
raise ValueError('Username shall only contain [a-z0-9-]')
|
||||
|
||||
user = self.model(
|
||||
user = Adherent(
|
||||
pseudo=pseudo,
|
||||
surname=surname,
|
||||
name=surname,
|
||||
email=self.normalize_email(email),
|
||||
)
|
||||
|
||||
|
@ -824,6 +825,8 @@ class Adherent(User):
|
|||
null=True
|
||||
)
|
||||
|
||||
|
||||
|
||||
def get_instance(adherentid, *args, **kwargs):
|
||||
"""Try to find an instance of `Adherent` with the given id.
|
||||
|
||||
|
|
Loading…
Reference in a new issue