diff --git a/app.py b/app.py new file mode 100644 index 0000000..c3aac5e --- /dev/null +++ b/app.py @@ -0,0 +1,40 @@ +from flask import Flask, render_template, request, redirect, url_for, flash +import hcaptcha + +app = Flask(__name__) +app.secret_key = 'your_secret_key' + +# Configure hCaptcha +hcaptcha_site_key = 'your_hcaptcha_site_key' +hcaptcha_secret_key = 'your_hcaptcha_secret_key' + +@app.route('/signup', methods=['GET', 'POST']) +def signup(): + if request.method == 'POST': + hcaptcha_response = request.form['h-captcha-response'] + if hcaptcha.verify(hcaptcha_secret_key, hcaptcha_response): + # Process the sign-up form + flash('Sign-up successful!', 'success') + return redirect(url_for('login')) + else: + flash('hCaptcha verification failed. Please try again.', 'danger') + return render_template('signup.html', hcaptcha_site_key=hcaptcha_site_key) + +@app.route('/login', methods=['GET', 'POST']) +def login(): + if request.method == 'POST': + hcaptcha_response = request.form['h-captcha-response'] + if hcaptcha.verify(hcaptcha_secret_key, hcaptcha_response): + # Process the login form + flash('Login successful!', 'success') + return redirect(url_for('dashboard')) + else: + flash('hCaptcha verification failed. Please try again.', 'danger') + return render_template('login.html', hcaptcha_site_key=hcaptcha_site_key) + +@app.route('/dashboard') +def dashboard(): + return 'Welcome to the dashboard!' + +if __name__ == '__main__': + app.run(debug=True) diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..e9fb1ef --- /dev/null +++ b/requirements.txt @@ -0,0 +1,2 @@ +hcaptcha +flask diff --git a/static/css/styles.css b/static/css/styles.css new file mode 100644 index 0000000..2a6d916 --- /dev/null +++ b/static/css/styles.css @@ -0,0 +1,85 @@ +/* General styles for the form elements */ +body { + font-family: Arial, sans-serif; + background-color: #f4f4f4; + color: #333; + margin: 0; + padding: 0; +} + +.container { + max-width: 500px; + margin: 50px auto; + padding: 20px; + background-color: #fff; + box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); + border-radius: 8px; +} + +h1 { + text-align: center; + color: #333; +} + +.form-group { + margin-bottom: 15px; +} + +label { + display: block; + margin-bottom: 5px; + font-weight: bold; +} + +input[type="text"], +input[type="email"], +input[type="password"] { + width: 100%; + padding: 10px; + border: 1px solid #ccc; + border-radius: 4px; + box-sizing: border-box; +} + +button { + width: 100%; + padding: 10px; + background-color: #007bff; + color: #fff; + border: none; + border-radius: 4px; + cursor: pointer; + font-size: 16px; +} + +button:hover { + background-color: #0056b3; +} + +/* Styles for hCaptcha widget */ +.h-captcha { + margin: 20px 0; +} + +/* High contrast and readability for visually impaired users */ +body { + background-color: #000; + color: #fff; +} + +input[type="text"], +input[type="email"], +input[type="password"] { + background-color: #333; + color: #fff; + border: 1px solid #555; +} + +button { + background-color: #ffcc00; + color: #000; +} + +button:hover { + background-color: #e6b800; +} diff --git a/templates/login.html b/templates/login.html new file mode 100644 index 0000000..01754a8 --- /dev/null +++ b/templates/login.html @@ -0,0 +1,29 @@ + + +
+ + +