Skip to content

Commit

Permalink
added redirect to dashboard
Browse files Browse the repository at this point in the history
  • Loading branch information
PraneethKarnena committed Aug 10, 2019
1 parent 06cc4f4 commit eaa04b8
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions dashboard/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,17 @@ def signin_view(request):
signin_form = AuthenticationForm(request=request, data=request.POST)
if signin_form.is_valid():
django_login(request, signin_form.get_user())
return HttpResponse('Logged in')
return HttpResponseRedirect(reverse('dashboard:dashboard_page'))

else:
errors = signin_form.errors.as_text()
if 'username' in errors:
errors = errors.replace('username', 'mobile')
errors = errors.split('*')[2]
messages.add_message(request, messages.ERROR, errors)
return HttpResponseRedirect(reverse('dashboard:signin_page'))
return HttpResponseRedirect(reverse('dashboard:signin_page'))


@require_http_methods(['GET', 'POST'])
def dashboard_view(request):
pass

0 comments on commit eaa04b8

Please sign in to comment.