Spaces:
Sleeping
Sleeping
Update templates/telegram_auth.html
Browse files- templates/telegram_auth.html +30 -71
templates/telegram_auth.html
CHANGED
|
@@ -1,74 +1,33 @@
|
|
| 1 |
-
|
| 2 |
-
<html lang="en">
|
| 3 |
-
<head>
|
| 4 |
-
<meta charset="UTF-8">
|
| 5 |
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
-
<title>Telegram Authentication</title>
|
| 7 |
-
<style>
|
| 8 |
-
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; display: flex; align-items: center; justify-content: center; height: 100vh; background-color: #f4f7f6; margin: 0; }
|
| 9 |
-
.auth-box { width: 360px; background-color: white; padding: 40px; border-radius: 8px; box-shadow: 0 4px 8px rgba(0,0,0,0.1); }
|
| 10 |
-
h1 { text-align: center; color: #333; margin-bottom: 10px; }
|
| 11 |
-
p.subtitle { text-align: center; color: #666; margin-top: 0; margin-bottom: 25px; }
|
| 12 |
-
.form-group { margin-bottom: 20px; }
|
| 13 |
-
label { display: block; margin-bottom: 5px; font-weight: 500; }
|
| 14 |
-
input[type="text"], input[type="password"] { width: 100%; padding: 10px; border: 1px solid #ccc; border-radius: 4px; box-sizing: border-box; }
|
| 15 |
-
.btn-submit { width: 100%; padding: 12px; background-color: #0088cc; color: white; border: none; border-radius: 5px; cursor: pointer; font-size: 16px; }
|
| 16 |
-
.btn-submit:hover { background-color: #007ab8; }
|
| 17 |
-
.flash { padding: 10px; border-radius: 4px; margin-bottom: 15px; text-align: center; }
|
| 18 |
-
.flash-danger { background-color: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }
|
| 19 |
-
.flash-success { background-color: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
|
| 20 |
-
.flash-info { background-color: #d1ecf1; color: #0c5460; border: 1px solid #bee5eb; }
|
| 21 |
-
</style>
|
| 22 |
-
</head>
|
| 23 |
-
<body>
|
| 24 |
-
<div class="auth-box">
|
| 25 |
-
<h1>Telegram Setup</h1>
|
| 26 |
-
|
| 27 |
-
{% with messages = get_flashed_messages(with_categories=true) %}
|
| 28 |
-
{% if messages %}
|
| 29 |
-
{% for category, message in messages %}
|
| 30 |
-
<div class="flash flash-{{ category }}">{{ message }}</div>
|
| 31 |
-
{% endfor %}
|
| 32 |
-
{% endif %}
|
| 33 |
-
{% endwith %}
|
| 34 |
|
| 35 |
-
|
| 36 |
-
<!-- Stage 1: API Credentials and Phone Number -->
|
| 37 |
-
{% if stage == 'credentials' %}
|
| 38 |
-
<p class="subtitle">Enter your API credentials to begin.</p>
|
| 39 |
-
<div class="form-group">
|
| 40 |
-
<label for="api_id">API ID</label>
|
| 41 |
-
<input type="text" id="api_id" name="api_id" required>
|
| 42 |
-
</div>
|
| 43 |
-
<div class="form-group">
|
| 44 |
-
<label for="api_hash">API Hash</label>
|
| 45 |
-
<input type="text" id="api_hash" name="api_hash" required>
|
| 46 |
-
</div>
|
| 47 |
-
<div class="form-group">
|
| 48 |
-
<label for="phone">Phone Number (with country code)</label>
|
| 49 |
-
<input type="text" id="phone" name="phone" placeholder="+12345678900" required>
|
| 50 |
-
</div>
|
| 51 |
-
<button type="submit" class="btn-submit">Send Code</button>
|
| 52 |
-
|
| 53 |
-
<!-- Stage 2: OTP Code -->
|
| 54 |
-
{% elif stage == 'otp' %}
|
| 55 |
-
<p class="subtitle">Enter the code sent to your Telegram app.</p>
|
| 56 |
-
<div class="form-group">
|
| 57 |
-
<label for="otp">Login Code (OTP)</label>
|
| 58 |
-
<input type="text" id="otp" name="otp" required autofocus>
|
| 59 |
-
</div>
|
| 60 |
-
<button type="submit" class="btn-submit">Verify Code</button>
|
| 61 |
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 72 |
</div>
|
| 73 |
-
</
|
| 74 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{% extends "base.html" %}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
|
| 3 |
+
{% block title %}Telegram Authentication - Telegram to YouTube Uploader{% endblock %}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
|
| 5 |
+
{% block content %}
|
| 6 |
+
<h2>Telegram Authentication</h2>
|
| 7 |
+
|
| 8 |
+
{% if session.get('telegram_needs_code') %}
|
| 9 |
+
<div class="alert alert-info" role="alert">
|
| 10 |
+
<strong>OTP Required:</strong> Please check your Telegram app or SMS for a login code and enter it below.
|
| 11 |
+
<p class="mb-0"><small>If you have 2FA enabled, you might be prompted for your password after entering the code.</small></p>
|
| 12 |
+
</div>
|
| 13 |
+
<form method="POST" action="{{ url_for('telegram_callback') }}">
|
| 14 |
+
<div class="mb-3">
|
| 15 |
+
<label for="otp_code" class="form-label">One-Time Password (OTP)</label>
|
| 16 |
+
<input type="text" class="form-control" id="otp_code" name="otp_code" required placeholder="Enter the code sent to your Telegram app/SMS">
|
| 17 |
+
</div>
|
| 18 |
+
<button type="submit" class="btn btn-success">Submit OTP</button>
|
| 19 |
+
<a href="{{ url_for('dashboard') }}" class="btn btn-secondary">Cancel</a>
|
| 20 |
+
</form>
|
| 21 |
+
{% elif status.telegram_authenticated %}
|
| 22 |
+
<div class="alert alert-success" role="alert">
|
| 23 |
+
<strong>Success!</strong> The application is already connected to Telegram.
|
| 24 |
</div>
|
| 25 |
+
<a href="{{ url_for('dashboard') }}" class="btn btn-primary">Back to Dashboard</a>
|
| 26 |
+
{% else %}
|
| 27 |
+
<p>Click the button below to initiate the Telegram connection process. If an OTP is required, you will be prompted on this page.</p>
|
| 28 |
+
<form method="POST" action="{{ url_for('initiate_telegram_auth') }}">
|
| 29 |
+
<button type="submit" class="btn btn-primary">Connect to Telegram</button>
|
| 30 |
+
</form>
|
| 31 |
+
<a href="{{ url_for('dashboard') }}" class="btn btn-secondary mt-2">Back to Dashboard</a>
|
| 32 |
+
{% endif %}
|
| 33 |
+
{% endblock %}
|