diff --git a/snipt/media/css/style.scss b/snipt/media/css/style.scss index 8918894..c4cfb66 100644 --- a/snipt/media/css/style.scss +++ b/snipt/media/css/style.scss @@ -65,11 +65,6 @@ body { li { line-height: normal; } - a, button { - &:focus { - outline: none; - } - } } // Utils @@ -155,7 +150,7 @@ header.main { height: auto; margin: 0; padding: 7px; - padding-left: 28px; + text-indent: 21px; width: 175px; @include border-radius(3px); @include inset-box-shadow(0, 1px, 0px, #1D4249); @@ -233,7 +228,7 @@ header.sub { max-width: 490px; line-height: normal; overflow: hidden; - padding: 5px 0 7px 0; + padding: 2px 0 4px 0; text-overflow: ellipsis; white-space: nowrap; @@ -259,7 +254,7 @@ header.sub { color: #999999; float: right; font: bold 12px $Consolas; - padding-top: 7px; + padding-top: 4px; text-shadow: 0 1px 0 #FFF; } } @@ -629,6 +624,7 @@ article.snipt { top: -3px; width: 3px; -webkit-transform: rotate(-45deg); + -moz-transform: rotate(-45deg); } } &.embed { @@ -887,16 +883,17 @@ body.detail { } } } -body.account { - form.account-form { +body.static { + .static-box { background: rgba(#FFF, .65); + border: 1px solid #DDDDDD; margin: 20px; padding: 20px; - @include border-radius(10px); + @include border-radius(4px); div.form-actions { margin-bottom: 0; - @include multi-border-radius(0, 0, 5px, 5px); + @include vertical-gradient(#F5F5F5, #FBFBFB); } div.alert { ul { @@ -907,5 +904,17 @@ body.account { } } } + div.alert-info { + a { + color: #3A87AD; + text-decoration: underline; + } + } + } + aside.main { + padding-top: 20px; + } + div.alert-alone { + margin: 0; } } diff --git a/snipt/media/js/plugins/jquery.hotkeys.js b/snipt/media/js/plugins/jquery.hotkeys.js index bb2280d..73d2a18 100644 --- a/snipt/media/js/plugins/jquery.hotkeys.js +++ b/snipt/media/js/plugins/jquery.hotkeys.js @@ -1,6 +1,6 @@ (function(jQuery){jQuery.hotkeys={version:"0.8",specialKeys:{8:"backspace",9:"tab",13:"return",16:"shift",17:"ctrl",18:"alt",19:"pause",20:"capslock",27:"esc",32:"space",33:"pageup",34:"pagedown",35:"end",36:"home",37:"left",38:"up",39:"right",40:"down",45:"insert",46:"del",96:"0",97:"1",98:"2",99:"3",100:"4",101:"5",102:"6",103:"7",104:"8",105:"9",106:"*",107:"+",109:"-",110:".",111:"/",112:"f1",113:"f2",114:"f3",115:"f4",116:"f5",117:"f6",118:"f7",119:"f8",120:"f9",121:"f10",122:"f11",123:"f12",144:"numlock",145:"scroll",191:"/",224:"meta"},shiftNums:{"`":"~","1":"!","2":"@","3":"#","4":"$","5":"%","6":"^","7":"&","8":"*","9":"(","0":")","-":"_","=":"+",";":": ","'":"\"",",":"<",".":">","/":"?","\\":"|"}};function keyHandler(handleObj){if(typeof handleObj.data!=="string"){return;} -var origHandler=handleObj.handler,keys=handleObj.data.toLowerCase().split(" ");handleObj.handler=function(event){if(this!==event.target&&(/textarea|select/i.test(event.target.nodeName)||event.target.type==="text")){return;} +var origHandler=handleObj.handler,keys=handleObj.data.toLowerCase().split(" ");handleObj.handler=function(event){if(this!==event.target&&(/textarea|select/i.test(event.target.nodeName)||event.target.type==="text"||event.target.type === "password")){return;} var special=event.type!=="keypress"&&jQuery.hotkeys.specialKeys[event.which],character=String.fromCharCode(event.which).toLowerCase(),key,modif="",possible={};if(event.altKey&&special!=="alt"){modif+="alt+";} if(event.ctrlKey&&special!=="ctrl"){modif+="ctrl+";} if(event.metaKey&&!event.ctrlKey&&special!=="meta"){modif+="meta+";} diff --git a/snipt/media/js/src/modules/site.js b/snipt/media/js/src/modules/site.js index c4277e0..c8a6ee5 100644 --- a/snipt/media/js/src/modules/site.js +++ b/snipt/media/js/src/modules/site.js @@ -53,16 +53,13 @@ e.preventDefault(); $search_query.focus(); }); - $document.bind('keydown', 'Shift+/', function(e) { + $document.bind('keydown', 'h', function(e) { $el.trigger('showKeyboardShortcuts'); }); $('input').bind('keydown', 'esc', function(e) { e.preventDefault(); this.blur(); }); - $document.bind('keydown', 'Shift+h', function(e) { - history.go(-1); - }); }, showKeyboardShortcuts: function() { $('#keyboard-shortcuts').modal('toggle'); diff --git a/snipt/media/js/src/modules/snipt.js b/snipt/media/js/src/modules/snipt.js index 48a03d6..c62a1de 100644 --- a/snipt/media/js/src/modules/snipt.js +++ b/snipt/media/js/src/modules/snipt.js @@ -189,9 +189,6 @@ } window.scrollTo(0, document.body.scrollHeight); }); - $document.bind('keydown', 'h', function() { - window.location = '/'; - }); $document.bind('keydown', 'n', function() { var $anc = $('li.next a'); if ($anc.length) { diff --git a/snipt/settings.py b/snipt/settings.py index 1a9b3e0..65dd67c 100644 --- a/snipt/settings.py +++ b/snipt/settings.py @@ -193,6 +193,7 @@ VIRTUALENV_PATH = '/Users/Nick/.virtualenvs/snipt/lib/python2.7/site-packages/' LOGIN_REDIRECT_URL = '/' LOGIN_URL = '/login/' LOGOUT_URL = '/logout/' +ACCOUNT_ACTIVATION_DAYS = 0 # HTTPS USE_HTTPS = False diff --git a/snipt/snipts/utils.py b/snipt/snipts/utils.py index 666d1c1..a5c9ec2 100644 --- a/snipt/snipts/utils.py +++ b/snipt/snipts/utils.py @@ -1,4 +1,7 @@ +from django.contrib.auth import authenticate, login from django.template.defaultfilters import slugify +from registration.signals import user_registered + def slugify_uniquely(value, model, slugfield="slug"): suffix = 0 @@ -10,3 +13,14 @@ def slugify_uniquely(value, model, slugfield="slug"): if not model.objects.filter(**{slugfield: potential}).count(): return potential suffix += 1 + +def activate_user(user, request, **kwargs): + user.is_active = True + user.save() + + user = authenticate(username=request.POST['username'], + password=request.POST['password1']) + login(request, user) + + +user_registered.connect(activate_user) diff --git a/snipt/snipts/views.py b/snipt/snipts/views.py index 61cb299..2dcbc57 100644 --- a/snipt/snipts/views.py +++ b/snipt/snipts/views.py @@ -41,9 +41,11 @@ def list_user(request, username, tag_slug=None): if user == request.user: tags = tags.filter(snipt__user=user) snipts = snipts.filter(user=user) + public = False else: tags = tags.filter(snipt__user=user, snipt__public=True) snipts = snipts.filter(user=user, public=True) + public = True tags = tags.annotate(count=Count('taggit_taggeditem_items__id')) tags = tags.order_by('-count', 'name') @@ -53,6 +55,7 @@ def list_user(request, username, tag_slug=None): snipts = snipts.filter(tags__name__in=[tag_slug]) return { + 'public': public, 'snipts': snipts, 'tags': tags, 'tag': tag_slug, diff --git a/snipt/templates/api.html b/snipt/templates/api.html new file mode 100644 index 0000000..322b43a --- /dev/null +++ b/snipt/templates/api.html @@ -0,0 +1,12 @@ +{% extends "base.html" %} + +{% block page-title %}API - {{ block.super }}{% endblock %} + +{% block body-class %}{{ block.super }} api static{% endblock %} +{% block sub-header %}{% endblock %} + +{% block content %} +
+ This is where the API documentation will be. +
+{% endblock %} diff --git a/snipt/templates/base.html b/snipt/templates/base.html index 1a58d35..d6da793 100644 --- a/snipt/templates/base.html +++ b/snipt/templates/base.html @@ -54,10 +54,10 @@ @@ -82,7 +88,7 @@ {% block breadcrumb %}{% endblock %}
- Type "?" for KB shortcuts + Type "h" for KB shortcuts
@@ -138,7 +144,7 @@ - ? + h Show keyboard shortcuts @@ -157,14 +163,6 @@ G Scroll to bottom of page - - H - Go back - - - h - Go to home - n Next page diff --git a/snipt/templates/registration/activate.html b/snipt/templates/registration/activate.html index bcefa00..e69de29 100644 --- a/snipt/templates/registration/activate.html +++ b/snipt/templates/registration/activate.html @@ -1,11 +0,0 @@ -{% extends "base.html" %} - -{% block page-title %}{% if account %}Activation Complete{% else %}Activation Problem{% endif %} - {{ block.super }}{% endblock %} - -{% block content %} - {% if account %} - Thanks {{ account }}, activation complete! You may now login using the username and password you set at registration. - {% else %} - Oops – it seems that your activation key is invalid. Please check the url again. - {% endif %} -{% endblock %} diff --git a/snipt/templates/registration/activation_complete.html b/snipt/templates/registration/activation_complete.html index 4a067d6..e69de29 100644 --- a/snipt/templates/registration/activation_complete.html +++ b/snipt/templates/registration/activation_complete.html @@ -1,16 +0,0 @@ -{% extends "base.html" %} - -{% block page-title %}Activation Complete - {{ block.super }}{% endblock %} - -{% block body-class %}{{ block.super }} activation-complete{% endblock %} - -{% block content %} -
-

