More cleanup
moved login, logout and password change from website app to musicians
This commit is contained in:
@@ -48,8 +48,8 @@
|
||||
</a>
|
||||
<ul class="dropdown-menu">
|
||||
<li><a href="/musicians/profile">Eigenes Profil</a></li>
|
||||
<li><a href="/changePassword">Passwort ändern</a> </li>
|
||||
<li><a href="/logout"> Logout</a></li>
|
||||
<li><a href="/musicians/changePassword">Passwort ändern</a> </li>
|
||||
<li><a href="/musicians/logout"> Logout</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
{% endif %}
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
|
||||
{% extends "website/base.html" %}
|
||||
|
||||
{% load crispy_forms_tags %}
|
||||
|
||||
|
||||
<!-- No Feature slider -->
|
||||
{% block feature_slider %}
|
||||
{% endblock %}
|
||||
|
||||
|
||||
<!-- Static Navbar at top -->
|
||||
{% block navbar_options %} navbar navbar-inverse navbar-static-top {% endblock %}
|
||||
|
||||
|
||||
{% block content %}
|
||||
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<h3>Passwort ändern</h3>
|
||||
|
||||
<div class="span12">
|
||||
<form method="post">
|
||||
{% csrf_token %}
|
||||
{{ form }}
|
||||
<br>
|
||||
<input type="submit" class="btn btn-primary" value="Speichern"></input>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% endblock %}
|
||||
@@ -1,211 +0,0 @@
|
||||
{% comment %}
|
||||
Displays google map with directions to next conert
|
||||
|
||||
Context:
|
||||
Coordinates or textual adresses:
|
||||
{{routeInfo.origin}}
|
||||
{{routeInfo.destination}}
|
||||
|
||||
Event object:
|
||||
{{nextConcert}}
|
||||
|
||||
{% endcomment %}
|
||||
|
||||
|
||||
|
||||
|
||||
{% load sekizai_tags staticfiles %}
|
||||
|
||||
{% if hasNextConcertInfo %}
|
||||
|
||||
|
||||
|
||||
{% addtoblock "css" strip %}<link rel="stylesheet" href="{{STATIC_URL}}/css/concert_route.css" type="text/css" media="screen" />{% endaddtoblock %}
|
||||
{% addtoblock "js" strip %}<script type="text/javascript" src="//maps.google.com/maps/api/js?sensor=false&language=de"></script>{% endaddtoblock %}
|
||||
|
||||
|
||||
{% addtoblock "js" %}
|
||||
<script type="text/javascript">
|
||||
|
||||
function OpenWindowControl(controlDiv, map) {
|
||||
// Set CSS styles for the DIV containing the control
|
||||
// Setting padding to 5 px will offset the control
|
||||
// from the edge of the map
|
||||
controlDiv.style.paddingTop = '6px';
|
||||
|
||||
// Set CSS for the control border
|
||||
var controlUI = document.createElement('div');
|
||||
controlUI.style.backgroundColor = 'white';
|
||||
controlUI.style.borderStyle = 'solid';
|
||||
controlUI.style.borderWidth = '1px';
|
||||
controlUI.style.cursor = 'pointer';
|
||||
controlUI.style.textAlign = 'center';
|
||||
controlUI.title = 'Fenster mit Konzert Info anzeigen';
|
||||
controlDiv.appendChild(controlUI);
|
||||
|
||||
// Set CSS for the control interior
|
||||
var controlText = document.createElement('div');
|
||||
controlText.style.fontFamily = 'Arial,sans-serif';
|
||||
controlText.style.fontSize = '12px';
|
||||
controlText.style.paddingLeft = '4px';
|
||||
controlText.style.paddingRight = '4px';
|
||||
controlText.innerHTML = 'Konzert Info anzeigen';
|
||||
controlUI.appendChild(controlText);
|
||||
|
||||
google.maps.event.addDomListener(controlUI, 'click', function() {
|
||||
$("#map_box").show();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function ShowTargetControl(controlDiv, map) {
|
||||
// Set CSS styles for the DIV containing the control
|
||||
// Setting padding to 5 px will offset the control
|
||||
// from the edge of the map
|
||||
controlDiv.style.paddingTop = '6px';
|
||||
controlDiv.style.paddingRight = '6px';
|
||||
|
||||
// Set CSS for the control border
|
||||
var controlUI = document.createElement('div');
|
||||
controlUI.style.backgroundColor = 'white';
|
||||
controlUI.style.borderStyle = 'solid';
|
||||
controlUI.style.borderWidth = '1px';
|
||||
controlUI.style.cursor = 'pointer';
|
||||
controlUI.style.textAlign = 'center';
|
||||
controlUI.title = 'Zum Zielpunkt springen';
|
||||
controlDiv.appendChild(controlUI);
|
||||
|
||||
// Set CSS for the control interior
|
||||
var controlText = document.createElement('div');
|
||||
controlText.style.fontFamily = 'Arial,sans-serif';
|
||||
controlText.style.fontSize = '12px';
|
||||
controlText.style.paddingLeft = '4px';
|
||||
controlText.style.paddingRight = '4px';
|
||||
controlText.innerHTML = 'Konzertort anzeigen';
|
||||
controlUI.appendChild(controlText);
|
||||
|
||||
google.maps.event.addDomListener(controlUI, 'click', function()
|
||||
{
|
||||
{% if not nextConcert.map_location %}
|
||||
geocoder = new google.maps.Geocoder();
|
||||
geocoder.region = "de";
|
||||
geocoder.geocode( {"address": "{{ nextConcert.location }}" }, function(results, status) {
|
||||
if (status == google.maps.GeocoderStatus.OK) {
|
||||
map.setMapTypeId( google.maps.MapTypeId.HYBRID );
|
||||
map.setZoom( 15 );
|
||||
|
||||
map.setCenter( results[0].geometry.location );
|
||||
}
|
||||
});
|
||||
{% else %}
|
||||
var loc = new google.maps.LatLng( {{ nextConcert.map_location }} );
|
||||
map.setMapTypeId( google.maps.MapTypeId.HYBRID );
|
||||
map.setZoom( 20 );
|
||||
|
||||
map.setCenter( loc );
|
||||
|
||||
{% endif %}
|
||||
});
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
var m = $("#map")[0];
|
||||
|
||||
var myOptions = {
|
||||
zoom: 10,
|
||||
mapTypeId: google.maps.MapTypeId.ROAD,
|
||||
zoomControl: false,
|
||||
panControl: false,
|
||||
streetViewControl: false,
|
||||
scrollwheel: false
|
||||
}
|
||||
var directionsService = new google.maps.DirectionsService();
|
||||
var directionsDisplay = new google.maps.DirectionsRenderer();
|
||||
var map = new google.maps.Map(m, myOptions);
|
||||
|
||||
directionsDisplay.setMap( map );
|
||||
|
||||
var request = {
|
||||
origin: "{{routeInfo.origin}}",
|
||||
destination: "{{routeInfo.destination}}",
|
||||
travelMode: google.maps.DirectionsTravelMode.DRIVING
|
||||
}
|
||||
|
||||
directionsService.route(request, function(response, status) {
|
||||
if (status == google.maps.DirectionsStatus.OK) {
|
||||
directionsDisplay.setDirections(response);
|
||||
|
||||
var leg = response.routes[0].legs[0];
|
||||
|
||||
$("#route_duration").html( leg.duration.text );
|
||||
$("#route_distance").html( leg.distance.text ) ;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
var showInfoControlDiv = document.createElement('div');
|
||||
var showInfoControl = new OpenWindowControl(showInfoControlDiv, map);
|
||||
showInfoControlDiv.index = 1;
|
||||
map.controls[google.maps.ControlPosition.TOP_RIGHT].push( showInfoControlDiv );
|
||||
|
||||
var showTargetControlDiv = document.createElement('div');
|
||||
var showTargetControl = new ShowTargetControl(showTargetControlDiv, map);
|
||||
|
||||
showTargetControlDiv.index = 2;
|
||||
map.controls[ google.maps.ControlPosition.TOP_RIGHT ].push(showTargetControlDiv);
|
||||
|
||||
|
||||
|
||||
$("#map_box a").click( function() {
|
||||
$("#map_box").hide();
|
||||
map.setOptions( { scrollwheel: true } );
|
||||
});
|
||||
}
|
||||
);
|
||||
</script>
|
||||
{% endaddtoblock %}
|
||||
|
||||
|
||||
|
||||
|
||||
<div id="concert_route">
|
||||
<div id="map"></div>
|
||||
<div id="map_box" class="row map">
|
||||
<div class="container">
|
||||
<div id="route_info_box" class="span5 box_wrapp">
|
||||
<div class="box_cont">
|
||||
<div class="head">
|
||||
<h4>Nächstes Konzert</h4>
|
||||
|
||||
<!--
|
||||
</div>
|
||||
Nächstes Konzert ist in <br> <em>{{nextConcert.location}}</em> <br> am {{nextConcert.date | date:"SHORT_DATE_FORMAT" }} um {{nextConcert.time | time:"H:i" }} Uhr <br/>
|
||||
{% if nextConcert.meeting_time %} Treffpunkt ist um {{ nextConcert.meeting_time | time:"H:i" }} Uhr <br/> {% endif %}
|
||||
|
||||
<table>
|
||||
<tr> <td> Fahrzeit:</td> <td> <span id="route_duration"></span> </td> </tr>
|
||||
<tr> <td> Strecke: </td> <td> <span id="route_distance"></span> </td> </tr>
|
||||
</table>
|
||||
-->
|
||||
<table class="table table-striped table-condensed">
|
||||
<tr><td>Ort: </td> <td> {{nextConcert.location}} </td> </tr>
|
||||
<tr><td>Datum: </td> <td> {{nextConcert.date | date:"D, d.m.y" }} </td> </tr>
|
||||
<tr><td>Uhrzeit: </td> <td> {{nextConcert.time | time:"H:i" }} Uhr </td> </tr>
|
||||
{% if nextConcert.meeting_time %} <tr><td>Treffen um: </td> <td> {{ nextConcert.meeting_time | time:"H:i" }} Uhr </td> </tr> {% endif %}
|
||||
<tr> <td> Fahrzeit:</td> <td> <span id="route_duration"></span> </td> </tr>
|
||||
<tr> <td> Strecke: </td> <td> <span id="route_distance"></span> </td> </tr>
|
||||
</table>
|
||||
|
||||
|
||||
|
||||
<a class="btn" >Schliessen</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
{% endif %}
|
||||
@@ -1,79 +0,0 @@
|
||||
{% load sekizai_tags staticfiles %}
|
||||
|
||||
|
||||
|
||||
{% addtoblock "css" strip %}<link rel="stylesheet" type="text/css" href="{{STATIC_URL}}/css/lib/animate.css" media="screen, projection">{% endaddtoblock %}
|
||||
{% addtoblock "css" strip %}<link rel="stylesheet" href="{{STATIC_URL}}/css/coming-soon.css" type="text/css" media="screen" />{% endaddtoblock %}
|
||||
|
||||
{% if countdown %}
|
||||
|
||||
|
||||
|
||||
{% addtoblock "js" %}
|
||||
<script type="text/javascript">
|
||||
$(function () {
|
||||
function callback(event) {
|
||||
$this = $(this);
|
||||
$this.find('span#'+event.type).html(event.value);
|
||||
switch(event.type) {
|
||||
case "seconds":
|
||||
case "minutes":
|
||||
case "hours":
|
||||
case "days":
|
||||
case "weeks":
|
||||
case "daysLeft":
|
||||
case "finished":
|
||||
}
|
||||
}
|
||||
$('div#clock').countdown(new Date().valueOf() + {{ countdown.epoch }} , callback);
|
||||
});
|
||||
</script>
|
||||
{% endaddtoblock %}
|
||||
|
||||
|
||||
|
||||
<div id="coming_soon">
|
||||
<div class="head">
|
||||
<div class="container">
|
||||
<div class="span6 text">
|
||||
<h4>Der nächste Termin:</h4>
|
||||
<p>
|
||||
{{countdown.event.title}} am {{countdown.event.date | date:"D, d.m.y" }}
|
||||
{% if coundown.event.displaytime %} um {{countdown.event.displaytime | time:"H:i" }} Uhr {% endif %}
|
||||
{% if coundown.event.location %} in <em>{{countdown.event.location}} </em> {% endif %}
|
||||
|
||||
<br/>
|
||||
{% if 'participation' in countdown %}
|
||||
{% if countdown.participation == "?" %}
|
||||
Du hast dich noch nicht für diesen Termin eingetragen!
|
||||
{% elif countdown.participation == "Yes" %}
|
||||
Du hast für diesen Termin zugesagt.
|
||||
{% elif countdown.participation == "No" %}
|
||||
Du hast für diesen Termin abgesagt.
|
||||
{%endif %}
|
||||
{% endif %}
|
||||
</p>
|
||||
</div>
|
||||
<div class="span6 count" id="clock">
|
||||
<div class="box">
|
||||
<div class="circle"> <span id="days"></span> </div>
|
||||
<p>Tage</p>
|
||||
</div>
|
||||
<div class="box">
|
||||
<div class="circle"> <span id="hours"></span> </div>
|
||||
<p>Stunden</p>
|
||||
</div>
|
||||
<div class="box">
|
||||
<div class="circle"> <span id="minutes"></span> </div>
|
||||
<p>Minuten</p>
|
||||
</div>
|
||||
<div class="box last">
|
||||
<div class="circle"> <span id="seconds"></span> </div>
|
||||
<p>Sekunden</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% endif %}
|
||||
@@ -1,107 +0,0 @@
|
||||
{% extends "website/base.html" %}
|
||||
|
||||
|
||||
{% load sekizai_tags staticfiles %}
|
||||
|
||||
|
||||
|
||||
<!-- Static Navbar at top -->
|
||||
{% block navbar_options %} navbar navbar-inverse navbar-static-top {% endblock %}
|
||||
|
||||
|
||||
<!-- No Feature slider -->
|
||||
{% block feature_slider %}
|
||||
{% endblock %}
|
||||
|
||||
|
||||
{% block menu_contents %}
|
||||
{% endblock %}
|
||||
|
||||
|
||||
|
||||
{% block content %}
|
||||
|
||||
{% addtoblock "css" strip %}<link rel="stylesheet" href="{{STATIC_URL}}/css/lib/animate.css" type="text/css" media="screen, projection">{% endaddtoblock %}
|
||||
{% addtoblock "css" strip %}<link rel="stylesheet" href="{{STATIC_URL}}/css/sign-in.css" type="text/css" media="screen" /> {% endaddtoblock %}
|
||||
|
||||
|
||||
{% addtoblock "js" strip %} <script src="{{STATIC_URL}}/js/jquery.noty.js"></script> {% endaddtoblock %}
|
||||
{% addtoblock "css" strip %}<link rel="stylesheet" href="{{STATIC_URL}}/css/jquery.noty.css" type="text/css" media="screen" /> {% endaddtoblock %}
|
||||
{% addtoblock "css" strip %}<link rel="stylesheet" href="{{STATIC_URL}}/css/noty_theme_default.css" type="text/css" media="screen" /> {% endaddtoblock %}
|
||||
|
||||
<!-- For Autocompete -->
|
||||
{% addtoblock "js" strip %} <script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js"></script> {% endaddtoblock %}
|
||||
{% addtoblock "css" strip %}<link rel="stylesheet" href="{{STATIC_URL}}/css/jquery-ui-1.8.21.custom.css" type="text/css" media="screen" /> {% endaddtoblock %}
|
||||
|
||||
|
||||
|
||||
<!-- Notifications -->
|
||||
{% addtoblock "js" %}
|
||||
<script>
|
||||
$(document).ready(function(){
|
||||
$('#loginform').submit(function(e){
|
||||
|
||||
$.ajax({
|
||||
type:"POST",
|
||||
url:"",
|
||||
data:$('#loginform').serialize(),
|
||||
dataType: "json",
|
||||
success: function( data )
|
||||
{
|
||||
if ( data['err'] ) {
|
||||
noty ( { "text": data['err'],"layout":"top","type":"error" } )
|
||||
}
|
||||
if ( data['redirect']) {
|
||||
window.location.href = data['redirect'];
|
||||
}
|
||||
}
|
||||
});
|
||||
e.preventDefault();
|
||||
});
|
||||
|
||||
|
||||
$.get( "/login/usernames", function( data ) {
|
||||
$("#username").autocomplete( { source: data } );
|
||||
});
|
||||
});
|
||||
</script>
|
||||
{% endaddtoblock %}
|
||||
|
||||
|
||||
|
||||
<div id="sign_in">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="span12 header">
|
||||
<h4>Login zum internen Bereich</h4>
|
||||
<p>Hier dürfen nur Ensemble Mitglieder rein... </p>
|
||||
</div>
|
||||
|
||||
<div class="span12 footer" action="index.html" method="post">
|
||||
<form id="loginform">
|
||||
{% csrf_token %}
|
||||
<input name="username" type="text" placeholder="Benutzername" id="username">
|
||||
<input name="password" type="password" placeholder="Passwort">
|
||||
<input name="next" type="hidden" value="{{next}}" >
|
||||
<input type="submit" placeholder="OK" value="einloggen">
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div class="span12 proof">
|
||||
<div class="span6 remember">
|
||||
<label class="checkbox">
|
||||
<input id="remember" type="checkbox"> Eingeloggt bleiben
|
||||
</label>
|
||||
</div>
|
||||
<!--
|
||||
<div class="span3 dosnt">
|
||||
<a href="reset.html">Passwort vergessen?</a>
|
||||
</div> -->
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
@@ -1,14 +1,12 @@
|
||||
{% extends "website/base.html" %}
|
||||
|
||||
|
||||
{% load sekizai_tags staticfiles %}
|
||||
|
||||
|
||||
|
||||
{% block content %}
|
||||
|
||||
{% include "website/event_countdown.html" %}
|
||||
{% include "website/concert_route.html" %}
|
||||
{% include "eventplanner/countdown.inc.html" %}
|
||||
{% include "eventplanner/routeToEventMap.inc.html" %}
|
||||
|
||||
{% endblock %}
|
||||
|
||||
|
||||
@@ -1,13 +1,9 @@
|
||||
from django.conf.urls import patterns, url
|
||||
|
||||
from website.views import home_view, login_view, userlistForAutocompletion,logout_view, change_password
|
||||
from website.views import home_view
|
||||
|
||||
|
||||
urlpatterns = patterns('',
|
||||
url(r'$^', home_view ),
|
||||
url(r'^login/$', login_view),
|
||||
url(r'^login/usernames$', userlistForAutocompletion),
|
||||
url(r'^logout/$', logout_view),
|
||||
url(r'^changePassword/$', change_password),
|
||||
url(r'$^', home_view ),
|
||||
)
|
||||
|
||||
|
||||
131
website/views.py
131
website/views.py
@@ -1,20 +1,8 @@
|
||||
# Create your views here.
|
||||
from django.shortcuts import render
|
||||
|
||||
from django.shortcuts import render, redirect
|
||||
from django.contrib.auth import authenticate, login, logout
|
||||
|
||||
from django.http import HttpResponse
|
||||
|
||||
from django.utils import simplejson
|
||||
from django.contrib.auth.decorators import login_required
|
||||
|
||||
|
||||
from eventplanner.models import Event, EventParticipation
|
||||
from musicians.models import Musician
|
||||
|
||||
from datetime import datetime
|
||||
from datetime import timedelta
|
||||
from django.contrib.auth.models import User
|
||||
from eventplanner.snippets import addEventCountdownForNextEventToContext, addEventRouteForNextEventToContext
|
||||
from eventplanner.models import EventParticipation
|
||||
|
||||
|
||||
@login_required
|
||||
@@ -25,117 +13,8 @@ def home_view(request):
|
||||
if EventParticipation.isMember( request.user ):
|
||||
context['hasParticipationSetForAllEvents'] = EventParticipation.hasUserSetParticipationForAllEvents( request.user)
|
||||
|
||||
# Countdown
|
||||
countdown = dict()
|
||||
events = Event.objects.filter( date__gte = datetime.now() ).order_by('date')[:3]
|
||||
|
||||
if ( len(events) > 0 ):
|
||||
i = 0
|
||||
nextEvent = events[0]
|
||||
|
||||
while nextEvent.displaydatetime < datetime.now():
|
||||
if len(events ) <= i:
|
||||
return
|
||||
else:
|
||||
i += 1
|
||||
nextEvent = events[i]
|
||||
|
||||
if EventParticipation.isMember( request.user ):
|
||||
part = EventParticipation.objects.filter( user = request.user ).filter( event = nextEvent )
|
||||
countdown['participation'] = part[0].status
|
||||
|
||||
eventTime = nextEvent.displaydatetime
|
||||
|
||||
countdown['event'] = nextEvent
|
||||
countdown['epoch'] = int( (eventTime - datetime.now() ).total_seconds() * 1000 )
|
||||
|
||||
context['countdown'] = countdown
|
||||
|
||||
|
||||
# Route to concert
|
||||
nextConcerts = Event.objects.filter( date__gte = datetime.now(), type = 'Conc' ).order_by('date')[:1]
|
||||
if len( nextConcerts) > 0 :
|
||||
nextConcert = nextConcerts[0]
|
||||
|
||||
routeInfo = dict()
|
||||
|
||||
musician = Musician.objects.get( user = request.user );
|
||||
routeInfo['origin'] = musician.street + ", " + str( musician.zip_code ) + " " + musician.city
|
||||
|
||||
if nextConcert.map_location:
|
||||
# map_location has format "lat,longitute,zoomlevel"
|
||||
routeInfo['destination'] = ",".join( nextConcert.map_location.split(",")[:2] )
|
||||
else:
|
||||
routeInfo['destination'] = nextConcert.location
|
||||
|
||||
context['routeInfo'] = routeInfo
|
||||
context['nextConcert'] = nextConcert
|
||||
context['hasNextConcertInfo'] = True
|
||||
else:
|
||||
context['hasNextConcertInfo'] = False
|
||||
|
||||
addEventCountdownForNextEventToContext( context, request.user );
|
||||
addEventRouteForNextEventToContext(context, request.user, 'Conc' )
|
||||
|
||||
return render( request, 'website/mainpage.html', context )
|
||||
|
||||
|
||||
def logout_view(request):
|
||||
logout( request )
|
||||
return redirect( login_view )
|
||||
|
||||
|
||||
def userlistForAutocompletion(request):
|
||||
result = [ u.username for u in User.objects.all() ]
|
||||
return HttpResponse( simplejson.dumps(result), mimetype='application/json' )
|
||||
|
||||
|
||||
def login_view( request ):
|
||||
if request.method == 'POST': # If the form has been submitted...
|
||||
raiseFirstLetter = lambda s: s[:1].upper() + s[1:] if s else ''
|
||||
username = raiseFirstLetter( request.POST['username'] )
|
||||
password = request.POST['password']
|
||||
user = authenticate( username=username, password=password )
|
||||
result = dict()
|
||||
result['err'] = ""
|
||||
if user is not None:
|
||||
if user.is_active:
|
||||
if not request.POST.get('remember', None):
|
||||
# Expire in one year
|
||||
request.session.set_expiry( timedelta( weeks=52 ) )
|
||||
else:
|
||||
# Expire on browser close
|
||||
request.session.set_expiry( 0 )
|
||||
|
||||
login(request, user)
|
||||
result['redirect'] = "/"
|
||||
print ( "Setting Redirect" )
|
||||
if 'next' in request.POST :
|
||||
result['redirect'] = request.POST["next"]
|
||||
print ( "Using " + request.POST["next"] )
|
||||
else:
|
||||
result['err'] = "Dein Account wurde deaktiviert."
|
||||
# Return a 'disabled account' error message
|
||||
else:
|
||||
result['err'] = "Falscher Benutzername oder falsches Kennwort."
|
||||
|
||||
return HttpResponse( simplejson.dumps(result), mimetype='application/json' )
|
||||
|
||||
else:
|
||||
# Check if user already logged in
|
||||
if request.user.is_authenticated():
|
||||
return redirect( "/")
|
||||
|
||||
if 'next' in request.GET:
|
||||
nextPage = request.GET['next']
|
||||
else:
|
||||
nextPage = "/"
|
||||
return render( request, 'website/login.html', { 'next' : nextPage } )
|
||||
|
||||
|
||||
|
||||
import django.contrib.auth.views
|
||||
from django.core.urlresolvers import reverse
|
||||
|
||||
def change_password( request ):
|
||||
template_name = "website/change_password.html"
|
||||
return django.contrib.auth.views.password_change(request, template_name, post_change_redirect= "/" )
|
||||
|
||||
|
||||
Reference in New Issue
Block a user