[wiki/action/crans_newaccount,wiki/creer_compte_wiki] Petites modifications pour pouvoir créer des comptes depuis l'intranet2
This commit is contained in:
parent
89adc33b29
commit
d919134329
2 changed files with 5 additions and 4 deletions
|
@ -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 succès !" % nom, False
|
||||
elif 'nonunique name' in data:
|
||||
return u"Le compte %s existe déjà !" % 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é. Réessayez plus tard."
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue