From b1e42bcd827a68a9918484e5e11ea5f2a141ca3e Mon Sep 17 00:00:00 2001 From: =?utf-8?q?Toshio=20=E3=81=8F=E3=82=89=E3=81=A8=E3=81=BF?= Date: Mon, 21 Feb 2011 22:34:24 +0000 Subject: [PATCH] Disable logins to transifex --- manifests/servergroups/appRhel.pp | 1 + .../hotfix/files/transifex/tx-simpleauth-views.py | 40 ++++++ .../files/transifex/tx-templates-base-sample.html | 126 ++++++++++++++++++++ .../hotfix/files/transifex/tx-templates-index.html | 34 ++++++ .../transifex/tx-templates-migration_notice.html | 1 + .../transifex/tx-templates-simpleauth-signin.html | 33 +++++ modules/hotfix/manifests/init.pp | 28 +++++ 7 files changed, 263 insertions(+), 0 deletions(-) create mode 100644 modules/hotfix/files/transifex/tx-simpleauth-views.py create mode 100644 modules/hotfix/files/transifex/tx-templates-base-sample.html create mode 100644 modules/hotfix/files/transifex/tx-templates-index.html create mode 100644 modules/hotfix/files/transifex/tx-templates-migration_notice.html create mode 100644 modules/hotfix/files/transifex/tx-templates-simpleauth-signin.html diff --git a/manifests/servergroups/appRhel.pp b/manifests/servergroups/appRhel.pp index efbc053..b953070 100644 --- a/manifests/servergroups/appRhel.pp +++ b/manifests/servergroups/appRhel.pp @@ -29,6 +29,7 @@ class appRhel { if $datacenter == "phx" { include transifex::app + include hotfix::transifex mediawiki::instance { "fp": wpath => "w", wikipath => "wiki", diff --git a/modules/hotfix/files/transifex/tx-simpleauth-views.py b/modules/hotfix/files/transifex/tx-simpleauth-views.py new file mode 100644 index 0000000..f38234c --- /dev/null +++ b/modules/hotfix/files/transifex/tx-simpleauth-views.py @@ -0,0 +1,40 @@ +from django.conf import settings +from django.http import HttpResponseRedirect +from django.shortcuts import render_to_response +from django.template import RequestContext +from django.contrib.auth.decorators import login_required +from django.contrib.auth.views import (logout as auth_logout, + login as auth_login) +from simpleauth.util import clean_next + + +@login_required +def logout(request, template_name='simpleauth/logged_out.html'): + """Logout the user from the website and redirect back.""" + next = clean_next(request.GET.get('next')) + auth_logout(request, next_page=next, template_name=template_name) + return HttpResponseRedirect(next) + + +def login(request, template_name='simpleauth/signin.html'): + """Login the user to the website and redirect back.""" + # Migration to fedora.transifex.net + request.user.message_set.create( + message=_("Login is disabled due to migration to fedora.transifex.net.")) + return HttpResponseRedirect(reverse('transifex.home')) +# next = clean_next(request.GET.get('next')) +# # By default keep the user logged in for 3 weeks +# # TODO: Make this an option with a checkbox (#129) +# login_duration = getattr(settings, 'LOGIN_DAYS', 21) * 60 * 60 * 24 +# request.session.set_expiry(login_duration) +# return auth_login(request, template_name=template_name, +# redirect_field_name='next') + + +@login_required +def account_settings(request, template_name='simpleauth/settings.html'): + """Account settings page.""" + msg = request.GET.get('msg', '') + return render_to_response(template_name, + {'msg': msg,}, + context_instance=RequestContext(request)) diff --git a/modules/hotfix/files/transifex/tx-templates-base-sample.html b/modules/hotfix/files/transifex/tx-templates-base-sample.html new file mode 100644 index 0000000..da4862f --- /dev/null +++ b/modules/hotfix/files/transifex/tx-templates-base-sample.html @@ -0,0 +1,126 @@ +{% load i18n %} +{% load txcommontags %} + + + + + {% block title %}{% trans "Transifex" %}{% endblock %} + + {% block basecss %} + + + + + + {% endblock %} + {% block basejs %} + + + + + {% endblock %} + {% block shortcut_icon %} + + {% endblock %} + {% block extracss %}{% endblock %} + {% block extrajs %}{% endblock %} + {% block extra_head %}{% endblock %} + + +
+ + +
+
+ {% block content_header %} + +
+ {% include "migration_notice.html" %} + {% block content_title %}{% endblock %} +
+
+ {% block content_header_sec %}{% endblock %} +
+ {% endblock %} +
+
+ {% block content %} +
+ {% block content_sec %}{% endblock %} +
+
+ {% block messages %} + {% if messages %} +
+ {% for message in messages %} + {{ message }} + {% endfor %} +
+ {% endif %} + {% endblock %} + {% block content_main %}{% endblock %} +
+ {% endblock %} +
+ +
+
+ + +{% block bodyend %}{% endblock %} + + diff --git a/modules/hotfix/files/transifex/tx-templates-index.html b/modules/hotfix/files/transifex/tx-templates-index.html new file mode 100644 index 0000000..ff5745b --- /dev/null +++ b/modules/hotfix/files/transifex/tx-templates-index.html @@ -0,0 +1,34 @@ +{% extends "base.html" %} +{% load i18n %} + +{% block body_class %}index{% endblock %} + +{% block breadcrumb %}{% endblock %} + +{% block content_title %} +

{% trans "Welcome to Transifex" %}

+{% endblock %} + +{% block content %} + + +
+

{% trans "Transifex is a service aimed at helping translators keep track of their favourite translation projects." %}

+
+

{% include "search_form.html" %}

+ {% url project_list as project_list %} +

{% blocktrans %}You could also browse through all projects.{% endblocktrans %}

+
+
{% include "projects/project_latests.html" %}
+
+
+{% endblock %} diff --git a/modules/hotfix/files/transifex/tx-templates-migration_notice.html b/modules/hotfix/files/transifex/tx-templates-migration_notice.html new file mode 100644 index 0000000..828074b --- /dev/null +++ b/modules/hotfix/files/transifex/tx-templates-migration_notice.html @@ -0,0 +1 @@ +

Fedora has migrated translations to a Fedora team at Transifex.net. Please login to Transifex.net to add further translations to Fedora software. Thank you.

diff --git a/modules/hotfix/files/transifex/tx-templates-simpleauth-signin.html b/modules/hotfix/files/transifex/tx-templates-simpleauth-signin.html new file mode 100644 index 0000000..11dbf47 --- /dev/null +++ b/modules/hotfix/files/transifex/tx-templates-simpleauth-signin.html @@ -0,0 +1,33 @@ +{% extends "base.html" %} +{% load i18n %} + +{% block title %}{{ block.super }} | {% trans "Sign in" %}{% endblock %} +{% block breadcrumb %}{{ block.super }} » {% trans "Sign in" %}{% endblock %} +{% block content_title %}

{% trans "Sign in" %}

{% endblock %} + +{% block content %} + + +
+{% endblock %} + diff --git a/modules/hotfix/manifests/init.pp b/modules/hotfix/manifests/init.pp index 67d6563..39172d1 100644 --- a/modules/hotfix/manifests/init.pp +++ b/modules/hotfix/manifests/init.pp @@ -159,3 +159,31 @@ class hotfix::koji-builder { mode => '0755' } } + +class hotfix::transifex { + file { "/usr/share/transifex/templates/index.html": + source => 'puppet:///hotfix/transifex/tx-templates-index.html', + notify => Service['transifex'], + mode => '0644' + } + file { "/usr/share/transifex/templates/migration_notice.html": + source => 'puppet:///hotfix/transifex/tx-templates-migration_notice.html', + notify => Service['transifex'], + mode => '0644' + } + file { "/usr/share/transifex/templates/base-sample.html": + source => 'puppet:///hotfix/transifex/tx-templates-base-sample.html', + notify => Service['transifex'], + mode => '0644' + } + file { "/usr/share/transifex/simpleauth/views.py": + source => 'puppet:///hotfix/transifex/tx-simpleauth-views.py', + notify => Service['transifex'], + mode => '0644' + } + file { "/usr/share/transifex/templates/simpleauth/signin.html": + source => 'puppet:///hotfix/transifex/tx-templates-simpleauth-signin.html', + notify => Service['transifex'], + mode => '0644' + } +} -- 1.5.5.6