diff --git a/nanposweb/auth.py b/nanposweb/auth.py index faf5b34..659c520 100644 --- a/nanposweb/auth.py +++ b/nanposweb/auth.py @@ -143,11 +143,19 @@ def signup(): flash('Username already taken! Please choose a different one.', category='danger') else: # Register the user - user = User(name=username, isop=False, pin=calc_hash(form.pin.data)) + card_hash = None + if form.card_number.data: + card_hash = calc_hash(form.card_number.data) + + user = User(name=username, isop=False, pin=calc_hash(form.pin.data), card=card_hash) db.session.add(user) db.session.commit() - flash('User successfully registered. Go to the login form to log in.', category='success') - return redirect(url_for('auth.login')) + # Log the user in immediately + login_user(user, remember=True) + identity_changed.send(current_app._get_current_object(), identity=Identity(user.id)) + + flash('User successfully registered and logged in.', category='success') + return redirect(url_for('main.index')) return render_template('signup.html', form=form) diff --git a/nanposweb/forms.py b/nanposweb/forms.py index 6255868..fa78c43 100644 --- a/nanposweb/forms.py +++ b/nanposweb/forms.py @@ -21,7 +21,8 @@ class SignUpForm(FlaskForm): render_kw={'placeholder': 'Username', 'autofocus': True}, ) pin = PasswordField(label='PIN', validators=[InputRequired()], render_kw={'placeholder': 'PIN'}, ) repeat_pin = PasswordField(label='Repeat PIN', validators=[InputRequired()], render_kw={'placeholder': 'PIN'}, ) - submit = SubmitField(label='Sign up', ) + card_number = StringField(label='Card ID', render_kw={'placeholder': 'KIT Card ID'}) + submit = SubmitField(label='Sign up') class MainForm(FlaskForm): diff --git a/nanposweb/static/Studierendenkarte_Front.png b/nanposweb/static/Studierendenkarte_Front.png new file mode 100644 index 0000000..cdbd59d Binary files /dev/null and b/nanposweb/static/Studierendenkarte_Front.png differ diff --git a/nanposweb/templates/index.html b/nanposweb/templates/index.html index 547d843..2fc1556 100644 --- a/nanposweb/templates/index.html +++ b/nanposweb/templates/index.html @@ -47,89 +47,97 @@ {% endblock %} {% block content %} -
-{% endblock %} +If you want to login with your KIT Card, you need to register your card number
+ {# Changed placeholder to actual static image #} +
+