Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Benjamin Graillot
scripts
Commits
5810ffa5
Commit
5810ffa5
authored
Nov 02, 2013
by
Lucas Serrano
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[creer_compte_wiki] On renvoie un message et un code d'erreur
parent
699d2ca1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
7 deletions
+12
-7
wiki/creer_compte_wiki.py
wiki/creer_compte_wiki.py
+12
-7
No files found.
wiki/creer_compte_wiki.py
View file @
5810ffa5
...
...
@@ -56,15 +56,15 @@ def creer_compte(nom, mdp, email):
msg
=
MIMEText
(
bugreport
.
encode
(
encoding
)
%
form
,
'plain'
,
encoding
)
msg
[
'Subject'
]
=
"creer_compte_wiki.py: success"
send
(
msg
)
return
coul
(
u
"Compte %s cr avec succs !"
%
nom
,
"vert"
)
return
u
"Compte %s cr avec succs !"
%
nom
,
False
elif
'nonunique name'
in
data
:
return
coul
(
u
"Le compte %s existe dj !"
%
nom
,
"rouge"
)
return
u
"Le compte %s existe dj !"
%
nom
,
True
elif
'nonunique email'
in
data
:
return
coul
(
u
"L'adresse %s est dj utilise !"
%
email
,
"rouge"
)
return
u
"L'adresse %s est dj utilise !"
%
email
,
True
elif
'Password not acceptable: Password too short.'
in
data
:
return
coul
(
u
"Le mot de passe choisi est trop court"
,
"rouge"
)
return
u
"Le mot de passe choisi est trop court"
,
True
elif
'invalid name'
in
data
:
msg
=
coul
(
u
"Le nom d'utilisateur %s est invalide !"
%
nom
,
"rouge"
)
msg
=
u
"Le nom d'utilisateur %s est invalide !"
%
nom
msg
+=
u
"""
Le nom d'utilisateur doit tre un WikiNom, voir ce sujet :
http://wiki.crans.org/NomWiki
...
...
@@ -72,7 +72,7 @@ Il peut contenir n'importe quel caract
ventuellement un espace facultatif entre chaque mot. Il peut aussi
contenir des accents, mais assurez-vous que votre terminal est
correctement configur (en %s)."""
%
(
locale
.
getdefaultlocale
()[
1
])
return
msg
return
msg
,
True
else
:
html
=
MIMEBase
(
'text'
,
'html'
)
html
.
set_payload
(
data
)
...
...
@@ -96,7 +96,12 @@ if __name__ == '__main__':
else
:
cprint
(
u
"Les deux mots de passe sont diffrents, veuillez ressayer..."
,
"jaune"
)
email
=
prompt
(
"Adresse e-mail : "
)
print
creer_compte
(
nom
,
mdp
,
email
)
message
,
erreur
=
creer_compte
(
nom
,
mdp
,
email
)
if
erreur
:
print
coul
(
message
,
"rouge"
)
else
:
print
coul
(
message
,
"vert"
)
except
KeyboardInterrupt
:
print
"Interruption par l'utilisateur."
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment