Skip to content

Commit

Permalink
make grade field optional in grade view, make login form handle white…
Browse files Browse the repository at this point in the history
…spaces in email
  • Loading branch information
urvdp committed Jun 26, 2024
1 parent 07eeaa4 commit 25226a1
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/spz/forms/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1059,7 +1059,7 @@ class GradeForm(FlaskForm):
for applicant in applicants:
field_name = f'grade_{applicant.id}'
setattr(GradeForm, field_name,
IntegerField("Note", validators=[validators.NumberRange(min=0, max=100)],
IntegerField("Note", validators=[validators.Optional(), validators.NumberRange(min=0, max=100)],
default=applicant.grade))

return GradeForm
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ <h3>Schritt 2:</h3>
{{ applicant.ects_points }}
</td>
<td>
{% if applicant.grade >= 50 %}
{% if applicant.grade is none %}
-
{% elif applicant.grade >= 50 %}
<select name="view_{{ applicant.id }}" class="ui dropdown">
<option value="0" {% if applicant.hide_grade %}selected{% endif %}>
bestanden
Expand Down
5 changes: 3 additions & 2 deletions src/spz/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -1282,13 +1282,14 @@ def login():
form = forms.LoginForm()

if form.validate_on_submit():
user = models.User.get_by_login(form.user.data, form.password.data)
cleaned_email = form.user.data.strip()
user = models.User.get_by_login(cleaned_email, form.password.data)
if user:
login_user(user, remember=True)
if current_user.is_teacher:
return redirect(url_for('teacher'))
return redirect(url_for('internal'))
flash(_('Du kommst hier net rein!'), 'negative')
flash(_('Login war nicht erfolgreich.'), 'negative')

return dict(form=form)

Expand Down

0 comments on commit 25226a1

Please sign in to comment.