Ejemplo n.º 1
0
from user_profiles import settings as app_settings
from user_profiles.utils import get_class_from_path
from django.conf import settings
from django.conf.urls.defaults import *
from django.contrib.auth import views as auth_views

pat = [
    url(r'^signup/$', 'user_profiles.views.signup', name='signup'),
    url(r'^login/$', auth_views.login, {'template_name': 'user_profiles/login.html', 'authentication_form': get_class_from_path(app_settings.AUTHENTICATION_FORM)}, name='login'),
    url(r'^logout/$', 'user_profiles.views.logout_then_login', name='logout'),
    url(r'^pwd/reset/$', auth_views.password_reset, name='password_reset', kwargs={'template_name': 'user_profiles/password_reset_form.html', 'email_template_name': 'user_profiles/password_reset_email.html'}),
    url(r'^pwd/reset/done/$', auth_views.password_reset_done, kwargs={'template_name': 'user_profiles/password_reset_done.html'}),
    url(r'^pwd/reset/confirm/(?P<uidb36>[-\w]+)/(?P<token>[-\w]+)/$', 'user_profiles.views.password_reset_confirm', kwargs={'template_name': 'user_profiles/password_reset_confirm.html'}),
    url(r'^you/password-change/$', 'user_profiles.views.password_change', name='password_change', kwargs={'template_name': 'user_profiles/password_change_form.html'}),
    #url(r'^profile/(.*?)/change/$', 'user_profiles.views.change', name='user_profile_change'),
    url(r'^you/change/$', 'user_profiles.views.current_user_profile_change', name='current_user_profile_change'),
    url(r'^you/$', 'user_profiles.views.current_user_detail', name='current_user_detail'),
    url(r'^profile/(.*?)/$', 'user_profiles.views.user_detail', name='user_detail'),
    # The following patterns catch URLs that have no views and redirect to the current user
    #url(r'^profile/$', 'user_profiles.views.redirect_to_current_user_detail'),
    #url(r'^$', 'user_profiles.views.redirect_to_current_user_detail'),
]

urlpatterns = patterns('', *pat)
Ejemplo n.º 2
0
from django.contrib.auth.models import User
from django.utils.translation import ugettext_lazy as _
from django import forms
from django.template import Template
from django.shortcuts import render_to_response
from django.template import RequestContext
from django.core.urlresolvers import reverse
from django.http import HttpResponseRedirect, HttpResponse, Http404
from django.views.decorators.csrf import csrf_protect
from django.contrib.auth.decorators import login_required
from django.shortcuts import render_to_response, get_object_or_404 
from django.core.exceptions import PermissionDenied
from django.contrib import messages

SIGNUP_SUCCESS_URL = None
SIGNUP_FORM_CLASS = get_class_from_path(app_settings.SIGNUP_FORM)
PROFILE_FORM_CLASS = get_class_from_path(app_settings.PROFILE_FORM)

def signup(request, template_name='user_profiles/signup.html'):
    """
    The signup view, creating a new ``User`` object on POST requests and
    rendering the signup form otherwise.
    
    See :ref:`configuration` and :ref:`forms` for information on how to use
    your own custom form.
    """
    if request.user.is_authenticated():
        return HttpResponseRedirect(settings.LOGIN_REDIRECT_URL)
    if request.method == 'POST':
        signup_form = SIGNUP_FORM_CLASS(request.POST)
        if signup_form.is_valid():
Ejemplo n.º 3
0
from user_profiles import settings as app_settings
from user_profiles.utils import get_class_from_path
from django.conf import settings
from django.conf.urls.defaults import *
from django.contrib.auth import views as auth_views

pat = [
    url(r'^signup/$', 'user_profiles.views.signup', name='signup'),
    url(r'^login/$',
        auth_views.login, {
            'template_name':
            'user_profiles/login.html',
            'authentication_form':
            get_class_from_path(app_settings.AUTHENTICATION_FORM)
        },
        name='login'),
    url(r'^logout/$', 'user_profiles.views.logout_then_login', name='logout'),
    url(r'^pwd/reset/$',
        auth_views.password_reset,
        name='password_reset',
        kwargs={
            'template_name': 'user_profiles/password_reset_form.html',
            'email_template_name': 'user_profiles/password_reset_email.html'
        }),
    url(r'^pwd/reset/done/$',
        auth_views.password_reset_done,
        kwargs={'template_name': 'user_profiles/password_reset_done.html'}),
    url(r'^pwd/reset/confirm/(?P<uidb36>[-\w]+)/(?P<token>[-\w]+)/$',
        'user_profiles.views.password_reset_confirm',
        kwargs={'template_name': 'user_profiles/password_reset_confirm.html'}),
    url(r'^you/password-change/$',