Sign up for Smooth Wallet

-
-
- Thanks, activation complete! You may now login using the username and password you set at registration. -
-
-
-{% endblock %} diff --git a/snipt/templates/registration/activation_email.txt b/snipt/templates/registration/activation_email.txt index 43a743a..a3a18cd 100644 --- a/snipt/templates/registration/activation_email.txt +++ b/snipt/templates/registration/activation_email.txt @@ -1,16 +1,11 @@ -Hi, +Hey there, -You recently signed up for LivePlay using this email address. Just to make sure that this is in fact a valid email, we need you to confirm it. +Welcome to Snipt. If you ever have any thoughts or issues with the site whatsoever, please feel free to contact me directly. -To do so, just click the following link: -https://{{site.domain}}/accounts/activate/{{ activation_key }} +Thanks! -That link will expire in {{ expiration_days}} days, so if you don't confirm your email within that time, your account will be marked inactive and you'll need to sign up again. - -If you didn't sign up for LivePlay using this email address, then you can safely ignore this email. As long as you don't click that link above, the account will not be confirmed and you won't have an account opened using your email address. - -But if you continue to receive these emails, don't hesitate to yell at us and we'll straighten it out. To do so just reply to this email and let us know what's going on. - -Thanks again for trying out LivePlay. - -The LivePlay Team +Nick Sergeant +http://twitter.com/nicksergeant +http://twitter.com/snipt +nick@snipt.net +http://snipt.net diff --git a/snipt/templates/registration/activation_email_subject.txt b/snipt/templates/registration/activation_email_subject.txt index 5e63a64..ba01a99 100644 --- a/snipt/templates/registration/activation_email_subject.txt +++ b/snipt/templates/registration/activation_email_subject.txt @@ -1 +1 @@ -Please confirm your email address... +Welcome to Snipt! diff --git a/snipt/templates/registration/login.html b/snipt/templates/registration/login.html index b2518ed..a88ddcf 100644 --- a/snipt/templates/registration/login.html +++ b/snipt/templates/registration/login.html @@ -2,11 +2,13 @@ {% block page-title %}Login - {{ block.super }}{% endblock %} -{% block html-class %}account{% endblock %} -{% block body-class %}{{ block.super }} account login {% if request.GET.activationcomplete %}activation-complete{% endif %}{% endblock %} +{% block body-class %}{{ block.super }} static{% endblock %} {% block content %} -
+ +
+ Notice: OpenID is no longer supported. You can reset your password here. +
{% if request.GET.activationcomplete %}
Successfully confirmed email! Log in below. @@ -24,7 +26,7 @@ {% endif %} {% endif %}
- Login + Log in
diff --git a/snipt/templates/registration/logout.html b/snipt/templates/registration/logout.html index 0e6e3d9..ccf6f6a 100644 --- a/snipt/templates/registration/logout.html +++ b/snipt/templates/registration/logout.html @@ -1,15 +1,13 @@ -{% extends "base.html" %} +{% extends "registration/registration_base.html" %} -{% block page-title %}Logged Out - {{ block.super }}{% endblock %} +{% block page-title %}Logged out - {{ block.super }}{% endblock %} -{% block body-class %}{{ block.super }} signin{% endblock %} +{% block body-class %}{{ block.super }} static{% endblock %} {% block content %} -
-
-
- Successfully logged out. Log in again? -
+
+
+ Successfully logged out. Log in again?
-
+
{% endblock %} diff --git a/snipt/templates/registration/password_change_done.html b/snipt/templates/registration/password_change_done.html index b8acd7d..e3b7c9c 100644 --- a/snipt/templates/registration/password_change_done.html +++ b/snipt/templates/registration/password_change_done.html @@ -1,19 +1,13 @@ -{% extends "app-base.html" %} +{% extends "registration/registration_base.html" %} -{% block page-title %}Password Changed - {{ block.super }}{% endblock %} +{% block page-title %}Password reset - {{ block.super }}{% endblock %} -{% block body-class %}{{ block.super }} account{% endblock %} - -{% block banner %} -

