Skip to content

Commit

Permalink
Merge branch 'release/1.3.4'
Browse files Browse the repository at this point in the history
  • Loading branch information
Kwpolska committed Aug 8, 2015
2 parents fa29d1f + f9b3b0e commit 6dcea4d
Show file tree
Hide file tree
Showing 17 changed files with 89 additions and 22 deletions.
3 changes: 1 addition & 2 deletions .pypt/README.rst
Expand Up @@ -4,9 +4,8 @@ Python Project Template. INSERT TAGLINE HERE.™
:Info: This is the README file for the Python Project Template. :Info: This is the README file for the Python Project Template.
:Author: Chris Warrick <chris@chriswarrick.com> :Author: Chris Warrick <chris@chriswarrick.com>
:Copyright: © 2013-2015, Chris Warrick. :Copyright: © 2013-2015, Chris Warrick.
:License: BSD (see /LICENSE or :doc:`Appendix B <LICENSE>`.)
:Date: 2015-07-03 :Date: 2015-07-03
:Version: 1.3.0 :Version: 1.3.1


.. index: README .. index: README
.. image:: https://travis-ci.org/Kwpolska/python-project-template.png?branch=master .. image:: https://travis-ci.org/Kwpolska/python-project-template.png?branch=master
Expand Down
10 changes: 5 additions & 5 deletions .pypt/localegen
Expand Up @@ -45,18 +45,18 @@ case "$LOCALETYPE" in
sed '1,+17d' ./messages.pot > ./messages.pot.tmp sed '1,+17d' ./messages.pot > ./messages.pot.tmp


pot='# '$PROJECT' pot file. pot='# '$PROJECT' pot file.
# Copyright © 2015, Chris Warrick. # Copyright © {{ cookiecutter.year }}, {{ cookiecutter.full_name }}.
# This file is distributed under the same license as the '$PROJECT' package. # This file is distributed under the same license as the '$PROJECT' package.
# Chris Warrick <chris@chriswarrick.com>, 2015. # {{ cookiecutter.real_name }} <{{ cookiecutter.email }}>, {{ cookiecutter.year }}.
# #
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: #version\\n" "Project-Id-Version: #version\\n"
"Report-Msgid-Bugs-To: Chris Warrick <chris@chriswarrick.com>\\n" "Report-Msgid-Bugs-To: {{ cookiecutter.real_name }} <{{ cookiecutter.email }}>\\n"
"POT-Creation-Date: #datel\\n" "POT-Creation-Date: #datel\\n"
"PO-Revision-Date: #datel\\n" "PO-Revision-Date: #datel\\n"
"Last-Translator: Chris Warrick <chris@chriswarrick.com>\\n" "Last-Translator: {{ cookiecutter.real_name }} <{{ cookiecutter.email }}>\\n"
"Language-Team: Chris Warrick <chris@chriswarrick.com>\\n" "Language-Team: {{ cookiecutter.real_name }} <{{ cookiecutter.email }}>\\n"
"Language: en\\n" "Language: en\\n"
"MIME-Version: 1.0\\n" "MIME-Version: 1.0\\n"
"Content-Type: text/plain; charset=UTF-8\\n" "Content-Type: text/plain; charset=UTF-8\\n"
Expand Down
2 changes: 1 addition & 1 deletion .venv
@@ -1 +1 @@
nikola-py2 nikola-py3
7 changes: 6 additions & 1 deletion CHANGELOG.rst
Expand Up @@ -2,7 +2,12 @@
Appendix A. Changelog Appendix A. Changelog
===================== =====================


:Version: 1.3.3 :Version: 1.3.4

1.3.4
* Link to demo site in documentation
* Support reCAPTCHA for logins (for demo site)
* Support preventing some users from editing the site (for demo site)


1.3.3 1.3.3
Remove yesterday’s new options. Please do not use v1.3.2. Remove yesterday’s new options. Please do not use v1.3.2.
Expand Down
4 changes: 2 additions & 2 deletions CONTRIBUTING.rst
Expand Up @@ -5,8 +5,8 @@ Appendix A. Contribution rules
:Author: Chris Warrick <chris@chriswarrick.com> :Author: Chris Warrick <chris@chriswarrick.com>
:Copyright: © 2015, Chris Warrick. :Copyright: © 2015, Chris Warrick.
:License: BSD (see /LICENSE or :doc:`Appendix B <LICENSE>`.) :License: BSD (see /LICENSE or :doc:`Appendix B <LICENSE>`.)
:Date: 2015-07-03 :Date: 2015-08-08
:Version: 1.3.3 :Version: 1.3.4


