mirror of
https://github.com/chibicitiberiu/ytsm.git
synced 2024-02-24 05:43:31 +00:00
Fixed bug in first time setup wizard at login/user creation step. If an admin user already exists, the login page didn't work properly.
This commit is contained in:
@ -6,7 +6,7 @@ from django import forms
|
||||
from django.contrib.auth.models import User
|
||||
from django.urls import reverse_lazy
|
||||
|
||||
from YtManagerApp.views.forms.auth import ExtendedUserCreationForm
|
||||
from YtManagerApp.views.forms.auth import ExtendedUserCreationForm, ExtendedAuthenticationForm
|
||||
|
||||
logger = logging.getLogger("FirstTimeWizard")
|
||||
|
||||
@ -30,7 +30,7 @@ class ApiKeyForm(forms.Form):
|
||||
'api_key',
|
||||
Column(
|
||||
Submit('submit', value='Continue'),
|
||||
HTML('<a href="{% url \'first_time_2\' %}" class="btn">Skip</a>')
|
||||
HTML('<a href="{% url \'first_time_2\' %}" class="btn btn-secondary">Skip</a>')
|
||||
)
|
||||
)
|
||||
|
||||
@ -39,6 +39,22 @@ class UserCreationForm(ExtendedUserCreationForm):
|
||||
form_action = reverse_lazy('first_time_2')
|
||||
|
||||
|
||||
class LoginForm(ExtendedAuthenticationForm):
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
self.helper = FormHelper()
|
||||
self.helper.layout = Layout(
|
||||
'username',
|
||||
'password',
|
||||
'remember_me',
|
||||
Column(
|
||||
Submit('submit', value='Continue'),
|
||||
HTML('<a href="{% url \'first_time_2\' %}?register=1" class="btn">Register new admin account</a>')
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
class PickAdminUserForm(forms.Form):
|
||||
admin_user = forms.ModelChoiceField(
|
||||
User.objects.order_by('username'),
|
||||
|
Reference in New Issue
Block a user