Skip to content
This repository was archived by the owner on Apr 17, 2018. It is now read-only.
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Removed unnecessary Account commit.
Changed minimum real name length to 1 character.
  • Loading branch information
PotatoDumplings committed Jul 26, 2014
commit 2dff67ed9539fa9eef6291529a4d58669dbaf20d
1 change: 0 additions & 1 deletion r2/r2/controllers/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -611,7 +611,6 @@ def POST_update(self, res, email, curpass, realname, password, newpass, verpass)
elif email and (not hasattr(c.user,'email')
or c.user.email != email):
c.user.email = email
c.user._commit()
self.send_confirmation()
res._update('status',
innerHTML=_('Your email has been updated. You will have to confirm before commenting or posting.'))
Expand Down
4 changes: 2 additions & 2 deletions r2/r2/controllers/validator/validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -601,7 +601,7 @@ def run(self, user_name):
except NotFound:
return user_name

realname_rx = re.compile(ur"^[\w\s\-]{3,40}$", re.UNICODE)
realname_rx = re.compile(ur"^[\w\s\-]{1,40}$", re.UNICODE)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this needs to be compiled and run every time, but if it must I'd call it realname_re for consistency with the re module.


def chkrealname(x):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't match the pattern for function names in this codebase. Can you change it to (say) check_real_name?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, these should be methods on the validator object.

try:
Expand All @@ -614,7 +614,7 @@ def chkrealname(x):
def whyrealnamebad(x):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would fold this stuff into (what will be called) check_real_name() and have it return the error message.

if not x:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Under what circumstances does not x evaluate to True, and will this be triggered by accident if the user doen't put anything in the name field?

return errors.BAD_REALNAME_CHARS
if len(x)<3:
if len(x)<1:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Per the above comments re:removing lower length limit, this could go away.

return errors.BAD_REALNAME_SHORT
if len(x)>40:
return errors.BAD_REALNAME_LONG
Expand Down