From 90fb6c9a9c4ba23a66568aa4dca5a93e31ea984d Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Mon, 3 Jan 2011 18:01:50 +0530 Subject: [PATCH] signup/signin/signout --- pandora/user/views.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/pandora/user/views.py b/pandora/user/views.py index bf48ca6c8..6e76ec29b 100644 --- a/pandora/user/views.py +++ b/pandora/user/views.py @@ -21,12 +21,12 @@ import models from api.actions import actions -class LoginForm(forms.Form): +class SigninForm(forms.Form): username = forms.TextInput() password = forms.TextInput() -def api_login(request): +def signin(request): ''' param data { username: 'username', @@ -47,7 +47,7 @@ def api_login(request): } ''' data = json.loads(request.POST['data']) - form = LoginForm(data, request.FILES) + form = SigninForm(data, request.FILES) if form.is_valid(): if models.User.objects.filter(username=form.data['username']).count() == 0: response = json_response({ @@ -79,10 +79,10 @@ def api_login(request): else: response = json_response(status=400, text='invalid data') return render_to_json_response(response) -actions.register(api_login, 'login') +actions.register(signin) -def api_logout(request): +def signout(request): ''' param data { } @@ -104,16 +104,16 @@ def api_logout(request): site = json.load(f) response['data']['user'] = site['user'] return render_to_json_response(response) -actions.register(api_logout, 'logout') +actions.register(signout) -class RegisterForm(forms.Form): +class SignupForm(forms.Form): username = forms.TextInput() password = forms.TextInput() email = forms.TextInput() -def register(request): +def signup(request): ''' param data { username: 'username', @@ -135,7 +135,7 @@ def register(request): } ''' data = json.loads(request.POST['data']) - form = RegisterForm(data, request.FILES) + form = SignupForm(data, request.FILES) if form.is_valid(): if models.User.objects.filter(username=form.data['username']).count() > 0: response = json_response({ @@ -173,7 +173,7 @@ def register(request): else: response = json_response(status=400, text='invalid data') return render_to_json_response(response) -actions.register(register) +actions.register(signup) def resetPassword(request):