[Change Request] Disable transifex logins

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



As the next step in migrating to transifex.net we would like to disable
logging in to the Fedora transifex instance and put up a banner that tells
people to use http://fedora.transifex.org/ instead.

Can I get to +1's to push this change out to the app servers?


-Toshio
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?= <toshio@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
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 %}
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
+   "http://www.w3.org/TR/html4/strict.dtd";>
+
+<html lang="en">
+<head>
+  <title>{% block title %}{% trans "Transifex" %}{% endblock %}</title>
+  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+  {% block basecss %}
+  <link media="screen" href="/site_media/css/base.css" type="text/css" rel="stylesheet" />
+  <link media="screen" href="/site_media/css/stats.css" type="text/css" rel="stylesheet" />
+  <link media="screen" href="/site_media/css/icons.css" type="text/css" rel="stylesheet" />
+  <link media="screen" href="/site_media/userprofile/css/django-profile.css" type="text/css" rel="stylesheet"  />
+  <link media="screen" href="/site_media/userprofile/css/tx.css" type="text/css" rel="stylesheet" />
+  {% endblock %}
+  {% block basejs %}
+  <script type="text/javascript" src="/site_media/js/jquery-1.3.2.min.js"></script>
+  <script type="text/javascript" src="/site_media/js/json2.min.js"></script>
+  <script type="text/javascript" src="/site_media/js/jquery.tablesorter.min.js"></script>
+  <script type="text/javascript" src="/site_media/js/base.js"></script>
+  {% endblock %}
+  {% block shortcut_icon %}
+  <link rel="shortcut icon" href="/site_media/images/favicon.ico" type="image/x-icon" />
+  {% endblock %}
+  {% block extracss %}{% endblock %}
+  {% block extrajs %}{% endblock %}
+  {% block extra_head %}{% endblock %}
+</head>
+<body id="{% block body_id %}{% endblock %}" class="{% block body_class %}{% endblock %}">
+<div id="wrapper">
+  <div id="header">
+    <div id="logo">
+      <a class="simlink" href="{% url transifex.home %}" alt="{% trans "Go to start page" %}" title="{% trans "Go to start page" %}">
+        {% block logo %}<img border="0" src="/site_media/images/tx-logo.png" alt="{% trans "Transifex logo" %}" />{% endblock %}
+      </a>
+    </div>
+    <div id="navmenu">
+      <a href="{% url project_list %}" title="{% trans "The projects being served" %}">{% trans "Projects" %}</a>
+      | <a href="{% url collection_list %}" title="{% trans "Collections of projects" %}">{% trans "Collections" %}</a>
+      | <a href="{% url language_list %}" title="{% trans "The languages our service serves" %}">{% trans "Languages" %}</a>
+    </div>
+    <div id="header_secnav">
+<!--
+      <span id="login">
+          {% if user.is_authenticated %}
+              {% url profile_overview as user_profile %} 
+              {% blocktrans with user.username as user_username %}Welcome <a title="Profile settings" href="{{ user_profile }}">{{ user_username }}</a>!{% endblocktrans %} |
+              <form action="{% url logout %}?next={{request.path}}" method="POST" class="microform"><input type="submit" title="{% trans "Sign out from the website" %}" class="i16 logout buttonize" value="{% trans "Sign out" %}" /></form>
+          {% else %}
+              <a href="{% url login %}?next={{request|get_next}}">{% trans "Sign in" %}</a>
+              {% url signup as signup_url %}
+              {% if signup_url %}
+              | <a href="{{ signup_url }}">{% trans "Register" %}</a>
+              {% endif %}
+              </span>
+          {% endif %}
+-->
+    {% url django.views.i18n.set_language as set_language_url %}
+    <form action="{{ set_language_url }}" method="post" class="microform">
+        <input name="next" type="hidden" value="{{ request.path }}" />
+            <select id="language_switch" name="language">
+            {% for lang in LANGUAGES %}
+               <option value="{{ lang.0 }}" {% ifequal request.session.django_language lang.0 %}selected="selected"{% endifequal %}>{{ lang.0 }}</option>
+            {% endfor %}
+            </select>
+    </form>
+    </div>
+    <div id="header_trinav">
+    {% block header_trinav %}
+      {% include "search_form_plain.html" %}
+    {% endblock %}
+    </div>
+  </div>
+        
+  <div id="content">
+    <div id="content_header">
+    {% block content_header %}
+      <div id="breadcrumbs">
+        {% block breadcrumb %}{% homelink %}{% endblock %}
+      </div>
+      <div id="content_title">
+        {% include "migration_notice.html" %}
+        {% block content_title %}{% endblock %}
+      </div>
+      <div id="content_header_sec">
+        {% block content_header_sec %}{% endblock %}
+      </div>
+    {% endblock %}
+    </div>
+    <div id="body">
+      {% block content %}
+        <div id="body_sec">
+          {% block content_sec %}{% endblock %}
+        </div>
+        <div id="body_main">
+          {% block messages %}
+            {% if messages %}
+                <div class="messages">
+                {% for message in messages %}
+                    <span class="i16 tip message">{{ message }}</span> 
+                {% endfor %}
+                </div>
+            {% endif %}
+          {% endblock %}
+        {% block content_main %}{% endblock %}
+        </div>
+      {% endblock %}
+    </div>
+    <div id="content_footer">
+      {% block content_footer %}{% endblock %}
+    </div>
+  </div>
+</div>
+
+  <div id="footer">{% block footer %}
+    <p class="main-footer center">
+      {% block footerlinks %}{% trans "About" %} | <a href="{% url contact_form %}" title="{% trans "Get in contact with us" %}">{% trans "Feedback" %}</a>{% endblock %}
+    </p>
+    {% block powered %}<p class="powered">Powered by <a href="http://transifex.org/"; title="Transifex community">Transifex</a>, the Open Translation Platform</p>{% endblock %}
+    {% block txversionblock %}<p class="version">v{% txversion %}</p>{% endblock %}
+    {% block extrafooter %}{% endblock %}
+  {% endblock %}</div>
+{% block bodyend %}{% endblock %}
+</body>
+</html>
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 %}
+  <h2 class="pagetitle">{% trans "Welcome to Transifex" %}</h2>
+{% endblock %}
+
+{% block content %}
+
+<!--
+{% if not request.user.is_authenticated %}
+<div id="login_index">
+  <div class="divright">
+  {% url user_changeopenid as user_changeopenid %}
+  {% include "simpleauth/login_box.html" %}
+  </div>
+</div>
+{% endif %}
+-->
+<div id="intro">
+  <p class="promo">{% trans "Transifex is a service aimed at helping translators keep track of their favourite translation projects." %}</p>
+  <div class="searchform content_header_prim">
+    <p>{% include "search_form.html" %}</p>
+    {% url project_list as project_list %} 
+    <p>{% blocktrans %}You could also browse through <a href="{{ project_list }}">all projects</a>.{% endblocktrans %}</p>
+  </div>
+<div id="top_lists">{% include "projects/project_latests.html" %}</div> 
+</div>
+<div id="clear"></div>
+{% 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 @@
+<p class="message i16 bell">Fedora has migrated translations to a Fedora team at <a href="http://fedora.transifex.net/";>Transifex.net</a>.  Please login to Transifex.net to  add further translations to Fedora software.  Thank you.</p>
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 }} &raquo; {% trans "Sign in" %}{% endblock %}
+{% block content_title %}<h2 class="pagetitle">{% trans "Sign in" %}</h2>{% endblock %}
+
+{% block content %}
+
+<!--
+{% blocktrans %}
+<p>Please sign in with your email or screen name.<br />
+{% endblocktrans %}
+<br />
+{% if msg %}
+<br />
+	<p class="warning">{{ msg }}</p>
+{% endif %}
+{% if form.non_field_errors %}
+<div id="form-error">
+  {{ form.non_field_errors }}
+</div>
+{% endif %}
+
+<div id="login_index">
+  <div class="divleft">
+      {% include "simpleauth/login_box.html" %}
+  </div>
+</div>
+-->
+<div class="clear"></div>
+{% 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

Attachment: pgpTvPS5EpQhQ.pgp
Description: PGP signature

_______________________________________________
infrastructure mailing list
infrastructure@xxxxxxxxxxxxxxxxxxxxxxx
https://admin.fedoraproject.org/mailman/listinfo/infrastructure

[Index of Archives]     [Fedora Development]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [KDE Users]

  Powered by Linux