scragg0x / realms-wiki

Git based wiki inspired by Gollum
http://realms.io
GNU General Public License v2.0
831 stars 90 forks source link

Errors when editing with ALLOW_ANON=false #33

Closed ghtyrant closed 9 years ago

ghtyrant commented 9 years ago

Hey!

When editing/creating pages as a registered user in a realms-wiki with ALLOW_ANON set to false, publishing will always fail with "Anonymous posting not allowed".

In realms/modules/wiki/views.py, line 39 and 113 you do:

    if not current_app.config.get('ALLOW_ANON') and current_user.is_anonymous: 
      return dict(error=True, message="Anonymous posting not allowed"), 403

current_user.is_anonymous is a method, not a property, this statement will always be True if ALLOW_ANON is False. adding parentheses helps.

    if not current_app.config.get('ALLOW_ANON') and current_user.is_anonymous(): 
      return dict(error=True, message="Anonymous posting not allowed"), 403