Changeset 25290acc63caf78e159b89159db8bb7201e552b5


Ignore:
Timestamp:
31.07.2013 12:38:49 (8 years ago)
Author:
Stanislaw Klekot <dozzie@…>
Branches:
b66903eafbcb1d49112014abc82c8bf683413db0
Children:
0f22660ae601b23c4744e4739c77a44e4edcbd20
Parents:
c3434c172c1e0dc74450c47075cc49eb8d7cd0bf
git-author:
Stanislaw Klekot <dozzie@…> (31.07.2013 12:38:49)
git-committer:
Stanislaw Klekot <dozzie@…> (31.07.2013 12:38:49)
Message:

Login/logout moved to Django messaging.

Location:
dashwiki/users
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • dashwiki/users/templates/login.html

    re0fb71 r25290a  
    44 
    55{% block body %} 
    6  
    7 {% if error %} 
    8 <p class="error"> 
    9   {{ error }} 
    10 </p> 
    11 {% endif %} 
    12  
    13 {% if message %} 
    14 <p class="message"> 
    15   {{ message }} 
    16 </p> 
    17 {% endif %} 
    18  
    196{% if success %} 
    207<p> 
     
    4229</form> 
    4330{% endif %} 
    44  
    4531{% endblock %} 
  • dashwiki/users/templates/logout.html

    re0fb71 r25290a  
    44 
    55{% block body %} 
    6  
    7 {% if error %} 
    8 <p class="error"> 
    9   {{ error }} 
    10 </p> 
    11 {% endif %} 
    12  
    13 {% if message %} 
    14 <p class="message"> 
    15   {{ message }} 
    16 </p> 
    17 {% endif %} 
    18  
    196<p> 
    207Go to <a href="{% url home_page %}">main page</a>. 
    218</p> 
    22  
    239{% endblock %} 
  • dashwiki/users/views.py

    r1b550f r25290a  
    66from django.http import HttpResponse 
    77from django.template import RequestContext, loader 
     8from django.contrib import messages 
    89 
    910from dashwiki.decorators import on_cancel 
     
    2627    'success': False, 
    2728    'tried': False, 
    28     #'message': None, 
    29     #'error': None, 
    3029  }) 
    3130 
     
    4746        django_login(request, user) 
    4847        context['success'] = True 
    49         context['message'] = 'Logged in successfully.' 
     48        messages.success(request, 'Logged in successfully.') 
    5049      else: 
    5150        logger.warn(log('inactive user tried to login', user = user.username)) 
    52         context['error'] = 'Login failure. User %s is disabled.' % (username) 
     51        messages.error(request, 'Login failure. User %s is disabled.' % (username)) 
    5352    else: 
    5453      logger.warn(log('user failed to log in', user = username)) 
    55       context['error'] = 'Login failure. Incorrect user name or password.' 
     54      messages.error(request, 'Login failure. Incorrect user name or password.') 
    5655 
    5756  template = loader.get_template('login.html') 
     
    6665  logger.info(log('user logged out', user = request.user.username)) 
    6766  django_logout(request) 
    68   context = RequestContext(request, { 
    69     'message': 'User logged out.', 
    70   }) 
     67  messages.success(request, 'User logged out.') 
     68  context = RequestContext(request, {}) 
    7169  template = loader.get_template('logout.html') 
    7270  return HttpResponse(template.render(context)) 
Note: See TracChangeset for help on using the changeset viewer.