forked from deepseek-ai/DeepSeek-V3
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.py
40 lines (34 loc) · 1.43 KB
/
app.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
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)