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 %} -
- {{ form.csrf_token }} -
- {% for product in products %} - {% if product.visible or view_all %} -
- {% if product.price < 0 %} - {% if config.VERIFY_FREE_PURCHASES %} - - {% if product.is_food %} - {% set icon = (food_icons | random) %} - {% else %} - {% if product.has_alc %} - {% set icon = (alc_icons | random) %} + + {{ form.csrf_token }} + +

Recharge Balance

+
+ {% for product in products %} + {% if (product.visible or view_all) and product.price < 0 %} +
+ {% if config.VERIFY_FREE_PURCHASES %} + + {% if product.is_food %} + {% set icon = (food_icons | random) %} {% else %} - {% set icon = (drink_icons | random) %} + {% if product.has_alc %} + {% set icon = (alc_icons | random) %} + {% else %} + {% set icon = (drink_icons | random) %} + {% endif %} {% endif %} - {% endif %} - - {{ product.name }}
- {% if config.SHOW_BALANCE_AND_PRICE %} - {{ macro.render_currency(product.price) }} - {% else %} - {{ macro.render_contingent(balance, product.price) }} - {% endif %} -
- {% else %} - - {% endif %} - {% else %} - {% if product in favorites %} - - {% else %} - - {% endif %} + + {% endif %} +
{% endif %} + {% endfor %} +
-
- {% endif %} - {% endfor %} -
-
-{% endblock %} +

Buy product

+
+ {% for product in products %} + {% if (product.visible or view_all) and product.price >= 0 %} +
+ {% if product in favorites %} + + {% else %} + + {% endif %} +
+ {% endif %} + {% endfor %} +
+ + {% endblock %} diff --git a/nanposweb/templates/signup.html b/nanposweb/templates/signup.html index e77cf3e..03d14d9 100644 --- a/nanposweb/templates/signup.html +++ b/nanposweb/templates/signup.html @@ -3,12 +3,8 @@ {% endblock %} {% block main %} -
+
-

NANPOS Web

- {% if session.get('terminal', False) %} -

Terminal

- {% endif %}

Sign up

@@ -23,16 +19,38 @@

Sign up

{{ form.pin(class='form-control') }} {{ form.pin.label }}
-
- {{ form.repeat_pin(class='form-control') }} - {{ form.repeat_pin.label }} +
+ {{ form.repeat_pin(class="form-control", id="floatingRepeatPin", placeholder="1234") }} +
- {{ form.submit(class="w-100 btn btn-lg btn-primary") }} - - + {# Removed the hr class="my-4" here as requested #} + +
+

If you want to login with your KIT Card, you need to register your card number

+ {# Changed placeholder to actual static image #} + KIT Card +
+ +
+ {{ form.card_number(class="form-control", id="floatingCard", placeholder="12345678") }} + +
+
+ {{ form.submit(class="btn btn-primary btn-login text-uppercase fw-bold") }} + + {# Wrapped the Back link in the same d-grid container to match size #} + {% if session.get('terminal', False) %} + + {% else %} + + {% endif %} +
+ +
+
{% endblock %} \ No newline at end of file diff --git a/nanposweb/templates/verify.html b/nanposweb/templates/verify.html index e12f21c..1146f1b 100644 --- a/nanposweb/templates/verify.html +++ b/nanposweb/templates/verify.html @@ -1,54 +1,39 @@ {% extends 'base.html' %} -{% block pagetitle %}Verify Purchase{% endblock %} - -{% block utilbar %} -