# set to false to enable sending notices
email_debug_mode = true
+# Set to false to disable registrations
+allow_registration = true
+
## Uncomment this to put some user-overriding templates here
#local_templates = %(here)s/user_dev/templates/
from webob import exc
from mediagoblin import messages
+from mediagoblin import mg_globals
from mediagoblin.util import render_to_response, redirect
from mediagoblin.db.util import ObjectId
from mediagoblin.auth import lib as auth_lib
"""
Your classic registration view!
"""
+
+ # Redirects to indexpage if registrations are disabled
+ if not mg_globals.app_config["allow_registration"]:
+ return redirect(request, "index")
+
register_form = auth_forms.RegistrationForm(request.POST)
if request.method == 'POST' and register_form.validate():
email_debug_mode = boolean(default=True)
email_sender_address = string(default="notice@mediagoblin.example.org")
+# Set to false to disable registrations
+allow_registration = boolean(default=True)
+
# By default not set, but you might want something like:
# "%(here)s/user_dev/templates/"
local_templates = string()
# known lists
celery_routes = string_list()
-celery_imports = string_list()
\ No newline at end of file
+celery_imports = string_list()
If you have an account, you can
<a href="{{ request.urlgen('mediagoblin.auth.login') }}">Login</a>.
</p>
+ {% if allow_registration %}
<p>
If you don't have an account, please
<a href="{{ request.urlgen('mediagoblin.auth.register') }}">Register</a>.
</p>
+ {% endif %}
{% endif %}
{# temporarily, an "image gallery" that isn't one really ;) #}
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
+from mediagoblin import mg_globals
from mediagoblin.util import render_to_response
from mediagoblin.db.util import DESCENDING
return render_to_response(
request, 'mediagoblin/root.html',
- {'media_entries': media_entries})
+ {'media_entries': media_entries,
+ 'allow_registration': mg_globals.app_config["allow_registration"]})
def simple_template_render(request):