Skip to content
Snippets Groups Projects
Commit 0750e310 authored by Christian Dresen's avatar Christian Dresen
Browse files

[WarpAuth] Fixed missing card id error while changing profile ids

parent d2d4e629
No related branches found
No related tags found
No related merge requests found
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
<div class="panel panel-default"> <div class="panel panel-default">
<div class="panel-body"> <div class="panel-body">
{% if error_info %} {% if error_info %}
<div class="alert alert-danger">{{ error_info }}</div><br> <div class="alert alert-danger">{% trans error_info %}</div><br>
{% endif %} {% endif %}
{% if success_info %} {% if success_info %}
<div class="alert alert-success">{% trans "information_changed_successfully" %}</div><br> <div class="alert alert-success">{% trans "information_changed_successfully" %}</div><br>
......
...@@ -44,16 +44,28 @@ def change_information(request): ...@@ -44,16 +44,28 @@ def change_information(request):
if request.method != 'POST': if request.method != 'POST':
return redirect("profile_index") return redirect("profile_index")
user = LdapUser.objects.get(uid=str(request.user)) user = LdapUser.objects.get(uid=str(request.user))
first_name = request.POST["first_name"] if "first_name" in request.POST:
last_name = request.POST["last_name"] first_name = request.POST["first_name"]
if "last_name" in request.POST:
last_name = request.POST["last_name"]
if "card_id" in request.POST:
card_id = request.POST["card_id"]
else:
card_id = 0
if "email" not in request.POST:
page_context["error_info"] = "err_invalid_email"
return HttpResponse(render(request, 'warpauth/profile.html', page_context))
email = request.POST["email"] email = request.POST["email"]
card_id = request.POST["card_id"]
f = forms.EmailField() f = forms.EmailField()
try: try:
f.clean(email) f.clean(email)
except ValidationError as e: except ValidationError as e:
page_context["error_info"] = "Invalid Email" page_context["error_info"] = "err_invalid_email"
return HttpResponse(render(request, 'warpauth/profile.html', page_context)) return HttpResponse(render(request, 'warpauth/profile.html', page_context))
cn = first_name + " " + last_name cn = first_name + " " + last_name
cn = cn.strip() cn = cn.strip()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment