From 5bfde5742cb58d6a6611dccfeeb34367f1f6167a Mon Sep 17 00:00:00 2001 From: Valentin Samir Date: Wed, 12 Feb 2014 21:48:42 +0100 Subject: [PATCH] =?UTF-8?q?[https://jabber.crans.org]=20Mise=20=C3=A0=20jo?= =?UTF-8?q?ur=20des=20scripts=20cgi?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- jabber/lostPassword.py | 11 +++++++---- jabber/register.py | 6 +++--- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/jabber/lostPassword.py b/jabber/lostPassword.py index a13e34f2..d83787a8 100755 --- a/jabber/lostPassword.py +++ b/jabber/lostPassword.py @@ -25,7 +25,10 @@ form = cgi.FieldStorage() print "content-type: text/html" print erreur = '' -host = os.environ['REMOTE_HOST'] +try: + host = os.environ['REMOTE_HOST'] +except KeyError: + host = os.environ['REMOTE_ADDR'] html = open('/var/www/jabber/template').read() new_password_form = open('./templates/new_password_form.tpl').read() await_new_password = open('./templates/await_new_password.tpl').read() @@ -61,8 +64,8 @@ except : # si ce n'est pas passé : on a pas reçu le formulaire if user and mail: r, msg = commands.getstatusoutput('/usr/sbin/ejabberdctl %s%s%s' % - ('vcard-get', commands.mkarg(user), - ' jabber.crans.org EMAIL USERID')) + ('get_vcard', commands.mkarg(user), + ' jabber.crans.org EMAIL')) try: # Paranoia : on loggue @@ -74,7 +77,7 @@ if user and mail: if r == 0 and msg == mail: fn = commands.getoutput('/usr/sbin/ejabberdctl %s%s%s' % - ('vcard-get', commands.mkarg(user), + ('get_vcard', commands.mkarg(user), ' jabber.crans.org FN')) fonctions.sendmail(mail_template % locals()) diff --git a/jabber/register.py b/jabber/register.py index ff9a91cc..c635455f 100755 --- a/jabber/register.py +++ b/jabber/register.py @@ -104,14 +104,14 @@ if user and password and nom and prenom and mail: if r == 0: r, msg = commands.getstatusoutput('/usr/sbin/ejabberdctl %s%s%s%s' % - ('vcard-set', commands.mkarg(user), - ' jabber.crans.org EMAIL USERID', + ('set_vcard', commands.mkarg(user), + ' jabber.crans.org EMAIL', commands.mkarg(mail))) if r and msg: page += '

ejabberdctl : %s

' % msg r, msg = commands.getstatusoutput('/usr/sbin/ejabberdctl %s%s%s%s' % - ('vcard-set', commands.mkarg(user), + ('set_vcard', commands.mkarg(user), ' jabber.crans.org FN', commands.mkarg('%s %s' % (prenom,nom)))) if r and msg: