From 697ee04a439c9120e2228e78d6b920e6a23c3307 Mon Sep 17 00:00:00 2001 From: eric Date: Wed, 28 Dec 2011 12:28:48 -0500 Subject: [PATCH 01/10] added site fixtures to make email registration emails work --- core/fixtures/initial_data.json | 16 ++++++++++++++++ .../templates/registration/activation_email.txt | 2 +- .../registration/password_reset_email.html | 2 +- settings/prod.py | 2 ++ 4 files changed, 20 insertions(+), 2 deletions(-) diff --git a/core/fixtures/initial_data.json b/core/fixtures/initial_data.json index 3ce3b29a..afe77bf9 100644 --- a/core/fixtures/initial_data.json +++ b/core/fixtures/initial_data.json @@ -7,6 +7,22 @@ "name": "unglue.it" } }, + { + "pk": 2, + "model": "sites.site", + "fields": { + "domain": "please.unglueit.com", + "name": "unglue.it development" + } + }, + { + "pk": 3, + "model": "sites.site", + "fields": { + "domain": "localhost:8000", + "name": "unglue.it local development" + } + }, { "pk": 1, "model": "core.premium", diff --git a/frontend/templates/registration/activation_email.txt b/frontend/templates/registration/activation_email.txt index f8ccafc2..9e1ac63c 100644 --- a/frontend/templates/registration/activation_email.txt +++ b/frontend/templates/registration/activation_email.txt @@ -5,7 +5,7 @@ and your address will be removed from our records. To activate this account, please click the following link within the next {{ expiration_days }} days: -https://{{request.META.SERVER_NAME}}/accounts/activate/{{ activation_key }} +{{ protocol }}://{{ domain }}/accounts/activate/{{ activation_key }} Sincerely, The {{ site.name }} Team diff --git a/frontend/templates/registration/password_reset_email.html b/frontend/templates/registration/password_reset_email.html index d6b7c0c8..3f794827 100644 --- a/frontend/templates/registration/password_reset_email.html +++ b/frontend/templates/registration/password_reset_email.html @@ -1,7 +1,7 @@ Greetings {% if user.get_full_name %}{{ user.get_full_name }}{% else %}{{ user }}{% endif %}, You are receiving this email because you (or someone pretending to be you) -requested that your password be reset on the {{ domain }} site. If you do not +requested that your password be reset on the {{ site_name }} site. If you do not wish to reset your password, please ignore this message. To reset your password, please click the following link, or copy and paste it diff --git a/settings/prod.py b/settings/prod.py index 6e56cf20..dd3fb92e 100644 --- a/settings/prod.py +++ b/settings/prod.py @@ -3,6 +3,8 @@ from regluit.settings.common import * DEBUG = False TEMPLATE_DEBUG = DEBUG +SITE_ID = 2 + ADMINS = ( ('Ed Summers', 'ed.summers@gmail.com'), ('Raymond Yee', 'rdhyee+ungluebugs@gluejar.com'), From 37a0139e8dc6c98751f6722cd43025d7db43f11e Mon Sep 17 00:00:00 2001 From: eric Date: Wed, 28 Dec 2011 12:31:35 -0500 Subject: [PATCH 02/10] registration and profile cleanup / decrufting --- requirements.pip | 2 -- settings/common.py | 2 +- urls.py | 2 -- 3 files changed, 1 insertion(+), 5 deletions(-) diff --git a/requirements.pip b/requirements.pip index 8cffd17f..81bf2e0c 100644 --- a/requirements.pip +++ b/requirements.pip @@ -3,12 +3,10 @@ south django-extensions https://github.com/toastdriven/django-tastypie/tarball/master requests -https://bitbucket.org/ubernostrum/django-registration/get/tip.tar.gz django-social-auth selenium django-nose-selenium nose -django-profiles django-kombu django-celery redis diff --git a/settings/common.py b/settings/common.py index 3194db61..d908d081 100644 --- a/settings/common.py +++ b/settings/common.py @@ -189,7 +189,7 @@ USER_AGENT = "unglue.it.bot v0.0.1 " SOUTH_TESTS_MIGRATE = True -AUTH_PROFILE_MODULE = "core.userprofile" +AUTH_PROFILE_MODULE = "core.UserProfile" GOODREADS_API_KEY = "" GOODREADS_API_SECRET = "" diff --git a/urls.py b/urls.py index 33fb3061..031516d3 100755 --- a/urls.py +++ b/urls.py @@ -10,8 +10,6 @@ urlpatterns = patterns('', (r'^accounts/', include('registration.backends.default.urls')), (r'^socialauth/', include('social_auth.urls')), (r'^api/', include('regluit.api.urls')), - ('^profiles/edit/$', 'profiles.views.edit_profile', {'form_class': ProfileForm,}), - (r'^profiles/', include('profiles.urls')), (r'', include('regluit.frontend.urls')), (r'', include('regluit.payment.urls')), (r'^selectable/', include('selectable.urls')), From 93afadcf46b52554bee4af1708dbff561f99c9cc Mon Sep 17 00:00:00 2001 From: eric Date: Wed, 28 Dec 2011 12:34:26 -0500 Subject: [PATCH 03/10] added htmlbase to enforce https login --- frontend/templates/base.html | 5 +++-- frontend/templates/home.html | 8 ++++---- frontend/templates/registration/login.html | 2 +- frontend/views.py | 10 +++++----- settings/dev.py | 2 ++ settings/jenkins.py | 3 +++ settings/prod.py | 3 +++ 7 files changed, 21 insertions(+), 12 deletions(-) diff --git a/frontend/templates/base.html b/frontend/templates/base.html index 673ac35d..c1979a0a 100644 --- a/frontend/templates/base.html +++ b/frontend/templates/base.html @@ -10,6 +10,7 @@ unglue.it {% block title %}{% endblock %} + {% if htmlbase %}{% endif %} {% block extra_css %}{% endblock %} @@ -48,13 +49,13 @@
  • Welcome, {{ user.username }}
  • Sign Out
  • {% else %} -
  • Sign In
  • +
  • Sign In
  • {% endif %}
  • Tour
  • FAQs
  • Help
  • {% if not user.is_authenticated %} -
  • sign up
  • +
  • sign up
  • {% endif %} diff --git a/frontend/templates/home.html b/frontend/templates/home.html index 3c49ad61..e7f82136 100755 --- a/frontend/templates/home.html +++ b/frontend/templates/home.html @@ -74,7 +74,7 @@ var $j = jQuery.noConflict();
    - Facebook + Facebook tweeter
    @@ -121,7 +121,7 @@ var $j = jQuery.noConflict(); @@ -168,7 +168,7 @@ var $j = jQuery.noConflict();

    Start Ungluing Now!

    -
    {% csrf_token %} + {% csrf_token %}
    @@ -189,7 +189,7 @@ var $j = jQuery.noConflict();
    diff --git a/frontend/templates/registration/login.html b/frontend/templates/registration/login.html index 36cbf26d..ba9aaacb 100644 --- a/frontend/templates/registration/login.html +++ b/frontend/templates/registration/login.html @@ -15,7 +15,7 @@

    Or, login with:

    - +

    diff --git a/frontend/views.py b/frontend/views.py index 9adcbd39..8c6e4d0c 100755 --- a/frontend/views.py +++ b/frontend/views.py @@ -51,7 +51,7 @@ logger = logging.getLogger(__name__) def home(request): if request.user.is_authenticated(): - return HttpResponseRedirect(reverse('supporter', + return HttpResponseRedirect(settings.HTML_BASE + reverse('supporter', args=[request.user.username])) ending = models.Campaign.objects.filter(status='ACTIVE').order_by('deadline') j=0 @@ -69,7 +69,7 @@ def home(request): if j == count: j = 0 events = models.Wishes.objects.order_by('-created')[0:2] - return render(request, 'home.html', {'suppress_search_box': True, 'works': works, 'works2': works2, 'events': events}) + return render(request, 'home.html', {'suppress_search_box': True, 'works': works, 'works2': works2, 'events': events, 'htmlbase':settings.HTML_BASE}) def stub(request): path = request.path[6:] # get rid of /stub/ @@ -132,7 +132,7 @@ def manage_campaign(request, id): alerts.append(_('Campaign has NOT been launched')) else: form= ManageCampaignForm(instance=campaign) - return render(request, 'manage_campaign.html', {'campaign': campaign, 'form':form, 'problems': campaign.problems, 'alerts': alerts}) + return render(request, 'manage_campaign.html', {'campaign': campaign, 'form':form, 'problems': campaign.problems, 'alerts': alerts, 'htmlbase':settings.HTML_BASE}) def googlebooks(request, googlebooks_id): try: @@ -380,7 +380,7 @@ def rh_tools(request): claim.campaign_form = OpenCampaignForm(data={'work': claim.work, 'name': claim.work.title, 'userid': request.user.id}) else: claim.can_open_new=False - return render(request, "rh_tools.html", {'claims': claims ,}) + return render(request, "rh_tools.html", {'claims': claims , 'htmlbase':settings.HTML_BASE}) def rh_admin(request): if not request.user.is_authenticated() : @@ -610,7 +610,7 @@ def supporter(request, supporter_username, template_name): def edit_user(request): form=UserData() if not request.user.is_authenticated(): - return HttpResponseRedirect(reverse('auth_login')) + return HttpResponseRedirect(settings.HTML_BASE + reverse('auth_login')) oldusername=request.user.username if request.method == 'POST': # surely there's a better way to add data to the POST data? diff --git a/settings/dev.py b/settings/dev.py index 4eaf98e9..237de157 100644 --- a/settings/dev.py +++ b/settings/dev.py @@ -24,6 +24,8 @@ DATABASES = { TIME_ZONE = 'America/New_York' SECRET_KEY = '_^_off!8zsj4+)%qq623m&$7_m-q$iau5le0w!mw&n5tgt#x=t' +HTML_BASE = 'https://please.unglueit.com' + # settings for outbout email # if you have a gmail account you can use your email address and password diff --git a/settings/jenkins.py b/settings/jenkins.py index 9209ba5d..337b4e1d 100644 --- a/settings/jenkins.py +++ b/settings/jenkins.py @@ -24,6 +24,9 @@ DATABASES = { TIME_ZONE = 'America/New_York' SECRET_KEY = '_^_off!8zsj4+)%qq623m&$7_m-q$iau5le0w!mw&n5tgt#x=t' +HTML_BASE = 'http://jenkins.gluejar.com' + + # settings for outbout email # if you have a gmail account you can use your email address and password diff --git a/settings/prod.py b/settings/prod.py index dd3fb92e..7055ab69 100644 --- a/settings/prod.py +++ b/settings/prod.py @@ -28,6 +28,9 @@ DATABASES = { TIME_ZONE = 'America/New_York' SECRET_KEY = '_^_off!8zsj4+)%qq623m&$7_m-q$iau5le0w!mw&n5tgt#x=t' +HTML_BASE = 'https://please.unglueit.com' + + # settings for outbout email # if you have a gmail account you can use your email address and password From f49331278295477099c93d4ce99f23345d5a13c8 Mon Sep 17 00:00:00 2001 From: eric Date: Wed, 28 Dec 2011 13:51:24 -0500 Subject: [PATCH 04/10] Revert "added htmlbase to enforce https login" This reverts commit 93afadcf46b52554bee4af1708dbff561f99c9cc. --- frontend/templates/base.html | 5 ++--- frontend/templates/home.html | 8 ++++---- frontend/templates/registration/login.html | 2 +- frontend/views.py | 10 +++++----- settings/dev.py | 2 -- settings/jenkins.py | 3 --- settings/prod.py | 3 --- 7 files changed, 12 insertions(+), 21 deletions(-) diff --git a/frontend/templates/base.html b/frontend/templates/base.html index c1979a0a..673ac35d 100644 --- a/frontend/templates/base.html +++ b/frontend/templates/base.html @@ -10,7 +10,6 @@ unglue.it {% block title %}{% endblock %} - {% if htmlbase %}{% endif %} {% block extra_css %}{% endblock %} @@ -49,13 +48,13 @@

  • Welcome, {{ user.username }}
  • Sign Out
  • {% else %} -
  • Sign In
  • +
  • Sign In
  • {% endif %}
  • Tour
  • FAQs
  • Help
  • {% if not user.is_authenticated %} -
  • sign up
  • +
  • sign up
  • {% endif %} diff --git a/frontend/templates/home.html b/frontend/templates/home.html index e7f82136..3c49ad61 100755 --- a/frontend/templates/home.html +++ b/frontend/templates/home.html @@ -74,7 +74,7 @@ var $j = jQuery.noConflict();
    - Facebook + Facebook tweeter
    @@ -121,7 +121,7 @@ var $j = jQuery.noConflict(); @@ -168,7 +168,7 @@ var $j = jQuery.noConflict();

    Start Ungluing Now!

    -
    {% csrf_token %} + {% csrf_token %}
    @@ -189,7 +189,7 @@ var $j = jQuery.noConflict();
    diff --git a/frontend/templates/registration/login.html b/frontend/templates/registration/login.html index ba9aaacb..36cbf26d 100644 --- a/frontend/templates/registration/login.html +++ b/frontend/templates/registration/login.html @@ -15,7 +15,7 @@

    Or, login with:

    - +

    diff --git a/frontend/views.py b/frontend/views.py index 8c6e4d0c..9adcbd39 100755 --- a/frontend/views.py +++ b/frontend/views.py @@ -51,7 +51,7 @@ logger = logging.getLogger(__name__) def home(request): if request.user.is_authenticated(): - return HttpResponseRedirect(settings.HTML_BASE + reverse('supporter', + return HttpResponseRedirect(reverse('supporter', args=[request.user.username])) ending = models.Campaign.objects.filter(status='ACTIVE').order_by('deadline') j=0 @@ -69,7 +69,7 @@ def home(request): if j == count: j = 0 events = models.Wishes.objects.order_by('-created')[0:2] - return render(request, 'home.html', {'suppress_search_box': True, 'works': works, 'works2': works2, 'events': events, 'htmlbase':settings.HTML_BASE}) + return render(request, 'home.html', {'suppress_search_box': True, 'works': works, 'works2': works2, 'events': events}) def stub(request): path = request.path[6:] # get rid of /stub/ @@ -132,7 +132,7 @@ def manage_campaign(request, id): alerts.append(_('Campaign has NOT been launched')) else: form= ManageCampaignForm(instance=campaign) - return render(request, 'manage_campaign.html', {'campaign': campaign, 'form':form, 'problems': campaign.problems, 'alerts': alerts, 'htmlbase':settings.HTML_BASE}) + return render(request, 'manage_campaign.html', {'campaign': campaign, 'form':form, 'problems': campaign.problems, 'alerts': alerts}) def googlebooks(request, googlebooks_id): try: @@ -380,7 +380,7 @@ def rh_tools(request): claim.campaign_form = OpenCampaignForm(data={'work': claim.work, 'name': claim.work.title, 'userid': request.user.id}) else: claim.can_open_new=False - return render(request, "rh_tools.html", {'claims': claims , 'htmlbase':settings.HTML_BASE}) + return render(request, "rh_tools.html", {'claims': claims ,}) def rh_admin(request): if not request.user.is_authenticated() : @@ -610,7 +610,7 @@ def supporter(request, supporter_username, template_name): def edit_user(request): form=UserData() if not request.user.is_authenticated(): - return HttpResponseRedirect(settings.HTML_BASE + reverse('auth_login')) + return HttpResponseRedirect(reverse('auth_login')) oldusername=request.user.username if request.method == 'POST': # surely there's a better way to add data to the POST data? diff --git a/settings/dev.py b/settings/dev.py index 237de157..4eaf98e9 100644 --- a/settings/dev.py +++ b/settings/dev.py @@ -24,8 +24,6 @@ DATABASES = { TIME_ZONE = 'America/New_York' SECRET_KEY = '_^_off!8zsj4+)%qq623m&$7_m-q$iau5le0w!mw&n5tgt#x=t' -HTML_BASE = 'https://please.unglueit.com' - # settings for outbout email # if you have a gmail account you can use your email address and password diff --git a/settings/jenkins.py b/settings/jenkins.py index 337b4e1d..9209ba5d 100644 --- a/settings/jenkins.py +++ b/settings/jenkins.py @@ -24,9 +24,6 @@ DATABASES = { TIME_ZONE = 'America/New_York' SECRET_KEY = '_^_off!8zsj4+)%qq623m&$7_m-q$iau5le0w!mw&n5tgt#x=t' -HTML_BASE = 'http://jenkins.gluejar.com' - - # settings for outbout email # if you have a gmail account you can use your email address and password diff --git a/settings/prod.py b/settings/prod.py index 7055ab69..dd3fb92e 100644 --- a/settings/prod.py +++ b/settings/prod.py @@ -28,9 +28,6 @@ DATABASES = { TIME_ZONE = 'America/New_York' SECRET_KEY = '_^_off!8zsj4+)%qq623m&$7_m-q$iau5le0w!mw&n5tgt#x=t' -HTML_BASE = 'https://please.unglueit.com' - - # settings for outbout email # if you have a gmail account you can use your email address and password From 4c7e5e7f8ca308f46a2b09e6ae34dd1c89bf7594 Mon Sep 17 00:00:00 2001 From: eric Date: Wed, 28 Dec 2011 13:58:28 -0500 Subject: [PATCH 05/10] revert; will need to use http rewrite in apache to enforce https --- frontend/templates/base.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/templates/base.html b/frontend/templates/base.html index 673ac35d..eb2b9717 100644 --- a/frontend/templates/base.html +++ b/frontend/templates/base.html @@ -48,7 +48,7 @@

  • Welcome, {{ user.username }}
  • Sign Out
  • {% else %} -
  • Sign In
  • +
  • Sign In
  • {% endif %}
  • Tour
  • FAQs
  • From 57939300b102cab273569821f72d3682e748ff2c Mon Sep 17 00:00:00 2001 From: eric Date: Wed, 28 Dec 2011 15:02:12 -0500 Subject: [PATCH 06/10] another try for email activation --- frontend/templates/registration/activation_email.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/templates/registration/activation_email.txt b/frontend/templates/registration/activation_email.txt index 9e1ac63c..bd15ab64 100644 --- a/frontend/templates/registration/activation_email.txt +++ b/frontend/templates/registration/activation_email.txt @@ -5,7 +5,7 @@ and your address will be removed from our records. To activate this account, please click the following link within the next {{ expiration_days }} days: -{{ protocol }}://{{ domain }}/accounts/activate/{{ activation_key }} +https://{{ site.domain }}/accounts/activate/{{ activation_key }} Sincerely, The {{ site.name }} Team From 880cb855091c309865542e7e29a60afddd6705df Mon Sep 17 00:00:00 2001 From: eric Date: Wed, 28 Dec 2011 18:40:02 -0500 Subject: [PATCH 07/10] removed too much; really do need django-registration --- requirements.pip | 1 + 1 file changed, 1 insertion(+) diff --git a/requirements.pip b/requirements.pip index 81bf2e0c..b2ae6819 100644 --- a/requirements.pip +++ b/requirements.pip @@ -3,6 +3,7 @@ south django-extensions https://github.com/toastdriven/django-tastypie/tarball/master requests +django-registration django-social-auth selenium django-nose-selenium From f484acc88451280af2452b3fb17e7d25400152b6 Mon Sep 17 00:00:00 2001 From: eric Date: Wed, 28 Dec 2011 19:01:54 -0500 Subject: [PATCH 08/10] and we really want 0.8 version of django-registration --- requirements.pip | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.pip b/requirements.pip index b2ae6819..91d2b115 100644 --- a/requirements.pip +++ b/requirements.pip @@ -3,7 +3,7 @@ south django-extensions https://github.com/toastdriven/django-tastypie/tarball/master requests -django-registration +https://bitbucket.org/ubernostrum/django-registration/get/tip.tar.gz django-social-auth selenium django-nose-selenium From a348743385c30285971b613a80086262fd078870 Mon Sep 17 00:00:00 2001 From: eric Date: Wed, 28 Dec 2011 20:41:07 -0500 Subject: [PATCH 09/10] discovered at d applied the useful request.build_absolute_uri --- frontend/templates/home.html | 6 +++--- frontend/templates/registration/login.html | 2 +- frontend/templates/registration/logout.html | 2 +- frontend/templates/work.html | 6 +++--- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/frontend/templates/home.html b/frontend/templates/home.html index 3c49ad61..f45a8abb 100755 --- a/frontend/templates/home.html +++ b/frontend/templates/home.html @@ -74,7 +74,7 @@ var $j = jQuery.noConflict();
    - Facebook + Facebook tweeter
    @@ -121,7 +121,7 @@ var $j = jQuery.noConflict(); @@ -189,7 +189,7 @@ var $j = jQuery.noConflict(); diff --git a/frontend/templates/registration/login.html b/frontend/templates/registration/login.html index 36cbf26d..92af37b6 100644 --- a/frontend/templates/registration/login.html +++ b/frontend/templates/registration/login.html @@ -15,7 +15,7 @@

    Or, login with:

    - +

    diff --git a/frontend/templates/registration/logout.html b/frontend/templates/registration/logout.html index 8b4cd820..d8d3178c 100644 --- a/frontend/templates/registration/logout.html +++ b/frontend/templates/registration/logout.html @@ -3,7 +3,7 @@ {% block doccontent %}

    diff --git a/frontend/templates/work.html b/frontend/templates/work.html index b8c209d0..88a11002 100644 --- a/frontend/templates/work.html +++ b/frontend/templates/work.html @@ -233,11 +233,11 @@ jQuery(document).ready(function(){

    Share

    From f9adbd0bc39ba2bd0932673b9b512ff23cd51d6a Mon Sep 17 00:00:00 2001 From: eric Date: Wed, 28 Dec 2011 21:13:32 -0500 Subject: [PATCH 10/10] social widgets on basedocumentation lit up --- frontend/templates/basedocumentation.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/frontend/templates/basedocumentation.html b/frontend/templates/basedocumentation.html index a40657ed..fc613243 100644 --- a/frontend/templates/basedocumentation.html +++ b/frontend/templates/basedocumentation.html @@ -23,8 +23,8 @@
    - Facebook - Twitter + Facebook + Twitter email