.. index:: contributing .. index:: contributing


Expand Down
2 changes: 1 addition & 1 deletion coil/__init__.py
Expand Up @@ -29,4 +29,4 @@


__all__ = ['__version__'] __all__ = ['__version__']


__version__ = '1.3.3' __version__ = '1.3.4'
9 changes: 9 additions & 0 deletions coil/data/templates/jinja/coil_login.tmpl
@@ -1,5 +1,11 @@
{# -*- coding: utf-8 -*- #} {# -*- coding: utf-8 -*- #}
{% extends 'base.tmpl' %} {% extends 'base.tmpl' %}
{% block extra_head %}
{{ super() }}
{% if captcha['enabled'] %}
<script src='https://www.google.com/recaptcha/api.js'></script>
{% endif %}
{% endblock %}
{% block content %} {% block content %}
{% if alert %} {% if alert %}
<div class="alert alert-{{ alert_status }}" role="alert">{{ alert }}</div> <div class="alert alert-{{ alert_status }}" role="alert">{{ alert }}</div>
Expand All @@ -11,6 +17,9 @@
<input name="username" type="text" id="inputUsername" class="form-control" placeholder="Username" required autofocus> <input name="username" type="text" id="inputUsername" class="form-control" placeholder="Username" required autofocus>
<label for="inputPassword" class="sr-only">Password</label> <label for="inputPassword" class="sr-only">Password</label>
<input name="password" type="password" id="inputPassword" class="form-control" placeholder="Password" required> <input name="password" type="password" id="inputPassword" class="form-control" placeholder="Password" required>
{% if captcha['enabled'] %}
<div class="g-recaptcha" data-sitekey="{{ captcha['site_key'] }}"></div>
{% endif %}
<div class="checkbox"> <div class="checkbox">
<label> <label>
<input type="checkbox" name="remember" value="remember"> Remember me <input type="checkbox" name="remember" value="remember"> Remember me
Expand Down
9 changes: 9 additions & 0 deletions coil/data/templates/mako/coil_login.tmpl
@@ -1,5 +1,11 @@
## -*- coding: utf-8 -*- ## -*- coding: utf-8 -*-
<%inherit file="base.tmpl"/> <%inherit file="base.tmpl"/>
<%block name="extra_head">
${parent.extra_head()}
% if captcha['enabled']:
<script src='https://www.google.com/recaptcha/api.js'></script>
% endif
</%block>
<%block name="content"> <%block name="content">
% if alert: % if alert:
<div class="alert alert-${alert_status}" role="alert">${alert}</div> <div class="alert alert-${alert_status}" role="alert">${alert}</div>
Expand All @@ -11,6 +17,9 @@
<input name="username" type="text" id="inputUsername" class="form-control" placeholder="Username" required autofocus> <input name="username" type="text" id="inputUsername" class="form-control" placeholder="Username" required autofocus>
<label for="inputPassword" class="sr-only">Password</label> <label for="inputPassword" class="sr-only">Password</label>
<input name="password" type="password" id="inputPassword" class="form-control" placeholder="Password" required> <input name="password" type="password" id="inputPassword" class="form-control" placeholder="Password" required>
% if captcha['enabled']:
<div class="g-recaptcha" data-sitekey="${captcha['site_key']}"></div>
% endif
<div class="checkbox"> <div class="checkbox">
<label> <label>
<input type="checkbox" name="remember" value="remember"> Remember me <input type="checkbox" name="remember" value="remember"> Remember me
Expand Down
26 changes: 24 additions & 2 deletions coil/web.py
Expand Up @@ -36,6 +36,7 @@
import redis import redis
import rq import rq
import operator import operator
import requests
import coil.tasks import coil.tasks
from nikola.utils import (unicode_str, get_logger, ColorfulStderrHandler, from nikola.utils import (unicode_str, get_logger, ColorfulStderrHandler,
write_metadata, TranslatableSetting) write_metadata, TranslatableSetting)
Expand Down Expand Up @@ -119,6 +120,10 @@ def configure_site():


app.secret_key = _site.config.get('COIL_SECRET_KEY') app.secret_key = _site.config.get('COIL_SECRET_KEY')
app.config['COIL_URL'] = _site.config.get('COIL_URL') app.config['COIL_URL'] = _site.config.get('COIL_URL')
app.config['COIL_LOGIN_CAPTCHA'] = _site.config.get(
'COIL_LOGIN_CAPTCHA',
{'enabled': False, 'site_key': '', 'secret_key': ''})
app.config['COIL_USERS_PREVENT_EDITING'] = _site.config.get('COIL_USERS_PREVENT_EDITING', [])
app.config['COIL_LIMITED'] = _site.config.get('COIL_LIMITED', False) app.config['COIL_LIMITED'] = _site.config.get('COIL_LIMITED', False)
app.config['REDIS_URL'] = _site.config.get('COIL_REDIS_URL', app.config['REDIS_URL'] = _site.config.get('COIL_REDIS_URL',
'redis://localhost:6379/0') 'redis://localhost:6379/0')
Expand Down Expand Up @@ -543,14 +548,28 @@ def login():
alert = None alert = None
alert_status = 'danger' alert_status = 'danger'
code = 200 code = 200
captcha = app.config['COIL_LOGIN_CAPTCHA']
form = LoginForm() form = LoginForm()
if request.method == 'POST': if request.method == 'POST':
if form.validate(): if form.validate():
user = find_user_by_name(request.form['username']) user = find_user_by_name(request.form['username'])
if not user: if not user:
alert = 'Invalid credentials.' alert = 'Invalid credentials.'
code = 401 code = 401
else: if captcha['enabled']:
r = requests.post('https://www.google.com/recaptcha/api/siteverify',
data={'secret': captcha['secret_key'],
'response': request.form['g-recaptcha-response'],
'remoteip': request.remote_addr})
if r.status_code != 200:
alert = 'Cannot check CAPTCHA response.'
code = 500
else:
rj = r.json()
if not rj['success']:
alert = 'Invalid CAPTCHA response. Please try again.'
code = 401
if code == 200:
try: try:
pwd_ok = check_password(user.password, pwd_ok = check_password(user.password,
request.form['password']) request.form['password'])
Expand Down Expand Up @@ -584,7 +603,8 @@ def login():
alert_status = 'success' alert_status = 'success'
return render('coil_login.tmpl', {'title': 'Login', 'alert': alert, 'form': return render('coil_login.tmpl', {'title': 'Login', 'alert': alert, 'form':
form, 'alert_status': alert_status, form, 'alert_status': alert_status,
'pwdchange_skip': True}, 'pwdchange_skip': True,
'captcha': captcha},
code) code)




Expand Down Expand Up @@ -936,6 +956,8 @@ def acp_account():
action = 'edit' action = 'edit'
form = AccountForm() form = AccountForm()
if request.method == 'POST': if request.method == 'POST':
if int(current_user.uid) in app.config['COIL_USERS_PREVENT_EDITING']:
return error("Cannot edit data for this user.", 403)
if not form.validate(): if not form.validate():
return error("Bad Request", 400) return error("Bad Request", 400)
action = 'save' action = 'save'
Expand Down
7 changes: 6 additions & 1 deletion docs/CHANGELOG.rst
Expand Up @@ -2,7 +2,12 @@
Appendix A. Changelog Appendix A. Changelog
===================== =====================


:Version: 1.3.3 :Version: 1.3.4

1.3.4
* Link to demo site in documentation
* Support reCAPTCHA for logins (for demo site)
* Support preventing some users from editing the site (for demo site)


1.3.3 1.3.3
Remove yesterday’s new options. Please do not use v1.3.2. Remove yesterday’s new options. Please do not use v1.3.2.
Expand Down
4 changes: 2 additions & 2 deletions docs/CONTRIBUTING.rst
Expand Up @@ -5,8 +5,8 @@ Appendix A. Contribution rules
:Author: Chris Warrick <chris@chriswarrick.com> :Author: Chris Warrick <chris@chriswarrick.com>
:Copyright: © 2015, Chris Warrick. :Copyright: © 2015, Chris Warrick.
:License: BSD (see /LICENSE or :doc:`Appendix B <LICENSE>`.) :License: BSD (see /LICENSE or :doc:`Appendix B <LICENSE>`.)
:Date: 2015-07-03 :Date: 2015-08-08
:Version: 1.3.3 :Version: 1.3.4


.. index:: contributing .. index:: contributing


Expand Down
14 changes: 13 additions & 1 deletion docs/admin/setup.rst
Expand Up @@ -66,6 +66,18 @@ is by downloading the raw ``.css`` file and saving it as ``files/assets/css/cust


__ https://github.com/Voog/wysihtml/blob/master/examples/css/stylesheet.css __ https://github.com/Voog/wysihtml/blob/master/examples/css/stylesheet.css


Special config for demo sites
-----------------------------

The `demo site <https://coildemo-admin.getnikola.com/>`_ uses the following two
settings, which might also be useful for some environments:

* ``COIL_LOGIN_CAPTCHA`` — if you want reCAPTCHA to appear on the login page
(aimed at plugic environments, eg. the demo site), set this to a dict of
``{'enabled': True, 'site_key': '', 'secret_key': ''}`` and fill in your data.
If you don’t want a CAPTCHA, don’t set this setting.
* ``COIL_USERS_PREVENT_EDITING`` — list of user IDs (integers) that cannot edit their
profiles.


Limited Mode vs. Full Mode Limited Mode vs. Full Mode
========================== ==========================
Expand Down Expand Up @@ -238,7 +250,7 @@ Sample uWSGI configuration:
virtualenv = /srv/coil virtualenv = /srv/coil
module = coil.web module = coil.web
callable = app callable = app
plugins = python2 plugins = python2,logfile
uid = nobody uid = nobody
gid = nobody gid = nobody
processes = 3 processes = 3
Expand Down
4 changes: 2 additions & 2 deletions docs/conf.py
Expand Up @@ -55,9 +55,9 @@
# built documents. # built documents.
# #
# The short X.Y version. # The short X.Y version.
version = '1.3.3' version = '1.3.4'
# The full version, including alpha/beta/rc tags. # The full version, including alpha/beta/rc tags.
release = '1.3.3' release = '1.3.4'


# The language for content autogenerated by Sphinx. Refer to documentation # The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages. # for a list of supported languages.
Expand Down
5 changes: 5 additions & 0 deletions docs/index.rst
Expand Up @@ -3,6 +3,11 @@
You can adapt this file completely to your liking, but it should at least You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive. contain the root `toctree` directive.
Coil demo site
==============

The Coil demo site is available at https://coilcms-site.getnikola.com/ and https://coilcms-site.getnikola.com/.

Coil CMS Coil CMS
======== ========


Expand Down
2 changes: 1 addition & 1 deletion release
Expand Up @@ -201,7 +201,7 @@ git flow release finish $version
git push git push
git push --tags git push --tags


.pypt/ghrel $cmfn $PWD $GITUSER/$GTIREPO v$version .pypt/ghrel $cmfn $PWD $GITUSER/$GITREPO v$version


cleanup_cmfn cleanup_cmfn


Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Expand Up @@ -13,6 +13,7 @@ pyinotify==0.9.5
python-bcrypt==0.3.1 python-bcrypt==0.3.1
pytz==2015.2 pytz==2015.2
redis==2.10.3 redis==2.10.3
requests==2.7.0
rq==0.5.3 rq==0.5.3
six==1.9.0 six==1.9.0
webassets==0.10.1 webassets==0.10.1
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Expand Up @@ -7,7 +7,7 @@
dependencies = [l.strip() for l in fh] dependencies = [l.strip() for l in fh]


setup(name='coil', setup(name='coil',
version='1.3.3', version='1.3.4',
description='A user-friendly CMS frontend for Nikola.', description='A user-friendly CMS frontend for Nikola.',
keywords='coil,nikola,cms', keywords='coil,nikola,cms',
author='Chris Warrick, Roberto Alsina, Henry Hirsch et al.', author='Chris Warrick, Roberto Alsina, Henry Hirsch et al.',
Expand Down

0 comments on commit 6dcea4d

Please sign in to comment.