@imenam/self-register-proxy 1.0.37

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/views/login.js ADDED
@@ -0,0 +1,130 @@
1
+ const { escapeHtml } = require('../services/proxyRouter');
2
+
3
+ /**
4
+ * Page de connexion administrateur
5
+ * @param {string} proxyName
6
+ * @param {boolean} error
7
+ */
8
+ function renderLogin(proxyName, error) {
9
+ return `<!DOCTYPE html>
10
+ <html lang="fr">
11
+ <head>
12
+ <meta charset="UTF-8">
13
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
14
+ <title>${escapeHtml(proxyName)} - Connexion</title>
15
+ <style>
16
+ * {
17
+ margin: 0;
18
+ padding: 0;
19
+ box-sizing: border-box;
20
+ }
21
+ body {
22
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
23
+ background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
24
+ min-height: 100vh;
25
+ color: #e4e4e7;
26
+ display: flex;
27
+ align-items: center;
28
+ justify-content: center;
29
+ padding: 1.5rem;
30
+ }
31
+ .login-container {
32
+ width: 100%;
33
+ max-width: 380px;
34
+ text-align: center;
35
+ }
36
+ h1 {
37
+ font-size: 2rem;
38
+ background: linear-gradient(90deg, #6366f1, #8b5cf6);
39
+ -webkit-background-clip: text;
40
+ -webkit-text-fill-color: transparent;
41
+ background-clip: text;
42
+ margin-bottom: 0.25rem;
43
+ }
44
+ .subtitle {
45
+ color: #a1a1aa;
46
+ font-size: 0.95rem;
47
+ margin-bottom: 1.5rem;
48
+ }
49
+ .login-box {
50
+ background: rgba(255, 255, 255, 0.05);
51
+ border: 1px solid rgba(255, 255, 255, 0.1);
52
+ border-radius: 12px;
53
+ padding: 1.5rem;
54
+ }
55
+ .form-group {
56
+ margin-bottom: 1rem;
57
+ text-align: left;
58
+ }
59
+ .form-group label {
60
+ font-size: 0.75rem;
61
+ color: #a1a1aa;
62
+ margin-bottom: 0.25rem;
63
+ display: block;
64
+ }
65
+ .form-group input {
66
+ background: rgba(0, 0, 0, 0.3);
67
+ border: 1px solid rgba(255, 255, 255, 0.1);
68
+ padding: 0.6rem 0.75rem;
69
+ border-radius: 6px;
70
+ color: white;
71
+ font-family: inherit;
72
+ font-size: 0.9rem;
73
+ width: 100%;
74
+ }
75
+ .form-group input:focus {
76
+ outline: none;
77
+ border-color: #8b5cf6;
78
+ background: rgba(0, 0, 0, 0.4);
79
+ }
80
+ .submit-btn {
81
+ background: linear-gradient(90deg, #6366f1, #8b5cf6);
82
+ color: white;
83
+ border: none;
84
+ padding: 0.6rem 1.25rem;
85
+ border-radius: 6px;
86
+ font-weight: 600;
87
+ font-size: 0.85rem;
88
+ cursor: pointer;
89
+ transition: opacity 0.2s;
90
+ width: 100%;
91
+ }
92
+ .submit-btn:hover {
93
+ opacity: 0.9;
94
+ }
95
+ .error-msg {
96
+ background: rgba(239, 68, 68, 0.15);
97
+ border: 1px solid rgba(239, 68, 68, 0.3);
98
+ color: #fca5a5;
99
+ padding: 0.5rem 0.75rem;
100
+ border-radius: 6px;
101
+ font-size: 0.8rem;
102
+ margin-bottom: 1rem;
103
+ }
104
+ @media (max-width: 600px) {
105
+ .login-container {
106
+ max-width: none;
107
+ }
108
+ }
109
+ </style>
110
+ </head>
111
+ <body>
112
+ <div class="login-container">
113
+ <h1>${escapeHtml(proxyName)}</h1>
114
+ <p class="subtitle">Connexion administrateur</p>
115
+ <div class="login-box">
116
+ <form method="POST" action="/proxy/login">
117
+ ${error ? '<div class="error-msg">Mot de passe incorrect</div>' : ''}
118
+ <div class="form-group">
119
+ <label for="password">Mot de passe</label>
120
+ <input type="password" id="password" name="password" required autofocus>
121
+ </div>
122
+ <button type="submit" class="submit-btn">Connexion</button>
123
+ </form>
124
+ </div>
125
+ </div>
126
+ </body>
127
+ </html>`;
128
+ }
129
+
130
+ module.exports = { renderLogin };