[https://jabber.crans.org] Mise à jour des scripts cgi

This commit is contained in:
Valentin Samir 2014-02-12 21:48:42 +01:00
parent b34aae5cb9
commit 5bfde5742c
2 changed files with 10 additions and 7 deletions

View file

@ -25,7 +25,10 @@ form = cgi.FieldStorage()
print "content-type: text/html" print "content-type: text/html"
print print
erreur = '' erreur = ''
try:
host = os.environ['REMOTE_HOST'] host = os.environ['REMOTE_HOST']
except KeyError:
host = os.environ['REMOTE_ADDR']
html = open('/var/www/jabber/template').read() html = open('/var/www/jabber/template').read()
new_password_form = open('./templates/new_password_form.tpl').read() new_password_form = open('./templates/new_password_form.tpl').read()
await_new_password = open('./templates/await_new_password.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: if user and mail:
r, msg = commands.getstatusoutput('/usr/sbin/ejabberdctl %s%s%s' % r, msg = commands.getstatusoutput('/usr/sbin/ejabberdctl %s%s%s' %
('vcard-get', commands.mkarg(user), ('get_vcard', commands.mkarg(user),
' jabber.crans.org EMAIL USERID')) ' jabber.crans.org EMAIL'))
try: try:
# Paranoia : on loggue # Paranoia : on loggue
@ -74,7 +77,7 @@ if user and mail:
if r == 0 and msg == mail: if r == 0 and msg == mail:
fn = commands.getoutput('/usr/sbin/ejabberdctl %s%s%s' % fn = commands.getoutput('/usr/sbin/ejabberdctl %s%s%s' %
('vcard-get', commands.mkarg(user), ('get_vcard', commands.mkarg(user),
' jabber.crans.org FN')) ' jabber.crans.org FN'))
fonctions.sendmail(mail_template % locals()) fonctions.sendmail(mail_template % locals())

View file

@ -104,14 +104,14 @@ if user and password and nom and prenom and mail:
if r == 0: if r == 0:
r, msg = commands.getstatusoutput('/usr/sbin/ejabberdctl %s%s%s%s' % r, msg = commands.getstatusoutput('/usr/sbin/ejabberdctl %s%s%s%s' %
('vcard-set', commands.mkarg(user), ('set_vcard', commands.mkarg(user),
' jabber.crans.org EMAIL USERID', ' jabber.crans.org EMAIL',
commands.mkarg(mail))) commands.mkarg(mail)))
if r and msg: if r and msg:
page += '<p><b>ejabberdctl&nbsp:</b> %s</p>' % msg page += '<p><b>ejabberdctl&nbsp:</b> %s</p>' % msg
r, msg = commands.getstatusoutput('/usr/sbin/ejabberdctl %s%s%s%s' % 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', ' jabber.crans.org FN',
commands.mkarg('%s %s' % (prenom,nom)))) commands.mkarg('%s %s' % (prenom,nom))))
if r and msg: if r and msg: