mirror of
https://github.com/samuelclay/NewsBlur.git
synced 2025-09-18 21:50:56 +00:00
I think I added a login button.
This commit is contained in:
parent
53255eb960
commit
2610b5b0d3
8 changed files with 115 additions and 12 deletions
|
@ -2,7 +2,7 @@ from django.conf.urls.defaults import *
|
|||
from apps.reader import views
|
||||
|
||||
urlpatterns = patterns('',
|
||||
(r'^$', views.index),
|
||||
url(r'^$', views.index, name='index'),
|
||||
(r'^load_single_feed', views.load_single_feed),
|
||||
(r'^load_feed_page', views.load_feed_page),
|
||||
(r'^load_feeds', views.load_feeds),
|
||||
|
|
|
@ -12,7 +12,9 @@ from apps.reader.models import UserSubscription, UserSubscriptionFolders, UserSt
|
|||
from utils import json
|
||||
from utils.user_functions import get_user
|
||||
from django.contrib.auth.models import User
|
||||
from django.http import HttpResponse, HttpRequest
|
||||
from django.contrib.auth.forms import AuthenticationForm
|
||||
from django.contrib.auth import authenticate, login
|
||||
from django.http import HttpResponse, HttpRequest, HttpResponseRedirect
|
||||
from django.core import serializers
|
||||
from django.utils.safestring import mark_safe
|
||||
from django.views.decorators.cache import cache_page
|
||||
|
@ -32,12 +34,21 @@ def index(request):
|
|||
# context = feeds
|
||||
context = {}
|
||||
print request.user
|
||||
form = AuthenticationForm(request.POST)
|
||||
user = request.user
|
||||
user_info = _parse_user_info(user)
|
||||
context.update(user_info)
|
||||
return render_to_response('reader/feeds.xhtml', context,
|
||||
return render_to_response('reader/feeds.xhtml', {'form': form},
|
||||
context_instance=RequestContext(request))
|
||||
|
||||
def login(request):
|
||||
username = request.POST['username']
|
||||
password = request.POST['password']
|
||||
user = authenticate(username=username, password=password)
|
||||
if user is not None:
|
||||
if user.is_active:
|
||||
login(request, user)
|
||||
return HttpResponseRedirect(reverse('index'))
|
||||
|
||||
def load_feeds(request):
|
||||
user = get_user(request)
|
||||
|
||||
|
|
|
@ -38,11 +38,11 @@ urlpatterns = patterns('apps.registration.views',
|
|||
name='registration_activate'),
|
||||
url(r'^login/$',
|
||||
auth_views.login,
|
||||
{'template_name': 'registration/login.html'},
|
||||
{'template_name': 'reader/feeds.xhtml'},
|
||||
name='auth_login'),
|
||||
url(r'^logout/$',
|
||||
auth_views.logout,
|
||||
{'template_name': 'registration/login.html'},
|
||||
{'template_name': 'reader/feeds.xhtml'},
|
||||
name='auth_logout'),
|
||||
url(r'^password/change/$',
|
||||
auth_views.password_change,
|
||||
|
|
|
@ -33,6 +33,66 @@ a img {
|
|||
background: #e0e0e0 url('../img/reader/resize_north.png') repeat-x 50% 50%;
|
||||
}
|
||||
|
||||
/* =============== */
|
||||
/* = Splash page = */
|
||||
/* =============== */
|
||||
|
||||
.NB-login {
|
||||
position: absolute;
|
||||
right: 0;
|
||||
top: 40px;
|
||||
}
|
||||
|
||||
.NB-login input[type=text],
|
||||
.NB-login input[type=password] {
|
||||
border:1px solid #D3D5DE;
|
||||
display:block;
|
||||
font-size:13px;
|
||||
margin:0 0 5px;
|
||||
padding:5px;
|
||||
width:100%;
|
||||
}
|
||||
|
||||
.NB-login input[type=text]:focus,
|
||||
.NB-login input[type=password]:focus {
|
||||
border-color: #739BBE;
|
||||
}
|
||||
|
||||
.NB-login input[type=submit] {
|
||||
/* height: 40px;*/
|
||||
outline: none;
|
||||
width: 100px;
|
||||
margin: 4px 5px 0 0;
|
||||
padding: 4px 10px 5px;
|
||||
text-shadow: 0 -1px 0 #C7C9D2;
|
||||
font-weight: bold;
|
||||
font-size: 13px;
|
||||
border: 1px solid #ABAEB5;
|
||||
color: #202020;
|
||||
background: #dadada url('../theme/images/dadada_40x100_textures_03_highlight_soft_75.png') 0 50% repeat-x;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
|
||||
.NB-login input[type=submit]:hover {
|
||||
/* background: #dadada url('../theme/images/dadada_40x100_textures_03_highlight_soft_75.png') 0 50% repeat-x;*/
|
||||
color: #000;
|
||||
border-color: #6F7283;
|
||||
/* font-weight: bold;*/
|
||||
}
|
||||
|
||||
.NB-login input[type=hidden] {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.NB-login label {
|
||||
margin-top: 2px;
|
||||
color:#90A0B0;
|
||||
font-size:13px;
|
||||
display: block;
|
||||
/* text-transform: uppercase;*/
|
||||
}
|
||||
|
||||
/* ============= */
|
||||
/* = Feed List = */
|
||||
/* ============= */
|
||||
|
@ -698,9 +758,9 @@ form.opml_import_form input {
|
|||
position: absolute;
|
||||
bottom: 0;
|
||||
margin: 0 auto;
|
||||
height: 300px;
|
||||
height: 100px;
|
||||
width: 600px;
|
||||
background: transparent url('../img/reader/newsblur_splash_logo.png') no-repeat 0 0;
|
||||
background: transparent url('../img/reader/newsblur_splash_logo.png') no-repeat 0 -200px;
|
||||
}
|
||||
|
||||
#NB-splash .NB-splash-image {
|
||||
|
|
|
@ -78,6 +78,11 @@
|
|||
load_page: function() {
|
||||
// this.resize_story_content_pane();
|
||||
// this.resize_feed_list_pane();
|
||||
this.stylize_login_form();
|
||||
},
|
||||
|
||||
stylize_login_form: function() {
|
||||
// DD_roundies.addRule('.NB-login form input', '4px');
|
||||
},
|
||||
|
||||
apply_resizable_layout: function() {
|
||||
|
|
|
@ -14,9 +14,9 @@
|
|||
|
||||
var NEWSBLUR = {};
|
||||
NEWSBLUR.Globals = {
|
||||
'is_authenticated': {{ user_info.is_authenticated|safe }},
|
||||
'is_anonymous': {{ user_info.is_anonymous|safe }},
|
||||
'username': {{ user_info.username|safe }}
|
||||
'is_authenticated': {% if user.is_authenticated %}true{% else %}false{% endif %},
|
||||
'is_anonymous': {% if user.is_anonymous %}true{% else %}false{% endif %},
|
||||
'username': "{{ user.username|safe }}"
|
||||
};
|
||||
|
||||
</script>
|
||||
|
|
|
@ -32,6 +32,33 @@
|
|||
<div class="right-pane">
|
||||
|
||||
<div id="NB-splash">
|
||||
{% if user.is_authenticated %}
|
||||
<div class="NB-user">
|
||||
Welcome, {{ user.username}}.
|
||||
(<a href="{% url auth_logout %}?next=/">Logout</a>)
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if not user.is_authenticated %}
|
||||
<div class="NB-login">
|
||||
{% if form.errors %}
|
||||
<p>{{ form.errors }}</p>
|
||||
{% endif %}
|
||||
|
||||
<form method="post" action="{% url auth_login %}">
|
||||
<div>
|
||||
{{ form.username.label_tag }}
|
||||
{{ form.username }}
|
||||
</div>
|
||||
<div>
|
||||
{{ form.password.label_tag }}
|
||||
{{ form.password }}
|
||||
</div>
|
||||
|
||||
<input type="submit" value="login" />
|
||||
<input type="hidden" name="next" value="/" />
|
||||
</form>
|
||||
</div>
|
||||
{% endif %}
|
||||
{# <div class="NB-splash-image"></div> #}
|
||||
<div class="NB-splash-title"></div>
|
||||
</div>
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
</table>
|
||||
|
||||
<input type="submit" value="login" />
|
||||
<input type="hidden" name="next" value="{{ next }}" />
|
||||
<input type="hidden" name="next" value="/" />
|
||||
</form>
|
||||
|
||||
{% endblock %}
|
Loading…
Add table
Reference in a new issue