- Settings - Account Information -

-{% endblock %} +{% block body-class %}{{ block.super }} static{% endblock %} {% block content %} -
- Password changed successfully. +
+
+ Password successfully changed. +
{% endblock %} - diff --git a/snipt/templates/registration/password_change_form.html b/snipt/templates/registration/password_change_form.html index 4090d5a..5f46e05 100644 --- a/snipt/templates/registration/password_change_form.html +++ b/snipt/templates/registration/password_change_form.html @@ -1,8 +1,8 @@ -{% extends "app-base.html" %} +{% extends "registration/registration_base.html" %} -{% block page-title %}Account Information - {{ block.super }}{% endblock %} +{% block page-title %}Reset password - {{ block.super }}{% endblock %} -{% block body-class %}{{ block.super }} account{% endblock %} +{% block body-class %}{{ block.super }} static{% endblock %} {% block banner %}

diff --git a/snipt/templates/registration/password_reset_complete.html b/snipt/templates/registration/password_reset_complete.html index bcf3603..aa77440 100644 --- a/snipt/templates/registration/password_reset_complete.html +++ b/snipt/templates/registration/password_reset_complete.html @@ -1,13 +1,13 @@ -{% extends "base.html" %} +{% extends "registration/registration_base.html" %} -{% block page-title %}Password Reset Complete - {{ block.super }}{% endblock %} +{% block page-title %}Password reset - {{ block.super }}{% endblock %} + +{% block body-class %}{{ block.super }} static{% endblock %} {% block content %} -
-
-
- Your password has been reset! You may now log in. -
+
+
+ Password successfully changed. You may now log in.
-
+

