Commit d9191343 authored by Valentin Samir's avatar Valentin Samir

[wiki/action/crans_newaccount,wiki/creer_compte_wiki] Petites modifications...

[wiki/action/crans_newaccount,wiki/creer_compte_wiki] Petites modifications pour pouvoir créer des comptes depuis l'intranet2
parent 89adc33b
......@@ -24,6 +24,7 @@ def do_register(request):
authorized_ips = [
'2a01:240:fe3d:4:2248cff:fe44:3b70', #vo.v6
'2a01:240:fe3d:4:219:bbff:fe3c:4f76', #zamok.v6
'2a01:240:fe3d:4:0:6cff:fe69:6921', #o2.v6
]
if request.remote_addr not in authorized_ips:
......
......@@ -29,7 +29,7 @@ encoding = "utf-8"
# Utilisateur qui lance le script
user = getuser()
def send(msg):
def send(msg, user=user):
msg['From'] = '%s@crans.org' % user
msg['To'] = ','.join(bugmail)
msg['User-Agent'] = 'creer_compte_wiki.py'
......@@ -38,7 +38,7 @@ def send(msg):
smtp.sendmail('%s@crans.org' % user, bugmail, msg.as_string())
smtp.quit()
def creer_compte(nom, mdp, email):
def creer_compte(nom, mdp, email, user=user):
form = {'action': 'crans_newaccount',
'name': nom.encode(encoding),
'password': mdp,
......@@ -55,7 +55,7 @@ def creer_compte(nom, mdp, email):
if 'created' in data:
msg = MIMEText(bugreport.encode(encoding) % form, 'plain', encoding)
msg['Subject'] = "creer_compte_wiki.py: success"
send(msg)
send(msg, user)
return u"Compte %s cr avec succs !" % nom, False
elif 'nonunique name' in data:
return u"Le compte %s existe dj !" % nom, True
......@@ -82,7 +82,7 @@ correctement configur
msg['Subject'] = '[Bugreport] creer_compte_wiki.py: creer_compte'
msg.attach(txt)
msg.attach(html)
send(msg)
send(msg, user)
return coul(u"Erreur inconnue\n", "rouge") + \
u"Un rapport de bug a t automatiquement envoy. Ressayez plus tard."
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment