Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(2845)

Delta Between Two Patch Sets: MoinMoin/user.py

Issue 10688044: Generalized version of create_user() (Closed)
Left Patch Set: Better docs Created 11 years, 9 months ago
Right Patch Set: Created 11 years, 9 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « no previous file | no next file » | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 # Copyright: 2000-2004 Juergen Hermann <jh@web.de> 1 # Copyright: 2000-2004 Juergen Hermann <jh@web.de>
2 # Copyright: 2003-2013 MoinMoin:ThomasWaldmann 2 # Copyright: 2003-2013 MoinMoin:ThomasWaldmann
3 # Copyright: 2007 MoinMoin:JohannesBerg 3 # Copyright: 2007 MoinMoin:JohannesBerg
4 # Copyright: 2007 MoinMoin:HeinrichWendel 4 # Copyright: 2007 MoinMoin:HeinrichWendel
5 # Copyright: 2008 MoinMoin:ChristopherDenter 5 # Copyright: 2008 MoinMoin:ChristopherDenter
6 # Copyright: 2010 MoinMoin:DiogenesAugusto 6 # Copyright: 2010 MoinMoin:DiogenesAugusto
7 # License: GNU GPL v2 (or any later version), see LICENSE.txt for details. 7 # License: GNU GPL v2 (or any later version), see LICENSE.txt for details.
8 8
9 """ 9 """
10 MoinMoin - User Accounts 10 MoinMoin - User Accounts
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 48
49 def create_user(username, password, email, validate=True, is_encrypted=False, ** meta): 49 def create_user(username, password, email, validate=True, is_encrypted=False, ** meta):
50 """ 50 """
51 Create a new user 51 Create a new user
52 52
53 :param username: unique user name 53 :param username: unique user name
54 :param password: user's password - see also is_encrypted param 54 :param password: user's password - see also is_encrypted param
55 :param email: unique email address 55 :param email: unique email address
56 :param validate: if True (default) will validate username, password, email 56 :param validate: if True (default) will validate username, password, email
57 and the uniqueness of the user created 57 and the uniqueness of the user created
58 :param is_encrypted: when False (default) defines that the password is in 58 :param is_encrypted: if False (default) defines that the password is in
Thomas.J.Waldmann 2013/06/28 15:43:41 if False...
59 plaintext, when True - password was already encrypted 59 plaintext, when True - password was already encrypted
60 :param meta: a dictionary of key-value pairs that represent user metadata an d 60 :param meta: a dictionary of key-value pairs that represent user metadata an d
61 will be stored to user profile metadata 61 will be stored into user profile metadata
Thomas.J.Waldmann 2013/06/28 15:43:41 into
62 """ 62 """
63 theuser = User(auth_method="new-user") 63 theuser = User(auth_method="new-user")
64 64
65 # Don't allow creating users with invalid names 65 # Don't allow creating users with invalid names
66 if validate and not isValidName(username): 66 if validate and not isValidName(username):
67 return _("""Invalid user name '%(name)s'. 67 return _("""Invalid user name '%(name)s'.
68 Name may contain any Unicode alpha numeric character, with optional one 68 Name may contain any Unicode alpha numeric character, with optional one
69 space between words. Group page name is not allowed.""", name=username) 69 space between words. Group page name is not allowed.""", name=username)
70 70
71 # Name required to be unique. Check if name belong to another user. 71 # Name required to be unique. Check if name belong to another user.
(...skipping 721 matching lines...) Expand 10 before | Expand all | Expand 10 after
793 """ Mail a user a link to verify his email address. """ 793 """ Mail a user a link to verify his email address. """
794 token = self.generate_recovery_token() 794 token = self.generate_recovery_token()
795 795
796 link = url_for('frontend.verifyemail', username=self.name0, token=token, _external=True) 796 link = url_for('frontend.verifyemail', username=self.name0, token=token, _external=True)
797 text = render_template('mail/account_verification.txt', link=link) 797 text = render_template('mail/account_verification.txt', link=link)
798 798
799 subject = _('[%(sitename)s] Please verify your email address', 799 subject = _('[%(sitename)s] Please verify your email address',
800 sitename=self._cfg.sitename or "Wiki") 800 sitename=self._cfg.sitename or "Wiki")
801 mailok, msg = sendmail.sendmail(subject, text, to=[self.email], mail_fro m=self._cfg.mail_from) 801 mailok, msg = sendmail.sendmail(subject, text, to=[self.email], mail_fro m=self._cfg.mail_from)
802 return mailok, msg 802 return mailok, msg
LEFTRIGHT
« no previous file | no next file » | Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Toggle Comments ('s')

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b