From 04d7c55fc65407adbf7fee1bd2b0867c7ce99ccb Mon Sep 17 00:00:00 2001 From: Jef van Schendel Date: Thu, 26 May 2011 01:24:13 +0200 Subject: [PATCH 01/30] Changed logout/account text --- mediagoblin/templates/mediagoblin/base.html | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/mediagoblin/templates/mediagoblin/base.html b/mediagoblin/templates/mediagoblin/base.html index a0e0730d..9894f27a 100644 --- a/mediagoblin/templates/mediagoblin/base.html +++ b/mediagoblin/templates/mediagoblin/base.html @@ -34,9 +34,8 @@ {% endblock %}{% block mediagoblin_header_title %}MediaGoblin Home{% endblock %}
{% if request.user %} - Welcome {{ request.user['username'] }}! -- - - Logout + {{ request.user['username'] }}'s account + (logout) {% else %} Login From 8566cdda713566ef632b78388fa9016a704f6e55 Mon Sep 17 00:00:00 2001 From: Christopher Allan Webber Date: Sat, 28 May 2011 09:54:09 -0500 Subject: [PATCH 02/30] Added a new form rendering system, render_divs, and using it for registration --- .../templates/mediagoblin/auth/register.html | 15 ++++++------ .../templates/mediagoblin/utils/wtforms.html | 24 +++++++++++++++++++ 2 files changed, 32 insertions(+), 7 deletions(-) diff --git a/mediagoblin/templates/mediagoblin/auth/register.html b/mediagoblin/templates/mediagoblin/auth/register.html index 610c7cc4..31c3d23e 100644 --- a/mediagoblin/templates/mediagoblin/auth/register.html +++ b/mediagoblin/templates/mediagoblin/auth/register.html @@ -20,14 +20,15 @@ {% import "/mediagoblin/utils/wtforms.html" as wtforms_util %} {% block mediagoblin_content %} +

Create an account!

+
- - {{ wtforms_util.render_table(register_form) }} - - - - -
+
+ {{ wtforms_util.render_divs(register_form) }} +
+ +
+
{% endblock %} diff --git a/mediagoblin/templates/mediagoblin/utils/wtforms.html b/mediagoblin/templates/mediagoblin/utils/wtforms.html index 15556936..4a37ab33 100644 --- a/mediagoblin/templates/mediagoblin/utils/wtforms.html +++ b/mediagoblin/templates/mediagoblin/utils/wtforms.html @@ -15,6 +15,30 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . #} + +{# Auto-render a form as a series of divs #} +{% macro render_divs(form) -%} + {% for field in form %} +
+
{{ field.label }}
+ {% if field.description -%} +
{{ field.description }}
+ {%- endif %} +
{{ field }}
+ {%- if field.errors -%} +
+
    + {% for error in field.errors %} +
  • {{ error }}
  • + {% endfor %} +