{% endblock %} diff --git a/snipt/templates/registration/password_reset_confirm.html b/snipt/templates/registration/password_reset_confirm.html index 60196ca..8971619 100644 --- a/snipt/templates/registration/password_reset_confirm.html +++ b/snipt/templates/registration/password_reset_confirm.html @@ -1,36 +1,61 @@ -{% extends "base.html" %} +{% extends "registration/registration_base.html" %} -{% block page-title %}Confirm Password Reset - {{ block.super }}{% endblock %} +{% block page-title %}Reset password - {{ block.super }}{% endblock %} -{% block body-class %}{{ block.super }} signin new-password{% endblock %} +{% block body-class %}{{ block.super }} static{% endblock %} {% block content %} -
-
-
- {% if form.errors %} -
- {{ form.new_password1.errors }} - {{ form.new_password2.errors }} + {% if form %} + + {% if form.errors %} + {% if form.non_field_errors %} +
+ {{ form.non_field_errors }} +
+ {% else %} +
+ Please fix the errors below.
{% endif %} -
- Enter your new password below to reset your password: -
- {% csrf_token %} -
-
- {{ form.new_password1.label_tag }} - {{ form.new_password1 }} -
-
- {{ form.new_password2.label_tag }} - {{ form.new_password2 }} -
+ {% endif %} +
+ Reset password +
+ +
+ {{ form.new_password1 }} + {% if form.errors.new_password1 %} + + {% for error in form.errors.new_password1 %} + {{ error }} + {% endfor %} + + {% endif %}
- - +
+
+ +
+ {{ form.new_password2 }} + {% if form.errors.new_password2 %} + + {% for error in form.errors.new_password2 %} + {{ error }} + {% endfor %} + + {% endif %} +
+
+
+ +
+ {% csrf_token %} + + {% else %} +
+
+ This password reset URL is no longer valid.
-
+ {% endif %} {% endblock %} diff --git a/snipt/templates/registration/password_reset_done.html b/snipt/templates/registration/password_reset_done.html index 660235e..467ee62 100644 --- a/snipt/templates/registration/password_reset_done.html +++ b/snipt/templates/registration/password_reset_done.html @@ -1,13 +1,13 @@ -{% extends "base.html" %} +{% extends "registration/registration_base.html" %} -{% block page-title %}Password Reset - {{ block.super }}{% endblock %} +{% block page-title %}Password reset - {{ block.super }}{% endblock %} + +{% block body-class %}{{ block.super }} static{% endblock %} {% block content %} -
-
-
- We have sent you an email with a link to reset your password. Please check your email and click the link to continue. -
+
+
+ We've sent an email with a link to reset your password. Follow the link to continue.
-
+
{% endblock %} diff --git a/snipt/templates/registration/password_reset_email.html b/snipt/templates/registration/password_reset_email.html index f02c301..6b7b4ad 100644 --- a/snipt/templates/registration/password_reset_email.html +++ b/snipt/templates/registration/password_reset_email.html @@ -1 +1,3 @@ -Reset your Smooth Wallet password here: {{ protocol }}://{{ domain }}{% url auth_password_reset_confirm uid token %} +Reset your Snipt password here: {{ protocol }}://{{ domain }}{% url auth_password_reset_confirm uid token %} + +(btw, your username is "{{ user }}") diff --git a/snipt/templates/registration/password_reset_form.html b/snipt/templates/registration/password_reset_form.html index bc9f618..17222b1 100644 --- a/snipt/templates/registration/password_reset_form.html +++ b/snipt/templates/registration/password_reset_form.html @@ -1,54 +1,43 @@ -{% extends "base.html" %} +{% extends "registration/registration_base.html" %} {% block page-title %}Reset password - {{ block.super }}{% endblock %} -{% block html-class %}account{% endblock %} -{% block body-class %}{{ block.super }} account forgot-password{% endblock %} +{% block body-class %}{{ block.super }} static{% endblock %} {% block content %} -

