Compare commits

..

No commits in common. 'c1b8b0369d743153eec19fd08a43d243fc7fad26' and '97880dab54c64390cb6b53663cb3492bc830dbca' have entirely different histories.

  1. 11
      choose/templates/login.html
  2. 7
      choose/views.py
  3. 3
      tea/settings.py

@ -5,7 +5,14 @@
<title>Login</title> <title>Login</title>
</head> </head>
<body> <body>
<script async src="https://telegram.org/js/telegram-widget.js?21" data-telegram-login="PAOV_Tea_bot" data-size="large" <div class="log-form">
data-auth-url="https://tea.paov.ru/auth/complete/telegram" data-request-access="write"></script> <h2>Login to your account</h2>
<form method="POST">
{% csrf_token %}
<input id="username" name="username" type="username" title="username" placeholder="username" />
<input id="password" name="password" type="password" title="username" placeholder="password" />
<button type="submit" class="btn">Login</button>
</form>
</div>
</body> </body>
</html> </html>

@ -12,6 +12,13 @@ from .utils import get_extension
def login_view(request): def login_view(request):
if request.method == 'POST':
username = request.POST['username']
password = request.POST['password']
user = authenticate(username=username, password=password)
if user is not None and user.is_active and user.is_authenticated:
login(request, user)
return redirect(home)
return render(request, 'login.html') return render(request, 'login.html')

@ -45,7 +45,6 @@ INSTALLED_APPS = [
'django.contrib.sessions', 'django.contrib.sessions',
'django.contrib.messages', 'django.contrib.messages',
'django.contrib.staticfiles', 'django.contrib.staticfiles',
'social_django',
'corsheaders', 'corsheaders',
'choose' 'choose'
] ]
@ -128,7 +127,7 @@ USE_TZ = True
# https://docs.djangoproject.com/en/4.1/howto/static-files/ # https://docs.djangoproject.com/en/4.1/howto/static-files/
STATIC_URL = 'static/' STATIC_URL = 'static/'
STATIC_ROOT = f'{BASE_DIR}/static'
# Default primary key field type # Default primary key field type
# https://docs.djangoproject.com/en/4.1/ref/settings/#default-auto-field # https://docs.djangoproject.com/en/4.1/ref/settings/#default-auto-field

Loading…
Cancel
Save