+
+ {%- endif %} +
+ {% endfor %} +{%- endmacro %} + +{# Auto-render a form as a table #} {% macro render_table(form) -%} {% for field in form %} From 491b9109f368f06aa4032cba14518638b6b7cb5c Mon Sep 17 00:00:00 2001 From: Jef van Schendel Date: Sat, 28 May 2011 18:32:43 +0200 Subject: [PATCH 03/30] Styled forms --- mediagoblin/static/css/base.css | 25 +++++++++++++++++++ .../templates/mediagoblin/auth/register.html | 2 +- 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/mediagoblin/static/css/base.css b/mediagoblin/static/css/base.css index c7d3d4ad..48331554 100644 --- a/mediagoblin/static/css/base.css +++ b/mediagoblin/static/css/base.css @@ -84,3 +84,28 @@ label { left:0px; margin-top:-20px; } + +/* forms */ + +.form_box { + width:300px; + margin-left:auto; + margin-right:auto; + background-color:#393939; + padding:50px 83px 83px; + border-top:5px solid #d49086; + font-size:18px; +} + +.form_field_input input { + width:300px; + font-size:18px; +} + +.form_field_box { + margin-bottom:20px; +} + +.form_field_label { + margin-bottom:4px; +} diff --git a/mediagoblin/templates/mediagoblin/auth/register.html b/mediagoblin/templates/mediagoblin/auth/register.html index 31c3d23e..2ebe99ec 100644 --- a/mediagoblin/templates/mediagoblin/auth/register.html +++ b/mediagoblin/templates/mediagoblin/auth/register.html @@ -20,7 +20,7 @@ {% import "/mediagoblin/utils/wtforms.html" as wtforms_util %} {% block mediagoblin_content %} -

Create an account!

+

Create an account!

From 9ef7c0f7376ef18e9703722b6730021c95bbdb33 Mon Sep 17 00:00:00 2001 From: Jef van Schendel Date: Sat, 28 May 2011 20:43:57 +0200 Subject: [PATCH 04/30] Fixed form header --- mediagoblin/static/css/base.css | 8 +++++++- mediagoblin/templates/mediagoblin/auth/register.html | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/mediagoblin/static/css/base.css b/mediagoblin/static/css/base.css index 48331554..26bf8bd9 100644 --- a/mediagoblin/static/css/base.css +++ b/mediagoblin/static/css/base.css @@ -23,6 +23,8 @@ h1 { margin-top:40px; } +28px + a { color: #86D4B1; } @@ -92,11 +94,15 @@ label { margin-left:auto; margin-right:auto; background-color:#393939; - padding:50px 83px 83px; + padding:0px 83px 83px; border-top:5px solid #d49086; font-size:18px; } +.form_box h1 { + font-size:28px; +} + .form_field_input input { width:300px; font-size:18px; diff --git a/mediagoblin/templates/mediagoblin/auth/register.html b/mediagoblin/templates/mediagoblin/auth/register.html index 2ebe99ec..730d684d 100644 --- a/mediagoblin/templates/mediagoblin/auth/register.html +++ b/mediagoblin/templates/mediagoblin/auth/register.html @@ -20,11 +20,11 @@ {% import "/mediagoblin/utils/wtforms.html" as wtforms_util %} {% block mediagoblin_content %} -

Create an account!

+

Create an account!

{{ wtforms_util.render_divs(register_form) }}
From 716a0ac3f156459e9c6f6bcaab4769d2c64b4171 Mon Sep 17 00:00:00 2001 From: Jef van Schendel Date: Sat, 28 May 2011 21:02:34 +0200 Subject: [PATCH 05/30] Styled error messages --- mediagoblin/static/css/base.css | 118 +++++++++--------- .../templates/mediagoblin/utils/wtforms.html | 12 +- 2 files changed, 67 insertions(+), 63 deletions(-) diff --git a/mediagoblin/static/css/base.css b/mediagoblin/static/css/base.css index 26bf8bd9..618aaee0 100644 --- a/mediagoblin/static/css/base.css +++ b/mediagoblin/static/css/base.css @@ -1,9 +1,9 @@ body { - background-color: #272727; - color: #f7f7f7; - font-family: sans; - padding:none; - margin:0px; + background-color: #272727; + color: #f7f7f7; + font-family: sans; + padding:none; + margin:0px; } /* Carter One font */ @@ -18,15 +18,13 @@ body { /* text styles */ h1 { - font-family: 'Carter One', arial, serif; - margin-bottom: 20px; - margin-top:40px; + font-family: 'Carter One', arial, serif; + margin-bottom: 20px; + margin-top:40px; } -28px - a { - color: #86D4B1; + color: #86D4B1; } label { @@ -36,82 +34,90 @@ label { /* website structure */ .mediagoblin_header { - width:100%; - height:36px; - background-color:#393939; - padding-top:14px; - margin-bottom:40px; + width:100%; + height:36px; + background-color:#393939; + padding-top:14px; + margin-bottom:40px; } .icon { - vertical-align:middle; - margin-right:10px; + vertical-align:middle; + margin-right:10px; } .mediagoblin_container { - width: 960px; - margin-left: auto; - margin-right: auto; + width: 960px; + margin-left: auto; + margin-right: auto; } .mediagoblin_header_right { - float:right; + float:right; } .button { - font-family:'Carter One', arial, serif; - height:32px; - min-width:99px; - background-color:#86d4b1; - box-shadow:0px 0px 4px #000; - border-radius:5px; - border:none; - color:#272727; - margin:10px; - font-size:1em; - float:left; - display:block; - text-align:center; - padding-left:11px; - padding-right:11px; + font-family:'Carter One', arial, serif; + height:32px; + min-width:99px; + background-color:#86d4b1; + box-shadow:0px 0px 4px #000; + border-radius:5px; + border:none; + color:#272727; + margin:10px; + font-size:1em; + float:left; + display:block; + text-align:center; + padding-left:11px; + padding-right:11px; } /* common website elements */ .dotted_line { - width:100%; - height:0px; - border-bottom: dotted 1px #5f5f5f; - position:absolute; - left:0px; - margin-top:-20px; + width:100%; + height:0px; + border-bottom: dotted 1px #5f5f5f; + position:absolute; + left:0px; + margin-top:-20px; } /* forms */ .form_box { - width:300px; - margin-left:auto; - margin-right:auto; - background-color:#393939; - padding:0px 83px 83px; - border-top:5px solid #d49086; - font-size:18px; + width:300px; + margin-left:auto; + margin-right:auto; + background-color:#393939; + padding:0px 83px 83px; + border-top:5px solid #d49086; + font-size:18px; } .form_box h1 { - font-size:28px; + font-size:28px; } .form_field_input input { - width:300px; - font-size:18px; + width:300px; + font-size:18px; } .form_field_box { - margin-bottom:20px; + margin-bottom:24px; } -.form_field_label { - margin-bottom:4px; +.form_field_label,.form_field_input { + margin-bottom:4px; +} + +.form_field_error { + background-color:#87453b; + border:none; + font-size:16px; + padding:9px; + margin-top:8px; } diff --git a/mediagoblin/templates/mediagoblin/utils/wtforms.html b/mediagoblin/templates/mediagoblin/utils/wtforms.html index 4a37ab33..9adf8e53 100644 --- a/mediagoblin/templates/mediagoblin/utils/wtforms.html +++ b/mediagoblin/templates/mediagoblin/utils/wtforms.html @@ -26,13 +26,11 @@ {%- endif %}
{{ field }}
{%- if field.errors -%} -
-
    - {% for error in field.errors %} -
  • {{ error }}
  • - {% endfor %} -
-
+ {% for error in field.errors %} +
+ {{ error }} +
+ {% endfor %} {%- endif %}
{% endfor %} From b0ff25c82cdf424a54b388bb084cfd6849683662 Mon Sep 17 00:00:00 2001 From: Jef van Schendel Date: Sat, 28 May 2011 21:10:54 +0200 Subject: [PATCH 06/30] Changed login forms to use divs instead of tables --- .../templates/mediagoblin/auth/login.html | 30 ++++++++----------- 1 file changed, 13 insertions(+), 17 deletions(-) diff --git a/mediagoblin/templates/mediagoblin/auth/login.html b/mediagoblin/templates/mediagoblin/auth/login.html index 02bfb91f..27a3e52a 100644 --- a/mediagoblin/templates/mediagoblin/auth/login.html +++ b/mediagoblin/templates/mediagoblin/auth/login.html @@ -20,25 +20,21 @@ {% import "/mediagoblin/utils/wtforms.html" as wtforms_util %} {% block mediagoblin_content %} -

Login:

- - {% if login_failed %} -

Login failed!

- {% endif %} - - - {{ wtforms_util.render_table(login_form) }} - - - - -
- - {% if next %} - - {% endif %} + {% endblock %} From 7c2005b6e2fdc9665ffc5b443f6450f9d5b34b16 Mon Sep 17 00:00:00 2001 From: Jef van Schendel Date: Sat, 28 May 2011 21:15:15 +0200 Subject: [PATCH 07/30] Forgot a bottom-margin for the error div --- mediagoblin/static/css/base.css | 1 + 1 file changed, 1 insertion(+) diff --git a/mediagoblin/static/css/base.css b/mediagoblin/static/css/base.css index 618aaee0..fbe84c9c 100644 --- a/mediagoblin/static/css/base.css +++ b/mediagoblin/static/css/base.css @@ -120,4 +120,5 @@ label { font-size:16px; padding:9px; margin-top:8px; + margin-bottom:8px; } From b5cc7afea210cb1fc2e607f75d4922136ba4ecb5 Mon Sep 17 00:00:00 2001 From: Jef van Schendel Date: Sat, 28 May 2011 21:32:12 +0200 Subject: [PATCH 08/30] Fixed submit button style, added create-account notice to log in page --- mediagoblin/static/css/base.css | 8 ++++++-- mediagoblin/templates/mediagoblin/auth/login.html | 1 + 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/mediagoblin/static/css/base.css b/mediagoblin/static/css/base.css index fbe84c9c..672cc04c 100644 --- a/mediagoblin/static/css/base.css +++ b/mediagoblin/static/css/base.css @@ -23,6 +23,11 @@ h1 { margin-top:40px; } +p { + font-family: sans; + font-size:16px; +} + a { color: #86D4B1; } @@ -67,7 +72,6 @@ label { color:#272727; margin:10px; font-size:1em; - float:left; display:block; text-align:center; padding-left:11px; @@ -92,7 +96,7 @@ label { margin-left:auto; margin-right:auto; background-color:#393939; - padding:0px 83px 83px; + padding:0px 83px 30px 83px; border-top:5px solid #d49086; font-size:18px; } diff --git a/mediagoblin/templates/mediagoblin/auth/login.html b/mediagoblin/templates/mediagoblin/auth/login.html index 27a3e52a..22a57b70 100644 --- a/mediagoblin/templates/mediagoblin/auth/login.html +++ b/mediagoblin/templates/mediagoblin/auth/login.html @@ -35,6 +35,7 @@ {% if next %} {% endif %} +

Don't have an account yet? Create one here!

{% endblock %} From 491dd3ff47826b419764f6379474dcb859e6dcb1 Mon Sep 17 00:00:00 2001 From: Joar Wandborg Date: Sat, 28 May 2011 23:19:44 +0200 Subject: [PATCH 09/30] *GNU* MediaGoblin on --- mediagoblin/templates/mediagoblin/base.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediagoblin/templates/mediagoblin/base.html b/mediagoblin/templates/mediagoblin/base.html index b0c88a13..3306448d 100644 --- a/mediagoblin/templates/mediagoblin/base.html +++ b/mediagoblin/templates/mediagoblin/base.html @@ -17,7 +17,7 @@ #} <html> <head> - <title>{% block title %}MediaGoblin{% endblock title %} + {% block title %}GNU MediaGoblin{% endblock title %} {% block mediagoblin_head %} From 00cc5cb7455e1430e5bc060d3fb2a230b5b5c562 Mon Sep 17 00:00:00 2001 From: Joar Wandborg Date: Sat, 28 May 2011 23:54:15 +0200 Subject: [PATCH 10/30] Changed font from 'sans' to 'sans-serif' --- mediagoblin/static/css/base.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediagoblin/static/css/base.css b/mediagoblin/static/css/base.css index 672cc04c..c62086fa 100644 --- a/mediagoblin/static/css/base.css +++ b/mediagoblin/static/css/base.css @@ -1,7 +1,7 @@ body { background-color: #272727; color: #f7f7f7; - font-family: sans; + font-family: sans-serif; padding:none; margin:0px; } From df901af738b6be18b7e8049e308f6797c21fbd92 Mon Sep 17 00:00:00 2001 From: Joar Wandborg Date: Sat, 28 May 2011 23:56:29 +0200 Subject: [PATCH 11/30] Changed

font from 'sans' to 'sans-serif' --- mediagoblin/static/css/base.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediagoblin/static/css/base.css b/mediagoblin/static/css/base.css index c62086fa..cc60d7c9 100644 --- a/mediagoblin/static/css/base.css +++ b/mediagoblin/static/css/base.css @@ -24,7 +24,7 @@ h1 { } p { - font-family: sans; + font-family: sans-serif; font-size:16px; } From f0e621c8f564f70517600c96880f8ca3fc60f7ff Mon Sep 17 00:00:00 2001 From: Jef van Schendel Date: Sun, 29 May 2011 01:14:48 +0200 Subject: [PATCH 12/30] Changed submit form to divs --- mediagoblin/static/css/base.css | 4 ++++ .../templates/mediagoblin/submit/start.html | 15 +++++++-------- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/mediagoblin/static/css/base.css b/mediagoblin/static/css/base.css index cc60d7c9..55e5a02e 100644 --- a/mediagoblin/static/css/base.css +++ b/mediagoblin/static/css/base.css @@ -101,6 +101,10 @@ label { font-size:18px; } +.submit_box { + width:600px; +} + .form_box h1 { font-size:28px; } diff --git a/mediagoblin/templates/mediagoblin/submit/start.html b/mediagoblin/templates/mediagoblin/submit/start.html index 8fdbe4ed..75c31df4 100644 --- a/mediagoblin/templates/mediagoblin/submit/start.html +++ b/mediagoblin/templates/mediagoblin/submit/start.html @@ -20,16 +20,15 @@ {% import "/mediagoblin/utils/wtforms.html" as wtforms_util %} {% block mediagoblin_content %} -

Submit yer media

- - {{ wtforms_util.render_table(submit_form) }} - - - - -
+
+

Submit yer media

+ {{ wtforms_util.render_divs(submit_form) }} +
+ +
+
{% endblock %} From 722d6a970568019b8be09129f2d5b65382bccabf Mon Sep 17 00:00:00 2001 From: Jef van Schendel Date: Sun, 29 May 2011 01:43:12 +0200 Subject: [PATCH 13/30] Modified logo to change on :hover --- mediagoblin/static/css/base.css | 12 ++++++++++-- mediagoblin/static/images/icon.png | Bin 960 -> 1670 bytes mediagoblin/templates/mediagoblin/base.html | 4 ++-- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/mediagoblin/static/css/base.css b/mediagoblin/static/css/base.css index 55e5a02e..53efd079 100644 --- a/mediagoblin/static/css/base.css +++ b/mediagoblin/static/css/base.css @@ -46,9 +46,17 @@ label { margin-bottom:40px; } -.icon { - vertical-align:middle; +a.mediagoblin_logo { + width:34px; + height:25px; margin-right:10px; + background-image:url('../images/icon.png'); + background-position:0px 0px; + display:inline-block; +} + +a.mediagoblin_logo:hover { + background-position:0px -28px; } .mediagoblin_container { diff --git a/mediagoblin/static/images/icon.png b/mediagoblin/static/images/icon.png index 47f07b9a4351a1c8f1192ab80dc15fc8c895e536..4f4f3e9c3c1b43c0f4149e031b69e34b2e9ce95b 100644 GIT binary patch delta 1609 zcmV-P2DbUY2Zjxh7Ya291^@s6B$PSfks%rj4b}hv4b}mWZ+V=NMkjv;14%?dR9J<@ zn7wZt*A>No_s))HmrIEhMN$5UkS2x0!cBkxLH>at2#|_EfK*B0A|FKxBSi;RzrQ)(mu1;`_MgY~w$2d3sXkKm`~B^U?s^0r;A-1|nQeMw$F63J`hLGM27^KC zX*AfJCYjiYe0IwE-8|2i(==V4OePENzF=kxRaGsx`vTDEcDwHYq-nYmyM8m<>Hr3; zL?-;Nt-mbGUr2v?8_1F*A%uW?eYlclHuZ_V0}w)3F|$@8RaI^I-rn8{khDz*A$;D} zFX>g_EFSx0YPfqeGTnXKvn*SSO)#^~$k6RGkT^sHcr`Yu+wE?92;tTV3vE3wB9dbJ z41vNWwfYCti6%0168U-T%n^z0vkTy677eQq!WR*OXL^50&OeBm#eAeDA}LD5-P?#< zIq5g^ko0)&-&l&+1?af@S}eY^EIUS|D2laM7&aIK`@o*0f6w)|k~g!O$O%qV0$(2O z?Dcxj%Ch{Sq#}fncRHOxRaJx0Xf#+_TFQY@WWAehosw!IKrDP){R7y`vg}wj*X#8X zpufMreZG4%xr&gJRWj-$J!>rmEJ9?Q41Wpy(Ll1!7cyKx3kshS}llO%~^lL z{Xpr3sg= z)k1z}ePiUI@~Ag^MEhD?f*gXxOzBxXhtxHz`w2B`)vkR7XVSj1F#jN@XkSA7Ye3RD zM&wT)Jm?YmD0l4l@&oOwQ?xI#sE>bKc~%@FlJ~nWC5OXs1U3K-gyn_?82gAlPxRqz zmfLk&%2IJ4Ib%ff-+XVQING^3e)QSnboG^S>BY;{cK*h9-WbOoO2r??r( zBCY<>Z2ai=@4w%9w9Mik{_)qoEG&BJ{e-Ys$@-2Kk(PwtmT3*?rkTCcmd}3h5 zYsNEf-Tl{J{*I9#xv;LGKG-6tf8{1wtUpmyymdZ6!4 z7qHn%&sTm}b0SV$gkK7z0}&n#-%Ek(6R4vmr`97zec|I-GbU)JX=^#_3x$G>fsrMf74lFhSdrknzg_>)#{mBaIjzmP5TDY?00000NkvXX Hu0mjfN}L?x delta 893 zcmV-@1A_d94ZsJG7YZ2&1^@s6RQmj^ks%rj4haAN4haE93953DMkjv*JxN4CR7i=% zmcMUXRTze!_xRemcC0jQ(l#K0Ixq!<#Dc_@0U;p)8#^l!3?QUREK!6|29%Mde?|rt zmiz%!U7%%*gamOKl8XA;vE!VV;o8P(?g@_6!YljQ=l65I^L^)jvdz~1Uf$?F{Y-Mx zD6?G;fy|~3WLR~AGns$7Q3kGCWWmae>zK^Ykd%XSLDP^Ua!eD*fsC}CW&jJlzcwts zGXO>cd#0NV<%h|$tQvO`Xr^sCbasx*RSN(St<62;MM!i4fFi5^D~QKOW5rdCje7<4 zfG2{&PyhwEuv7#n9919}HUom9%sKL>n41@;(s2eLX*G48hHrmr(*0;3A)jQ_kMo93 zK7Z}~!Bxq(f7$({vOzv9En-%a_AuYyef`7ERToX@MrCdE*hfhE$mr~i2alfz!M*$U z>Oi}?H5`;6N`Q#YCY$kjfE+EXRa*lvKA0X&B}e49)ZnfCy}Z@yEsxIQa?HG3Gc8A2 zh8BSqj*Ce7*Xw^D?EuK(I!f-TlWnmT8oYJAl2p|o+YfiYY?z%9K!6a(ch}@%n-t6+ zzz#sv`Hhf>OhYF$9=yF$PIplfzgLe`MF>{vWb!8q;gT`#gs?EWm2AcbiKbVt3KFAV zPIVf!uRRWi+i8%H0P!nV1-WFM-sYW+(_muKo27VIT~B|~iqGiJ=@?wSj!M{oRq3bz zilOojG0gRnlsKFzR9_J;VFQo^p>}=&WNUvf$6T8S#O7$Gw35I*hB8@6`baixT>#1Y zy{i5Z=mLeHYv>`K2>mp(V8R7F0nu6_gXw+s=6l7nm7`{>)9jwC$4q_q7mEC}+x_C5 zkNc_3%&33TuROJge6yOvmHx4LXX6xj1mj~mJzf0v(GRzR&lV$Y%VE*DU6Ym!w^jPn zOF(7#YHAU)RJ{SMZ2!FbBY}FEtI`A(fi^0C8>R*|0wX|7Zcd?Ts`+o(q9ztGT2giQ zHsalXa@85lpNr0+SVoQTToLf1WS15Rq>`2YO2JvbLK(gVut53ZjKJCSD@MQ&GcXzm z4?zRtq3}RxXnR1=5InHM0OBwZ28MwgyQZu|>f7{#)OUz|NA+uj
{% block mediagoblin_logo %} - - {% endblock %}{% block mediagoblin_header_title %}GNU MediaGoblin Home{% endblock %} + + {% endblock %}{% block mediagoblin_header_title %}{% endblock %}
{% if request.user %} {{ request.user['username'] }}'s account From 37a00748264bc47b5ceb3971622eea4858aef9dd Mon Sep 17 00:00:00 2001 From: Jef van Schendel Date: Sun, 29 May 2011 01:47:12 +0200 Subject: [PATCH 14/30] Centered image on media page --- mediagoblin/static/css/base.css | 8 ++++++++ .../mediagoblin/user_pages/media.html | 20 +++++++++---------- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/mediagoblin/static/css/base.css b/mediagoblin/static/css/base.css index 53efd079..5d2189c7 100644 --- a/mediagoblin/static/css/base.css +++ b/mediagoblin/static/css/base.css @@ -138,3 +138,11 @@ a.mediagoblin_logo:hover { margin-top:8px; margin-bottom:8px; } + +/* media pages */ + +img.media_image { + display:block; + margin-left:auto; + margin-right:auto; +} diff --git a/mediagoblin/templates/mediagoblin/user_pages/media.html b/mediagoblin/templates/mediagoblin/user_pages/media.html index 036bf726..475a15ff 100644 --- a/mediagoblin/templates/mediagoblin/user_pages/media.html +++ b/mediagoblin/templates/mediagoblin/user_pages/media.html @@ -20,18 +20,17 @@ {# temporarily, an "image gallery" that isn't one really ;) #} {% if media %} -

- Media details for - - {{- media.uploader().username }} - / {{media.title}} -

-
-
+

+ Media details for + + {{- media.uploader().username }} + / {{media.title}} +

Uploaded on {{ "%4d-%02d-%02d"|format(media.created.year, media.created.month, media.created.day) }} @@ -41,7 +40,6 @@ {{- media.uploader().username }}
Description: {{ media.description }} -
{% else %}

Sorry, no such media found.

{% endif %} From d3060210bc47f0647500c3a8298ea311bf5bac32 Mon Sep 17 00:00:00 2001 From: Jef van Schendel Date: Sun, 29 May 2011 01:53:41 +0200 Subject: [PATCH 15/30] Slightly modified text on media page --- .../templates/mediagoblin/user_pages/media.html | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/mediagoblin/templates/mediagoblin/user_pages/media.html b/mediagoblin/templates/mediagoblin/user_pages/media.html index 475a15ff..886962d1 100644 --- a/mediagoblin/templates/mediagoblin/user_pages/media.html +++ b/mediagoblin/templates/mediagoblin/user_pages/media.html @@ -22,25 +22,18 @@ {% if media %} -

- Media details for - - {{- media.uploader().username }} - / {{media.title}} + {{media.title}}

- Uploaded on +

{{ media.description }}

+

Uploaded on {{ "%4d-%02d-%02d"|format(media.created.year, media.created.month, media.created.day) }} by - {{- media.uploader().username }} -
- Description: {{ media.description }} + {{- media.uploader().username }}

{% else %}

Sorry, no such media found.

{% endif %} -{% endblock %} +{% endblock %} From dfd18edadcae821a5b6dc0bb48310e24caa796ec Mon Sep 17 00:00:00 2001 From: Jef van Schendel Date: Sun, 29 May 2011 02:02:26 +0200 Subject: [PATCH 16/30] First changes to media gallery view --- mediagoblin/static/css/base.css | 12 ++++++++++++ .../templates/mediagoblin/utils/object_gallery.html | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/mediagoblin/static/css/base.css b/mediagoblin/static/css/base.css index 5d2189c7..5d928b9a 100644 --- a/mediagoblin/static/css/base.css +++ b/mediagoblin/static/css/base.css @@ -146,3 +146,15 @@ img.media_image { margin-left:auto; margin-right:auto; } + +li.media_thumbnail { + width: 200px; + min-height: 250px; + display: -moz-inline-stack; + display: inline-block; + vertical-align: top; + margin: 5px; + zoom: 1; + *display: inline; + _height: 250px; +} diff --git a/mediagoblin/templates/mediagoblin/utils/object_gallery.html b/mediagoblin/templates/mediagoblin/utils/object_gallery.html index 30497f47..c9c3e0db 100644 --- a/mediagoblin/templates/mediagoblin/utils/object_gallery.html +++ b/mediagoblin/templates/mediagoblin/utils/object_gallery.html @@ -21,7 +21,7 @@ {% if media_entries %}

    {% for entry in media_entries %} -
  • +
  • From ce72a1bb15f421725696cc3eea28b94de098f8f2 Mon Sep 17 00:00:00 2001 From: Jakob Kramer Date: Sun, 29 May 2011 19:15:46 +0200 Subject: [PATCH 17/30] this should fix #354 --- mediagoblin/auth/views.py | 13 +++++++++---- mediagoblin/db/models.py | 3 ++- mediagoblin/templates/mediagoblin/base.html | 2 +- .../templates/mediagoblin/user_pages/user.html | 2 +- 4 files changed, 13 insertions(+), 7 deletions(-) diff --git a/mediagoblin/auth/views.py b/mediagoblin/auth/views.py index c3d24c74..8775d4c4 100644 --- a/mediagoblin/auth/views.py +++ b/mediagoblin/auth/views.py @@ -14,6 +14,7 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . +import re from webob import Response, exc @@ -31,8 +32,11 @@ def register(request): if request.method == 'POST' and register_form.validate(): # TODO: Make sure the user doesn't exist already + users_with_username = \ - request.db.User.find({'username': request.POST['username']}).count() + request.db.User.find({ + 'username': request.POST['username'].lower() + }).count() if users_with_username: register_form.username.errors.append( @@ -41,7 +45,8 @@ def register(request): else: # Create the user entry = request.db.User() - entry['username'] = request.POST['username'] + entry['username'] = request.POST['username'].lower() + entry['username_repr'] = request.POST['username'] entry['email'] = request.POST['email'] entry['pw_hash'] = auth_lib.bcrypt_gen_password_hash( request.POST['password']) @@ -61,7 +66,7 @@ def register(request): # example "GNU MediaGoblin @ Wandborg - [...]". 'GNU MediaGoblin - Verify email', email_template.render( - username=entry['username'], + username=entry['username_repr'], verification_url='http://{host}{uri}?userid={userid}&token={verification_key}'.format( host=request.host, uri=request.urlgen('mediagoblin.auth.verify_email'), @@ -101,7 +106,7 @@ def login(request): if request.method == 'POST' and login_form.validate(): user = request.db.User.one( - {'username': request.POST['username']}) + {'username': request.POST['username'].lower()}) if user and user.check_login(request.POST['password']): # set up login in session diff --git a/mediagoblin/db/models.py b/mediagoblin/db/models.py index 37420834..0b4390d7 100644 --- a/mediagoblin/db/models.py +++ b/mediagoblin/db/models.py @@ -38,6 +38,7 @@ class User(Document): structure = { 'username': unicode, + 'username_repr': unicode, 'email': unicode, 'created': datetime.datetime, 'plugin_data': dict, # plugins can dump stuff here. @@ -48,7 +49,7 @@ class User(Document): 'is_admin': bool, } - required_fields = ['username', 'created', 'pw_hash', 'email'] + required_fields = ['username', 'username_repr', 'created', 'pw_hash', 'email'] default_values = { 'created': datetime.datetime.utcnow, diff --git a/mediagoblin/templates/mediagoblin/base.html b/mediagoblin/templates/mediagoblin/base.html index 704e5aa7..df803196 100644 --- a/mediagoblin/templates/mediagoblin/base.html +++ b/mediagoblin/templates/mediagoblin/base.html @@ -34,7 +34,7 @@ {% endblock %}{% block mediagoblin_header_title %}{% endblock %}
    {% if request.user %} - {{ request.user['username'] }}'s account + {{ request.user['username_repr'] }}'s account (logout) {% else %} diff --git a/mediagoblin/templates/mediagoblin/user_pages/user.html b/mediagoblin/templates/mediagoblin/user_pages/user.html index 2d09f685..b9c98568 100644 --- a/mediagoblin/templates/mediagoblin/user_pages/user.html +++ b/mediagoblin/templates/mediagoblin/user_pages/user.html @@ -26,7 +26,7 @@ {% block mediagoblin_content -%} {% if user %} -

    User page for '{{ user.username }}'

    +

    User page for '{{ user.username_repr }}'

      From ff6b9f7279d7ee2efceae933da43f4a9b6459465 Mon Sep 17 00:00:00 2001 From: Jakob Kramer Date: Sun, 29 May 2011 19:17:44 +0200 Subject: [PATCH 18/30] don't import 're' --- mediagoblin/auth/views.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/mediagoblin/auth/views.py b/mediagoblin/auth/views.py index 8775d4c4..cf71be77 100644 --- a/mediagoblin/auth/views.py +++ b/mediagoblin/auth/views.py @@ -14,8 +14,6 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . -import re - from webob import Response, exc from mediagoblin.auth import lib as auth_lib From db5912e358043c90194c6409fa09ab07d16df4c3 Mon Sep 17 00:00:00 2001 From: Jakob Kramer Date: Sun, 29 May 2011 19:49:25 +0200 Subject: [PATCH 19/30] remove all 'username_repr' stuff --- mediagoblin/auth/views.py | 3 +-- mediagoblin/db/models.py | 3 +-- mediagoblin/templates/mediagoblin/base.html | 2 +- mediagoblin/templates/mediagoblin/user_pages/user.html | 2 +- 4 files changed, 4 insertions(+), 6 deletions(-) diff --git a/mediagoblin/auth/views.py b/mediagoblin/auth/views.py index cf71be77..6b5ce88c 100644 --- a/mediagoblin/auth/views.py +++ b/mediagoblin/auth/views.py @@ -44,7 +44,6 @@ def register(request): # Create the user entry = request.db.User() entry['username'] = request.POST['username'].lower() - entry['username_repr'] = request.POST['username'] entry['email'] = request.POST['email'] entry['pw_hash'] = auth_lib.bcrypt_gen_password_hash( request.POST['password']) @@ -64,7 +63,7 @@ def register(request): # example "GNU MediaGoblin @ Wandborg - [...]". 'GNU MediaGoblin - Verify email', email_template.render( - username=entry['username_repr'], + username=entry['username'], verification_url='http://{host}{uri}?userid={userid}&token={verification_key}'.format( host=request.host, uri=request.urlgen('mediagoblin.auth.verify_email'), diff --git a/mediagoblin/db/models.py b/mediagoblin/db/models.py index 0b4390d7..37420834 100644 --- a/mediagoblin/db/models.py +++ b/mediagoblin/db/models.py @@ -38,7 +38,6 @@ class User(Document): structure = { 'username': unicode, - 'username_repr': unicode, 'email': unicode, 'created': datetime.datetime, 'plugin_data': dict, # plugins can dump stuff here. @@ -49,7 +48,7 @@ class User(Document): 'is_admin': bool, } - required_fields = ['username', 'username_repr', 'created', 'pw_hash', 'email'] + required_fields = ['username', 'created', 'pw_hash', 'email'] default_values = { 'created': datetime.datetime.utcnow, diff --git a/mediagoblin/templates/mediagoblin/base.html b/mediagoblin/templates/mediagoblin/base.html index df803196..704e5aa7 100644 --- a/mediagoblin/templates/mediagoblin/base.html +++ b/mediagoblin/templates/mediagoblin/base.html @@ -34,7 +34,7 @@ {% endblock %}{% block mediagoblin_header_title %}{% endblock %}
      {% if request.user %} - {{ request.user['username_repr'] }}'s account + {{ request.user['username'] }}'s account (logout) {% else %} diff --git a/mediagoblin/templates/mediagoblin/user_pages/user.html b/mediagoblin/templates/mediagoblin/user_pages/user.html index b9c98568..2d09f685 100644 --- a/mediagoblin/templates/mediagoblin/user_pages/user.html +++ b/mediagoblin/templates/mediagoblin/user_pages/user.html @@ -26,7 +26,7 @@ {% block mediagoblin_content -%} {% if user %} -

      User page for '{{ user.username_repr }}'

      +

      User page for '{{ user.username }}'

        From 660e60482444f387d0c12f5c601b58a40a2eb829 Mon Sep 17 00:00:00 2001 From: Christopher Allan Webber Date: Sun, 29 May 2011 17:43:18 -0500 Subject: [PATCH 20/30] This
          not used (second inside), removing --- mediagoblin/templates/mediagoblin/user_pages/user.html | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/mediagoblin/templates/mediagoblin/user_pages/user.html b/mediagoblin/templates/mediagoblin/user_pages/user.html index 2d09f685..b3708c85 100644 --- a/mediagoblin/templates/mediagoblin/user_pages/user.html +++ b/mediagoblin/templates/mediagoblin/user_pages/user.html @@ -28,11 +28,8 @@ {% if user %}

          User page for '{{ user.username }}'

          -
            - - {% include "mediagoblin/utils/object_gallery.html" %} + {% include "mediagoblin/utils/object_gallery.html" %} -
          atom feed From 8bfc87e18e0d3654ddb85b8644002ce6d3610f05 Mon Sep 17 00:00:00 2001 From: Christopher Allan Webber Date: Sun, 29 May 2011 17:49:03 -0500 Subject: [PATCH 21/30] Use the object gallery file on the front page also --- mediagoblin/templates/mediagoblin/root.html | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/mediagoblin/templates/mediagoblin/root.html b/mediagoblin/templates/mediagoblin/root.html index 05926687..e5344e08 100644 --- a/mediagoblin/templates/mediagoblin/root.html +++ b/mediagoblin/templates/mediagoblin/root.html @@ -41,15 +41,7 @@ {# temporarily, an "image gallery" that isn't one really ;) #}
          -
            - {% for entry in media_entries %} -
          • - - -
          • - {% endfor %} -
          + {% include "mediagoblin/utils/object_gallery.html" %}
          {% endblock %} From b1ae76aea0141354b479e1c0451bc003e9b6e248 Mon Sep 17 00:00:00 2001 From: Christopher Allan Webber Date: Mon, 30 May 2011 18:06:12 -0500 Subject: [PATCH 22/30] Add an index on MediaEntries making sure slugs + uploader combos are unique --- mediagoblin/db/models.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/mediagoblin/db/models.py b/mediagoblin/db/models.py index 37420834..3da97a49 100644 --- a/mediagoblin/db/models.py +++ b/mediagoblin/db/models.py @@ -95,7 +95,7 @@ class MediaEntry(Document): 'thumbnail_file': [unicode]} required_fields = [ - 'uploader', 'created', 'media_type'] + 'uploader', 'created', 'media_type', 'slug'] default_values = { 'created': datetime.datetime.utcnow, @@ -103,11 +103,10 @@ class MediaEntry(Document): migration_handler = migrations.MediaEntryMigration - # Actually we should referene uniqueness by uploader, but we - # should fix http://bugs.foocorp.net/issues/340 first. - # indexes = [ - # {'fields': ['uploader', 'slug'], - # 'unique': True}] + indexes = [ + # Referene uniqueness of slugs by uploader + {'fields': ['uploader', 'slug'], + 'unique': True}] def main_mediafile(self): pass From 28afb47ca82b0857aad546ef4cbf869de1ca95a5 Mon Sep 17 00:00:00 2001 From: Aleksandar Micovic Date: Mon, 30 May 2011 23:51:30 -0400 Subject: [PATCH 23/30] Added a temporary verification page informing the user they need to authenticate. --- mediagoblin/auth/routing.py | 4 ++- mediagoblin/auth/views.py | 15 ++++++++++ mediagoblin/decorators.py | 2 +- .../mediagoblin/auth/verification_needed.html | 29 +++++++++++++++++++ 4 files changed, 48 insertions(+), 2 deletions(-) create mode 100644 mediagoblin/templates/mediagoblin/auth/verification_needed.html diff --git a/mediagoblin/auth/routing.py b/mediagoblin/auth/routing.py index 59762840..9544b165 100644 --- a/mediagoblin/auth/routing.py +++ b/mediagoblin/auth/routing.py @@ -26,4 +26,6 @@ auth_routes = [ Route('mediagoblin.auth.logout', '/logout/', controller='mediagoblin.auth.views:logout'), Route('mediagoblin.auth.verify_email', '/verify_email/', - controller='mediagoblin.auth.views:verify_email')] + controller='mediagoblin.auth.views:verify_email'), + Route('mediagoblin.auth.verify_email_notice', '/verification_required/', + controller='mediagoblin.auth.views:verify_email_notice')] diff --git a/mediagoblin/auth/views.py b/mediagoblin/auth/views.py index 6b5ce88c..edac74a8 100644 --- a/mediagoblin/auth/views.py +++ b/mediagoblin/auth/views.py @@ -168,3 +168,18 @@ def verify_email(request): {'request': request, 'user': user, 'verification_successful': verification_successful})) + +def verify_email_notice(request): + """ + Verify warning view. + + When the user tries to do some action that requires their account + to be verified beforehand, this view is called upon! + """ + + template = request.template_env.get_template( + 'mediagoblin/auth/verification_needed.html') + return Response( + template.render( + {'request': request})) + diff --git a/mediagoblin/decorators.py b/mediagoblin/decorators.py index ff3f0b5e..bb625667 100644 --- a/mediagoblin/decorators.py +++ b/mediagoblin/decorators.py @@ -41,7 +41,7 @@ def require_active_login(controller): # here because an *active* user is required. return exc.HTTPFound( location="%s?next=%s" % ( - request.urlgen("mediagoblin.auth.login"), + request.urlgen("mediagoblin.auth.verify_email_notice"), request.path_info)) return controller(request, *args, **kwargs) diff --git a/mediagoblin/templates/mediagoblin/auth/verification_needed.html b/mediagoblin/templates/mediagoblin/auth/verification_needed.html new file mode 100644 index 00000000..26ea84dc --- /dev/null +++ b/mediagoblin/templates/mediagoblin/auth/verification_needed.html @@ -0,0 +1,29 @@ +{# +# GNU MediaGoblin -- federated, autonomous media hosting +# Copyright (C) 2011 Free Software Foundation, Inc +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +#} +{% extends "mediagoblin/base.html" %} + +{% block mediagoblin_content %} +

          + Verfication needed!
          + Please check your email to verify your account. +

          + +

          + Still haven't received an email? Click here to resend it. +

          +{% endblock %} From bcec749b52c287a6d361fd06bfbd833e03e5b478 Mon Sep 17 00:00:00 2001 From: Aleksandar Micovic Date: Tue, 31 May 2011 15:26:00 -0400 Subject: [PATCH 24/30] Fixed bug where someone who wasn't logged in was asked to verify their emails. --- mediagoblin/decorators.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/mediagoblin/decorators.py b/mediagoblin/decorators.py index bb625667..bc12d61c 100644 --- a/mediagoblin/decorators.py +++ b/mediagoblin/decorators.py @@ -36,12 +36,13 @@ def require_active_login(controller): Require an active login from the user. """ def new_controller_func(request, *args, **kwargs): - if not request.user or not request.user.get('status') == u'active': - # TODO: Indicate to the user that they were redirected - # here because an *active* user is required. + if request.user and request.user.get('status') == u'needs_email_verification': + return exc.HTTPFound( + location = request.urlgen('mediagoblin.auth.verify_email_notice')) + elif not request.user or request.user.get('status') != u'active': return exc.HTTPFound( location="%s?next=%s" % ( - request.urlgen("mediagoblin.auth.verify_email_notice"), + request.urlgen("mediagoblin.auth.login"), request.path_info)) return controller(request, *args, **kwargs) From b93a6a229e1c7a7eef76e8322104912378f79a96 Mon Sep 17 00:00:00 2001 From: Aleksandar Micovic Date: Tue, 31 May 2011 17:14:23 -0400 Subject: [PATCH 25/30] Added the ability to regenerate a verification key. --- mediagoblin/auth/routing.py | 4 +- mediagoblin/auth/views.py | 41 +++++++++++++++++++ mediagoblin/db/models.py | 8 ++++ .../mediagoblin/auth/verification_needed.html | 2 +- 4 files changed, 53 insertions(+), 2 deletions(-) diff --git a/mediagoblin/auth/routing.py b/mediagoblin/auth/routing.py index 9544b165..069e3019 100644 --- a/mediagoblin/auth/routing.py +++ b/mediagoblin/auth/routing.py @@ -28,4 +28,6 @@ auth_routes = [ Route('mediagoblin.auth.verify_email', '/verify_email/', controller='mediagoblin.auth.views:verify_email'), Route('mediagoblin.auth.verify_email_notice', '/verification_required/', - controller='mediagoblin.auth.views:verify_email_notice')] + controller='mediagoblin.auth.views:verify_email_notice'), + Route('mediagoblin.auth.resend_verification', '/resend_verification/', + controller='mediagoblin.auth.views:resend_activation')] diff --git a/mediagoblin/auth/views.py b/mediagoblin/auth/views.py index edac74a8..22fdd46b 100644 --- a/mediagoblin/auth/views.py +++ b/mediagoblin/auth/views.py @@ -183,3 +183,44 @@ def verify_email_notice(request): template.render( {'request': request})) +def resend_activation(request): + """ + The reactivation view + + Resend the activation email. + """ + + request.user.generate_new_verification_key() + + # Copied shamelessly from the register view above. + + email_template = request.template_env.get_template( + 'mediagoblin/auth/verification_email.txt') + + # TODO: There is no error handling in place + send_email( + mgoblin_globals.email_sender_address, + [request.user['email']], + # TODO + # Due to the distributed nature of GNU MediaGoblin, we should + # find a way to send some additional information about the + # specific GNU MediaGoblin instance in the subject line. For + # example "GNU MediaGoblin @ Wandborg - [...]". + 'GNU MediaGoblin - Verify email', + email_template.render( + username=request.user['username'], + verification_url='http://{host}{uri}?userid={userid}&token={verification_key}'.format( + host=request.host, + uri=request.urlgen('mediagoblin.auth.verify_email'), + userid=unicode(request.user['_id']), + verification_key=request.user['verification_key']))) + + + # TODO: For now, we use the successful registration page until we get a + # proper messaging system. + + template = request.template_env.get_template( + 'mediagoblin/auth/register_success.html') + return exc.HTTPFound( + location=request.urlgen('mediagoblin.auth.register_success')) + diff --git a/mediagoblin/db/models.py b/mediagoblin/db/models.py index 37420834..0e933fb7 100644 --- a/mediagoblin/db/models.py +++ b/mediagoblin/db/models.py @@ -64,6 +64,14 @@ class User(Document): return auth_lib.bcrypt_check_password( password, self['pw_hash']) + def generate_new_verification_key(self): + """ + Create a new verification key, overwriting the old one. + """ + + self['verification_key'] = unicode(uuid.uuid4()) + self.save(validate=False) + class MediaEntry(Document): __collection__ = 'media_entries' diff --git a/mediagoblin/templates/mediagoblin/auth/verification_needed.html b/mediagoblin/templates/mediagoblin/auth/verification_needed.html index 26ea84dc..4104da19 100644 --- a/mediagoblin/templates/mediagoblin/auth/verification_needed.html +++ b/mediagoblin/templates/mediagoblin/auth/verification_needed.html @@ -24,6 +24,6 @@

          - Still haven't received an email? Click here to resend it. + Still haven't received an email? Click here to resend it.

          {% endblock %} From 5866d1a8fbe31709fe21b2c830f7ee3eab7b3775 Mon Sep 17 00:00:00 2001 From: Christopher Allan Webber Date: Tue, 31 May 2011 19:29:36 -0500 Subject: [PATCH 26/30] Give a "proper" view for resending verification email --- mediagoblin/auth/routing.py | 5 +++- mediagoblin/auth/views.py | 17 +++++++------ .../auth/resent_verification_email.html | 24 +++++++++++++++++++ 3 files changed, 38 insertions(+), 8 deletions(-) create mode 100644 mediagoblin/templates/mediagoblin/auth/resent_verification_email.html diff --git a/mediagoblin/auth/routing.py b/mediagoblin/auth/routing.py index 069e3019..a8909fbb 100644 --- a/mediagoblin/auth/routing.py +++ b/mediagoblin/auth/routing.py @@ -30,4 +30,7 @@ auth_routes = [ Route('mediagoblin.auth.verify_email_notice', '/verification_required/', controller='mediagoblin.auth.views:verify_email_notice'), Route('mediagoblin.auth.resend_verification', '/resend_verification/', - controller='mediagoblin.auth.views:resend_activation')] + controller='mediagoblin.auth.views:resend_activation'), + Route('mediagoblin.auth.resend_verification_success', + '/resend_verification_success/', + controller='mediagoblin.auth.views:resend_activation_success')] diff --git a/mediagoblin/auth/views.py b/mediagoblin/auth/views.py index 22fdd46b..15cd65e5 100644 --- a/mediagoblin/auth/views.py +++ b/mediagoblin/auth/views.py @@ -140,6 +140,7 @@ def logout(request): return exc.HTTPFound( location=request.urlgen("index")) + def verify_email(request): """ Email verification view @@ -183,6 +184,7 @@ def verify_email_notice(request): template.render( {'request': request})) + def resend_activation(request): """ The reactivation view @@ -215,12 +217,13 @@ def resend_activation(request): userid=unicode(request.user['_id']), verification_key=request.user['verification_key']))) - - # TODO: For now, we use the successful registration page until we get a - # proper messaging system. - - template = request.template_env.get_template( - 'mediagoblin/auth/register_success.html') return exc.HTTPFound( - location=request.urlgen('mediagoblin.auth.register_success')) + location=request.urlgen('mediagoblin.auth.resend_verification_success')) + +def resend_activation_success(request): + template = request.template_env.get_template( + 'mediagoblin/auth/resent_verification_email.html') + return Response( + template.render( + {'request': request})) diff --git a/mediagoblin/templates/mediagoblin/auth/resent_verification_email.html b/mediagoblin/templates/mediagoblin/auth/resent_verification_email.html new file mode 100644 index 00000000..da3a9e99 --- /dev/null +++ b/mediagoblin/templates/mediagoblin/auth/resent_verification_email.html @@ -0,0 +1,24 @@ +{# +# GNU MediaGoblin -- federated, autonomous media hosting +# Copyright (C) 2011 Free Software Foundation, Inc +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +#} +{% extends "mediagoblin/base.html" %} + +{% block mediagoblin_content %} +

          + Resent your verification email. +

          +{% endblock %} From a72c504b257c7e2a2c3fec7da67bad5e0f6095be Mon Sep 17 00:00:00 2001 From: Christopher Allan Webber Date: Tue, 31 May 2011 19:30:05 -0500 Subject: [PATCH 27/30] Just adjusting some spacing so we don't go over 80 chars --- mediagoblin/decorators.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/mediagoblin/decorators.py b/mediagoblin/decorators.py index bc12d61c..a5bede54 100644 --- a/mediagoblin/decorators.py +++ b/mediagoblin/decorators.py @@ -36,9 +36,11 @@ def require_active_login(controller): Require an active login from the user. """ def new_controller_func(request, *args, **kwargs): - if request.user and request.user.get('status') == u'needs_email_verification': + if request.user and \ + request.user.get('status') == u'needs_email_verification': return exc.HTTPFound( - location = request.urlgen('mediagoblin.auth.verify_email_notice')) + location = request.urlgen( + 'mediagoblin.auth.verify_email_notice')) elif not request.user or request.user.get('status') != u'active': return exc.HTTPFound( location="%s?next=%s" % ( From 73a1bc85f1beb257169c777452eb878fa7e684a1 Mon Sep 17 00:00:00 2001 From: Christopher Allan Webber Date: Tue, 31 May 2011 19:31:23 -0500 Subject: [PATCH 28/30] Moving import to outside of this function --- mediagoblin/auth/views.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediagoblin/auth/views.py b/mediagoblin/auth/views.py index 15cd65e5..906d6f13 100644 --- a/mediagoblin/auth/views.py +++ b/mediagoblin/auth/views.py @@ -14,6 +14,7 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . +import bson.objectid from webob import Response, exc from mediagoblin.auth import lib as auth_lib @@ -148,7 +149,6 @@ def verify_email(request): validates GET parameters against database and unlocks the user account, if you are lucky :) """ - import bson.objectid user = request.db.User.find_one( {'_id': bson.objectid.ObjectId(unicode(request.GET.get('userid')))}) From 155f24f9f5ac1c944addddf84c7a129d55f63263 Mon Sep 17 00:00:00 2001 From: Christopher Allan Webber Date: Tue, 31 May 2011 19:37:28 -0500 Subject: [PATCH 29/30] If a user doesn't provide a userid and a token to the verify_email function, might as well 404 --- mediagoblin/auth/views.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/mediagoblin/auth/views.py b/mediagoblin/auth/views.py index 906d6f13..4ccd3d86 100644 --- a/mediagoblin/auth/views.py +++ b/mediagoblin/auth/views.py @@ -149,12 +149,16 @@ def verify_email(request): validates GET parameters against database and unlocks the user account, if you are lucky :) """ + # If we don't have userid and token parameters, we can't do anything; 404 + if not request.GET.has_key('userid') or not request.GET.has_key('token'): + return exc.HTTPNotFound() + user = request.db.User.find_one( - {'_id': bson.objectid.ObjectId(unicode(request.GET.get('userid')))}) + {'_id': bson.objectid.ObjectId(unicode(request.GET['userid']))}) verification_successful = bool - if user and user['verification_key'] == unicode(request.GET.get('token')): + if user and user['verification_key'] == unicode(request.GET['token']): user['status'] = u'active' user['email_verified'] = True verification_successful = True From 4d4b49a84e2791da6b12ef580565251c379264b6 Mon Sep 17 00:00:00 2001 From: Christopher Allan Webber Date: Tue, 31 May 2011 19:54:26 -0500 Subject: [PATCH 30/30] 0.0.2 of GNU MediaGoblin! --- setup.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 752f1b57..097dd7f2 100644 --- a/setup.py +++ b/setup.py @@ -18,7 +18,7 @@ from setuptools import setup, find_packages setup( name = "mediagoblin", - version = "0.0.1", + version = "0.0.2", packages=find_packages(exclude=['ez_setup', 'examples', 'tests']), zip_safe=False, # scripts and dependencies @@ -45,7 +45,7 @@ setup( test_suite='nose.collector', license = 'AGPLv3', - author = 'Christopher Webber', + author = 'Free Software Foundation and contributors', author_email = 'cwebber@gnu.org', entry_points = """\ [console_scripts]