Smooth Wallet

-
+
+ Log in + Sign up + +
+ {% csrf_token %} + {% endblock %} diff --git a/snipt/templates/registration/registration_complete.html b/snipt/templates/registration/registration_complete.html index 027020b..b64fabc 100644 --- a/snipt/templates/registration/registration_complete.html +++ b/snipt/templates/registration/registration_complete.html @@ -1,11 +1,13 @@ -{% extends "base.html" %} +{% extends "registration/registration_base.html" %} -{% block page-title %}Registration Complete - {{ block.super }}{% endblock %} +{% block page-title %}Signup complete - {{ block.super }}{% endblock %} -{% block body-class %}{{ block.super }} signup signup-complete{% endblock %} +{% block body-class %}{{ block.super }} static{% endblock %} {% block content %} -
- All done! -
+
+
+ Signup complete! You're now logged in. Go home, perhaps? +
+
{% endblock %} diff --git a/snipt/templates/registration/registration_form.html b/snipt/templates/registration/registration_form.html index 91b3ffc..f70de69 100644 --- a/snipt/templates/registration/registration_form.html +++ b/snipt/templates/registration/registration_form.html @@ -1,90 +1,81 @@ -{% extends "base.html" %} +{% extends "registration/registration_base.html" %} -{% block page-title %}Sign up - {{ block.super }}{% endblock %} +{% block page-title %}Signup - {{ block.super }}{% endblock %} -{% block html-class %}account{% endblock %} -{% block body-class %}{{ block.super }} account signup{% endblock %} +{% block body-class %}{{ block.super }} static{% endblock %} {% block content %} -

Smooth Wallet

-