コード例 #1
0
ファイル: registration_views.py プロジェクト: none-da/Favmeal
def _proceed_to_restaurantfood_registration(request, registration_template):
    selected_maintab = 'restaurantfood'
    from restaurants.forms import RestaurantFoodRegistrationForm
    form = RestaurantFoodRegistrationForm(post_data(request))
    if form.is_valid():
        userprofile = _do_register(request, form)
        from utils import setup_loggedin_environment
        setup_loggedin_environment(request, userprofile.email, password=form.cleaned_data.get('rpassword'))
        from utils import get_post_login_url
        post_login_url = get_post_login_url(userprofile)
        return HttpResponseRedirect(post_login_url)
    return response(registration_template, locals(), request)
コード例 #2
0
def view_login(request, login_template):
    selected_maintab = 'login'
    if request.method != 'POST':
        from users.forms import LoginForm
        loginform = LoginForm()
        return response(login_template,locals(),request)
    from users.forms import LoginForm
    loginform = LoginForm(post_data(request))
    if loginform.is_valid():
        email = loginform.cleaned_data.get('lusername')
        password = loginform.cleaned_data.get('lpassword')
        from utils import setup_loggedin_environment
        user = setup_loggedin_environment(request, email, password)
        if not user:
            from users.messages import INVALID_LOGIN_INFO
            _add_errormsg(request, INVALID_LOGIN_INFO)
            return response(login_template,locals(),request)
        from utils import get_post_login_url
        post_login_url = get_post_login_url(user.get_profile())
        return HttpResponseRedirect(post_login_url)
    return response(login_template,locals(),request)