File size: 4,294 Bytes
b2adcbf
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Login - Medical AI</title>
    <script src="https://cdn.tailwindcss.com"></script>
    <style>

        @import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

        body { font-family: 'Inter', sans-serif; }

        

        /* Animation for the form container */

        .form-container-enter {

            opacity: 0;

            transform: translateY(20px) scale(0.98);

            transition: opacity 0.4s ease-out, transform 0.4s ease-out;

        }

        .form-container-enter-active {

            opacity: 1;

            transform: translateY(0) scale(1);

        }

    </style>
</head>
<body class="bg-gray-50 flex items-center justify-center min-h-screen">
    <div id="form-container" class="w-full max-w-md mx-auto bg-white rounded-2xl shadow-lg p-8 form-container-enter">
        <h2 class="text-3xl font-bold text-center text-gray-900 mb-6">Log In</h2>
        
        <!-- Flash messages -->
        {% with messages = get_flashed_messages(with_categories=true) %}
            {% if messages %}
                {% for category, message in messages %}
                    <div class="p-4 mb-4 text-sm rounded-lg 

                        {% if category == 'danger' %} bg-red-100 text-red-700 

                        {% elif category == 'success' %} bg-green-100 text-green-700 

                        {% else %} bg-blue-100 text-blue-700 {% endif %}" role="alert">
                        {{ message }}
                    </div>
                {% endfor %}
            {% endif %}
        {% endwith %}

        <form method="POST" action="{{ url_for('login') }}" class="space-y-6">
            <div>
                <label for="username" class="block text-sm font-medium text-gray-700">Username</label>
                <input id="username" name="username" type="text" required class="form-input mt-1 block w-full px-3 py-2 bg-white border border-gray-300 rounded-md shadow-sm placeholder-gray-400 focus:outline-none focus:ring-blue-500 focus:border-blue-500 transition-shadow duration-200">
            </div>
            <div>
                <label for="password" class="block text-sm font-medium text-gray-700">Password</label>
                <input id="password" name="password" type="password" required class="form-input mt-1 block w-full px-3 py-2 bg-white border border-gray-300 rounded-md shadow-sm placeholder-gray-400 focus:outline-none focus:ring-blue-500 focus:border-blue-500 transition-shadow duration-200">
            </div>
            <div>
                <button type="submit" class="w-full flex justify-center py-3 px-4 border border-transparent rounded-md shadow-sm text-sm font-medium text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 transform hover:scale-105 transition-transform duration-200">
                    Log In
                </button>
            </div>
        </form>
        <div class="mt-6 text-center">
            <p class="text-sm text-gray-600">
                Need an account? <a href="{{ url_for('signup') }}" class="font-medium text-blue-600 hover:text-blue-500">Sign Up</a>
            </p>
        </div>
    </div>

    <script>

        document.addEventListener('DOMContentLoaded', () => {

            const formContainer = document.getElementById('form-container');

            const formInputs = document.querySelectorAll('.form-input');



            // Trigger the entrance animation for the form

            setTimeout(() => {

                formContainer.classList.add('form-container-enter-active');

            }, 100);



            // Add a subtle shadow effect when a user focuses on an input field

            formInputs.forEach(input => {

                input.addEventListener('focus', () => {

                    input.classList.add('shadow-lg');

                });

                input.addEventListener('blur', () => {

                    input.classList.remove('shadow-lg');

                });

            });

        });

    </script>
</body>
</html>