Реализована авторизация и регистрация на сайте
This commit is contained in:
		
							parent
							
								
									cac9ab4bc8
								
							
						
					
					
						commit
						76919f6ba7
					
				|  | @ -0,0 +1,3 @@ | ||||||
|  | # Default ignored files | ||||||
|  | /shelf/ | ||||||
|  | /workspace.xml | ||||||
|  | @ -0,0 +1,14 @@ | ||||||
|  | <?xml version="1.0" encoding="UTF-8"?> | ||||||
|  | <module type="PYTHON_MODULE" version="4"> | ||||||
|  |   <component name="NewModuleRootManager"> | ||||||
|  |     <content url="file://$MODULE_DIR$"> | ||||||
|  |       <excludeFolder url="file://$MODULE_DIR$/venv" /> | ||||||
|  |     </content> | ||||||
|  |     <orderEntry type="jdk" jdkName="Python 3.9 (djangosite)" jdkType="Python SDK" /> | ||||||
|  |     <orderEntry type="sourceFolder" forTests="false" /> | ||||||
|  |   </component> | ||||||
|  |   <component name="PyDocumentationSettings"> | ||||||
|  |     <option name="format" value="PLAIN" /> | ||||||
|  |     <option name="myDocStringFormat" value="Plain" /> | ||||||
|  |   </component> | ||||||
|  | </module> | ||||||
|  | @ -0,0 +1,6 @@ | ||||||
|  | <component name="InspectionProjectProfileManager"> | ||||||
|  |   <settings> | ||||||
|  |     <option name="USE_PROJECT_PROFILE" value="false" /> | ||||||
|  |     <version value="1.0" /> | ||||||
|  |   </settings> | ||||||
|  | </component> | ||||||
|  | @ -0,0 +1,7 @@ | ||||||
|  | <?xml version="1.0" encoding="UTF-8"?> | ||||||
|  | <project version="4"> | ||||||
|  |   <component name="ProjectRootManager" version="2" project-jdk-name="Python 3.9 (djangosite)" project-jdk-type="Python SDK" /> | ||||||
|  |   <component name="PyCharmProfessionalAdvertiser"> | ||||||
|  |     <option name="shown" value="true" /> | ||||||
|  |   </component> | ||||||
|  | </project> | ||||||
|  | @ -0,0 +1,8 @@ | ||||||
|  | <?xml version="1.0" encoding="UTF-8"?> | ||||||
|  | <project version="4"> | ||||||
|  |   <component name="ProjectModuleManager"> | ||||||
|  |     <modules> | ||||||
|  |       <module fileurl="file://$PROJECT_DIR$/.idea/djangosite.iml" filepath="$PROJECT_DIR$/.idea/djangosite.iml" /> | ||||||
|  |     </modules> | ||||||
|  |   </component> | ||||||
|  | </project> | ||||||
|  | @ -0,0 +1,6 @@ | ||||||
|  | <?xml version="1.0" encoding="UTF-8"?> | ||||||
|  | <project version="4"> | ||||||
|  |   <component name="VcsDirectoryMappings"> | ||||||
|  |     <mapping directory="$PROJECT_DIR$" vcs="Git" /> | ||||||
|  |   </component> | ||||||
|  | </project> | ||||||
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							|  | @ -27,6 +27,10 @@ DEBUG = True | ||||||
| 
 | 
 | ||||||
| ALLOWED_HOSTS = [] | ALLOWED_HOSTS = [] | ||||||
| 
 | 
 | ||||||
|  | AUTH_USER_MODEL = 'main.User' | ||||||
|  | LOGIN_REDIRECT_URL = '/' | ||||||
|  | LOGOUT_REDIRECT_URL = '/' | ||||||
|  | REGISTER_REDIRECT_URL = '/' | ||||||
| 
 | 
 | ||||||
| # Application definition | # Application definition | ||||||
| 
 | 
 | ||||||
|  | @ -77,11 +81,11 @@ WSGI_APPLICATION = 'djangosite.wsgi.application' | ||||||
| DATABASES = { | DATABASES = { | ||||||
|     'default': { |     'default': { | ||||||
|         'ENGINE': 'django.db.backends.mysql', |         'ENGINE': 'django.db.backends.mysql', | ||||||
|         'NAME': 'django', |         'NAME': 'workout', | ||||||
|         'USER': 'dhaverd', |         'USER': 'root', | ||||||
|         'PASSWORD': 'Dha.Verd506763', |         'PASSWORD': 'root', | ||||||
|         'HOST': '192.168.0.105', |         'HOST': 'localhost', | ||||||
|         'PORT': 3306, |         'PORT': 3307, | ||||||
|     }, |     }, | ||||||
|     'workout': { |     'workout': { | ||||||
|         'ENGINE': 'django.db.backends.mysql', |         'ENGINE': 'django.db.backends.mysql', | ||||||
|  | @ -131,7 +135,7 @@ USE_TZ = True | ||||||
| STATIC_URL = 'static/' | STATIC_URL = 'static/' | ||||||
| 
 | 
 | ||||||
| STATICFILES_DIRS = [ | STATICFILES_DIRS = [ | ||||||
|     BASE_DIR / "ststic", |     BASE_DIR / "static", | ||||||
| ] | ] | ||||||
| 
 | 
 | ||||||
| # Default primary key field type | # Default primary key field type | ||||||
|  |  | ||||||
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							|  | @ -1,3 +1,9 @@ | ||||||
| from django.contrib import admin | from django.contrib import admin | ||||||
|  | from django.contrib.auth import get_user_model | ||||||
|  | from django.contrib.auth.admin import UserAdmin | ||||||
| 
 | 
 | ||||||
| # Register your models here. | User = get_user_model() | ||||||
|  | 
 | ||||||
|  | @admin.register(User) | ||||||
|  | class UserAdmin(UserAdmin): | ||||||
|  |     pass | ||||||
|  |  | ||||||
|  | @ -0,0 +1,17 @@ | ||||||
|  | from django import forms | ||||||
|  | from django.contrib.auth import get_user_model | ||||||
|  | from django.contrib.auth.forms import UserCreationForm | ||||||
|  | from django.utils.translation import gettext_lazy as _ | ||||||
|  | 
 | ||||||
|  | User = get_user_model() | ||||||
|  | 
 | ||||||
|  | class UserCreationForm(UserCreationForm): | ||||||
|  |     email = forms.EmailField( | ||||||
|  |         label=_("Email"), | ||||||
|  |         max_length=254, | ||||||
|  |         widget=forms.EmailInput(attrs={'autocomplete': 'email'}) | ||||||
|  |     ) | ||||||
|  | 
 | ||||||
|  |     class Meta(UserCreationForm.Meta): | ||||||
|  |         model = User | ||||||
|  |         fields = ("username", "email") | ||||||
|  | @ -0,0 +1,44 @@ | ||||||
|  | # Generated by Django 4.1.4 on 2022-12-20 09:23 | ||||||
|  | 
 | ||||||
|  | import django.contrib.auth.models | ||||||
|  | import django.contrib.auth.validators | ||||||
|  | from django.db import migrations, models | ||||||
|  | import django.utils.timezone | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | class Migration(migrations.Migration): | ||||||
|  | 
 | ||||||
|  |     initial = True | ||||||
|  | 
 | ||||||
|  |     dependencies = [ | ||||||
|  |         ('auth', '0012_alter_user_first_name_max_length'), | ||||||
|  |     ] | ||||||
|  | 
 | ||||||
|  |     operations = [ | ||||||
|  |         migrations.CreateModel( | ||||||
|  |             name='User', | ||||||
|  |             fields=[ | ||||||
|  |                 ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||||||
|  |                 ('password', models.CharField(max_length=128, verbose_name='password')), | ||||||
|  |                 ('last_login', models.DateTimeField(blank=True, null=True, verbose_name='last login')), | ||||||
|  |                 ('is_superuser', models.BooleanField(default=False, help_text='Designates that this user has all permissions without explicitly assigning them.', verbose_name='superuser status')), | ||||||
|  |                 ('username', models.CharField(error_messages={'unique': 'A user with that username already exists.'}, help_text='Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only.', max_length=150, unique=True, validators=[django.contrib.auth.validators.UnicodeUsernameValidator()], verbose_name='username')), | ||||||
|  |                 ('first_name', models.CharField(blank=True, max_length=150, verbose_name='first name')), | ||||||
|  |                 ('last_name', models.CharField(blank=True, max_length=150, verbose_name='last name')), | ||||||
|  |                 ('email', models.EmailField(blank=True, max_length=254, verbose_name='email address')), | ||||||
|  |                 ('is_staff', models.BooleanField(default=False, help_text='Designates whether the user can log into this admin site.', verbose_name='staff status')), | ||||||
|  |                 ('is_active', models.BooleanField(default=True, help_text='Designates whether this user should be treated as active. Unselect this instead of deleting accounts.', verbose_name='active')), | ||||||
|  |                 ('date_joined', models.DateTimeField(default=django.utils.timezone.now, verbose_name='date joined')), | ||||||
|  |                 ('groups', models.ManyToManyField(blank=True, help_text='The groups this user belongs to. A user will get all permissions granted to each of their groups.', related_name='user_set', related_query_name='user', to='auth.group', verbose_name='groups')), | ||||||
|  |                 ('user_permissions', models.ManyToManyField(blank=True, help_text='Specific permissions for this user.', related_name='user_set', related_query_name='user', to='auth.permission', verbose_name='user permissions')), | ||||||
|  |             ], | ||||||
|  |             options={ | ||||||
|  |                 'verbose_name': 'user', | ||||||
|  |                 'verbose_name_plural': 'users', | ||||||
|  |                 'abstract': False, | ||||||
|  |             }, | ||||||
|  |             managers=[ | ||||||
|  |                 ('objects', django.contrib.auth.models.UserManager()), | ||||||
|  |             ], | ||||||
|  |         ), | ||||||
|  |     ] | ||||||
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							|  | @ -1,3 +1,7 @@ | ||||||
|  | from django.contrib.auth.models import AbstractUser | ||||||
| from django.db import models | from django.db import models | ||||||
| 
 | 
 | ||||||
|  | 
 | ||||||
| # Create your models here. | # Create your models here. | ||||||
|  | class User(AbstractUser): | ||||||
|  |     pass | ||||||
|  |  | ||||||
|  | @ -0,0 +1,59 @@ | ||||||
|  | <?php | ||||||
|  | 	header('Content-Type: text/html; charset=UTF-8'); | ||||||
|  | 	$conn = mysqli_connect("localhost", "root", "506763", "workout"); | ||||||
|  | 	if (!$conn) { | ||||||
|  | 		die("Ошибка: " . mysqli_connect_error()); | ||||||
|  | 	} | ||||||
|  | 	// $start_date = $_POST["sd"];
 | ||||||
|  | 	// $end_date = $_POST["ed"];
 | ||||||
|  | 	$nick = $_POST["user"]; | ||||||
|  | 	$sql = "SELECT * FROM workout.v_workout_tasks_w1 WHERE user = '" . $nick . "' ORDER BY task_id;"; | ||||||
|  | 	$day_count = 0; | ||||||
|  | 	$row_count = 0; | ||||||
|  | 	$last_day = ''; | ||||||
|  | 	if($result = mysqli_query($conn, $sql)){ | ||||||
|  | 		foreach($result as $row){ | ||||||
|  | 			if ($day_count == 0) { | ||||||
|  | 				echo "<tr>"; | ||||||
|  | 				echo '<td class="table-head-top" colspan="5"><b>' . $row["week"] . '</b></td>'; | ||||||
|  | 				echo "</tr>"; | ||||||
|  | 				echo "<tr>"; | ||||||
|  | 				echo '<td class="table-head" colspan="5"><b class="day-name">[' . $row["date"] . '] ' . $row["day_name"] . '</b></td>'; | ||||||
|  | 				echo "</tr>"; | ||||||
|  | 				echo '<tr class="odd">'; | ||||||
|  | 				echo '<td class="exercise-head" id="exercise-head"><strong>Упражнение</strong></td>'; | ||||||
|  | 				echo '<td class="muscle-group-head" id="muscle-group-head"><strong>Группа мышц</strong></td>'; | ||||||
|  | 				echo '<td class="count-head" id="count-head"><strong>Время/подходы</strong></td>'; | ||||||
|  | 				echo '<td class="leha" id="leha"><strong>Вес</strong></td>';				 | ||||||
|  | 				$last_day = $row["day_name"]; | ||||||
|  | 				$day_count = 1; | ||||||
|  | 			} | ||||||
|  | 			if ($row["day_name"] != $last_day) { | ||||||
|  | 				$last_day = $row["day_name"]; | ||||||
|  | 				echo "<tr>"; | ||||||
|  | 				echo '<td class="table-head" colspan="5"><b class="day-name">[' . $row["date"] . '] ' . $row["day_name"] . '</b></td>'; | ||||||
|  | 				echo "</tr>"; | ||||||
|  | 				$row_count = 0; | ||||||
|  | 			} | ||||||
|  | 			$tr = ''; | ||||||
|  | 			if ($row_count % 2 != 0) { | ||||||
|  | 				$tr = '<tr class="odd">'; | ||||||
|  | 			} else { | ||||||
|  | 				$tr = '<tr>'; | ||||||
|  | 			} | ||||||
|  | 			echo $tr; | ||||||
|  | 			echo '<td class="exercise">'. $row["exercise"] .'</td>'; | ||||||
|  | 			echo '<td class="muscle-group">' . $row["muscle_group_name"] . '</td>'; | ||||||
|  | 			echo '<td class="count">' . $row["sets_count"] . '</td>'; | ||||||
|  | 			echo '<td class="l-prim">' . $row["weigth"] . '</td>'; | ||||||
|  | 			echo '</tr>'; | ||||||
|  | 			$row_count = $row_count + 1; | ||||||
|  | 		} | ||||||
|  | 		//echo "<tr class='table-row'><td class='table-cell' colspan=3 style='text-align: right;'>Итого:</td><td class='table-cell'>" . mysqli_num_rows($result) . "</td></tr>";
 | ||||||
|  | 		mysqli_free_result($result); | ||||||
|  | 	} else{ | ||||||
|  | 		echo "Ошибка: " . mysqli_error($conn); | ||||||
|  | 	} | ||||||
|  | 	mysqli_close($conn); | ||||||
|  | 	 | ||||||
|  | ?>
 | ||||||
|  | @ -0,0 +1,59 @@ | ||||||
|  | <?php | ||||||
|  | 	header('Content-Type: text/html; charset=UTF-8'); | ||||||
|  | 	$conn = mysqli_connect("localhost", "root", "506763", "workout"); | ||||||
|  | 	if (!$conn) { | ||||||
|  | 		die("Ошибка: " . mysqli_connect_error()); | ||||||
|  | 	} | ||||||
|  | 	// $start_date = $_POST["sd"];
 | ||||||
|  | 	// $end_date = $_POST["ed"];
 | ||||||
|  | 	$nick = $_POST["user"]; | ||||||
|  | 	$sql = "SELECT * FROM workout.v_workout_tasks_w2 WHERE user = '" . $nick . "' ORDER BY task_id;"; | ||||||
|  | 	$day_count = 0; | ||||||
|  | 	$row_count = 0; | ||||||
|  | 	$last_day = ''; | ||||||
|  | 	if($result = mysqli_query($conn, $sql)){ | ||||||
|  | 		foreach($result as $row){ | ||||||
|  | 			if ($day_count == 0) { | ||||||
|  | 				echo "<tr>"; | ||||||
|  | 				echo '<td class="table-head-top" colspan="5"><b>' . $row["week"] . '</b></td>'; | ||||||
|  | 				echo "</tr>"; | ||||||
|  | 				echo "<tr>"; | ||||||
|  | 				echo '<td class="table-head" colspan="5"><b class="day-name">[' . $row["date"] . '] ' . $row["day_name"] . '</b></td>'; | ||||||
|  | 				echo "</tr>"; | ||||||
|  | 				echo '<tr class="odd">'; | ||||||
|  | 				echo '<td class="exercise-head" id="exercise-head"><strong>Упражнение</strong></td>'; | ||||||
|  | 				echo '<td class="muscle-group-head" id="muscle-group-head"><strong>Группа мышц</strong></td>'; | ||||||
|  | 				echo '<td class="count-head" id="count-head"><strong>Время/подходы</strong></td>'; | ||||||
|  | 				echo '<td class="leha" id="leha"><strong>Вес</strong></td>';				 | ||||||
|  | 				$last_day = $row["day_name"]; | ||||||
|  | 				$day_count = 1; | ||||||
|  | 			} | ||||||
|  | 			if ($row["day_name"] != $last_day) { | ||||||
|  | 				$last_day = $row["day_name"]; | ||||||
|  | 				echo "<tr>"; | ||||||
|  | 				echo '<td class="table-head" colspan="5"><b class="day-name">[' . $row["date"] . '] ' . $row["day_name"] . '</b></td>'; | ||||||
|  | 				echo "</tr>"; | ||||||
|  | 				$row_count = 0; | ||||||
|  | 			} | ||||||
|  | 			$tr = ''; | ||||||
|  | 			if ($row_count % 2 != 0) { | ||||||
|  | 				$tr = '<tr class="odd">'; | ||||||
|  | 			} else { | ||||||
|  | 				$tr = '<tr>'; | ||||||
|  | 			} | ||||||
|  | 			echo $tr; | ||||||
|  | 			echo '<td class="exercise">'. $row["exercise"] .'</td>'; | ||||||
|  | 			echo '<td class="muscle-group">' . $row["muscle_group_name"] . '</td>'; | ||||||
|  | 			echo '<td class="count">' . $row["sets_count"] . '</td>'; | ||||||
|  | 			echo '<td class="l-prim">' . $row["weigth"] . '</td>'; | ||||||
|  | 			echo '</tr>'; | ||||||
|  | 			$row_count = $row_count + 1; | ||||||
|  | 		} | ||||||
|  | 		//echo "<tr class='table-row'><td class='table-cell' colspan=3 style='text-align: right;'>Итого:</td><td class='table-cell'>" . mysqli_num_rows($result) . "</td></tr>";
 | ||||||
|  | 		mysqli_free_result($result); | ||||||
|  | 	} else{ | ||||||
|  | 		echo "Ошибка: " . mysqli_error($conn); | ||||||
|  | 	} | ||||||
|  | 	mysqli_close($conn); | ||||||
|  | 	 | ||||||
|  | ?>
 | ||||||
										
											Binary file not shown.
										
									
								
							| After Width: | Height: | Size: 9.9 KiB | 
										
											Binary file not shown.
										
									
								
							| After Width: | Height: | Size: 716 KiB | 
|  | @ -12,8 +12,8 @@ $("#form").on("submit", function(){ | ||||||
| 
 | 
 | ||||||
| $('body').on('click', '#password-checkbox', function(){ | $('body').on('click', '#password-checkbox', function(){ | ||||||
| 	if ($(this).is(':checked')){ | 	if ($(this).is(':checked')){ | ||||||
| 		$('#password').attr('type', 'text'); | 		$('#id_password').attr('type', 'text'); | ||||||
| 	} else { | 	} else { | ||||||
| 		$('#password').attr('type', 'password'); | 		$('#id_password').attr('type', 'password'); | ||||||
| 	} | 	} | ||||||
| }); | }); | ||||||
|  | @ -12,10 +12,12 @@ $("#form").on("submit", function(){ | ||||||
| 
 | 
 | ||||||
| $('body').on('click', '#password-checkbox', function(){ | $('body').on('click', '#password-checkbox', function(){ | ||||||
| 	if ($(this).is(':checked')){ | 	if ($(this).is(':checked')){ | ||||||
| 		$('#password').attr('type', 'text'); | 		$('#id_password1').attr('type', 'text'); | ||||||
| 		$('#password2').attr('type', 'text'); | 		$('#id_password2').attr('type', 'text'); | ||||||
| 	} else { | 	} else { | ||||||
| 		$('#password').attr('type', 'password'); | 		$('#id_password1').attr('type', 'password'); | ||||||
| 		$('#password2').attr('type', 'password'); | 		$('#id_password2').attr('type', 'password'); | ||||||
| 	} | 	} | ||||||
| }); | }); | ||||||
|  | 
 | ||||||
|  | $('#id_email').after('<br>'); | ||||||
|  | @ -18,7 +18,7 @@ function getData() { | ||||||
| 	} else { | 	} else { | ||||||
| 		var username = $('#nickname-input').val().trim();						 | 		var username = $('#nickname-input').val().trim();						 | ||||||
| 		$.ajax({ | 		$.ajax({ | ||||||
| 			url:"getData1.php",			 | 			url:"main/templates/getData1.php",			 | ||||||
| 			type: 'POST', | 			type: 'POST', | ||||||
| 			data: {user: username}, | 			data: {user: username}, | ||||||
| 			success: function(msg){  | 			success: function(msg){  | ||||||
|  | @ -35,7 +35,7 @@ function getData() { | ||||||
| 			} | 			} | ||||||
| 		}); | 		}); | ||||||
| 		$.ajax({ | 		$.ajax({ | ||||||
| 			url:"getData2.php",			 | 			url:"main/templates/getData2.php",			 | ||||||
| 			type: 'POST', | 			type: 'POST', | ||||||
| 			data: {user: username}, | 			data: {user: username}, | ||||||
| 			success: function(msg2){  | 			success: function(msg2){  | ||||||
|  |  | ||||||
|  | @ -137,9 +137,19 @@ h2 { | ||||||
| 	font-size: 16px; | 	font-size: 16px; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | .minecraft-vanilla { | ||||||
|  | 	width: 50%; | ||||||
|  | 	border-radius: 20px; | ||||||
|  | } | ||||||
|  | 
 | ||||||
| .zomboid { | .zomboid { | ||||||
| 	width: 50%; | 	width: 50%; | ||||||
| 	border-radius: 10%; | 	border-radius: 20px; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | .ragnamod { | ||||||
|  | 	width: 50%; | ||||||
|  | 	border-radius: 20px; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| .image-content { | .image-content { | ||||||
|  | @ -154,11 +164,6 @@ h2 { | ||||||
| 	height: 110px; | 	height: 110px; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| .minecraft-vanilla { |  | ||||||
| 	width: 50%; |  | ||||||
| 	border-radius: 10%; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| .fixed nav a:hover { | .fixed nav a:hover { | ||||||
| 	color: #E0E0E0; | 	color: #E0E0E0; | ||||||
| 	background-color: #609A21; | 	background-color: #609A21; | ||||||
|  | @ -327,7 +332,7 @@ h2 { | ||||||
| 	padding-bottom: 10px; | 	padding-bottom: 10px; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| .login-form { | .login-form, .reset-form { | ||||||
| 	width: 50%; | 	width: 50%; | ||||||
| 	text-align: center; | 	text-align: center; | ||||||
| 	grid-area: login-form; | 	grid-area: login-form; | ||||||
|  | @ -390,11 +395,15 @@ h2 { | ||||||
| 	color: #E0E0E0; | 	color: #E0E0E0; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | .auth-form-reg .password-label { | ||||||
|  |     margin-right: 5em; | ||||||
|  | } | ||||||
|  | 
 | ||||||
| .signin-main { | .signin-main { | ||||||
| 	padding-left: 10px; | 	padding-left: 10px; | ||||||
| 	width: 97%; | 	width: 97%; | ||||||
| 	display: grid; | 	display: grid; | ||||||
| 	grid-template-columns: 35% 60% 5%; | 	grid-template-columns: 30% 60% 10%; | ||||||
| 	grid-template-areas: "signin-left signin-form signin-right"; | 	grid-template-areas: "signin-left signin-form signin-right"; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | @ -407,8 +416,8 @@ h2 { | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| .signin-form { | .signin-form { | ||||||
| 	width: 50%; | 	width: 70%; | ||||||
| 	text-align: center; | 	text-align: right; | ||||||
| 	grid-area: signin-form; | 	grid-area: signin-form; | ||||||
| 	padding-bottom: 20px; | 	padding-bottom: 20px; | ||||||
| } | } | ||||||
|  | @ -444,4 +453,54 @@ h2 { | ||||||
| 
 | 
 | ||||||
| #wt2 { | #wt2 { | ||||||
| 	display: none; | 	display: none; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | .auth-section { | ||||||
|  |     background-color: #424242; | ||||||
|  |     margin-top: 10px; | ||||||
|  |     padding: 10px; | ||||||
|  |     text-align: right; | ||||||
|  |     font-size: 20px; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | #login-link { | ||||||
|  |     padding-right: 20px; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | #registration-link { | ||||||
|  |     padding-right: 10px; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | .auth-form label, .auth-form-reg label, .reset-form label { | ||||||
|  |     color: #E0E0E0; | ||||||
|  | 	font-family: segoe print; | ||||||
|  | 	font-size: 16px; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | .auth-form input, .auth-form-reg input, .reset-form input { | ||||||
|  | 	font-family: Arial; | ||||||
|  | 	font-size: 16px; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | #id_username, #id_password, #id_password1, #id_password2, #id_email { | ||||||
|  |     margin-left: 5px; | ||||||
|  |     margin-top: 10px; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | .helptext { | ||||||
|  |     display: none; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | .usernick { | ||||||
|  |     margin-right: 10px; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | .forgot-pass-link { | ||||||
|  |     text-align: center; | ||||||
|  |     margin-bottom: 5px; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | .forgot-pass-link a { | ||||||
|  |     font-family: segoe print; | ||||||
|  | 	font-size: 16px; | ||||||
| } | } | ||||||
|  | @ -124,9 +124,19 @@ h2 { | ||||||
| 	font-size: 14px; | 	font-size: 14px; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | .minecraft-vanilla { | ||||||
|  | 	width: 50%; | ||||||
|  | 	border-radius: 20px; | ||||||
|  | } | ||||||
|  | 
 | ||||||
| .zomboid { | .zomboid { | ||||||
| 	width: 50%; | 	width: 50%; | ||||||
| 	border-radius: 10%; | 	border-radius: 20px; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | .ragnamod { | ||||||
|  | 	width: 50%; | ||||||
|  | 	border-radius: 20px; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| .image-content { | .image-content { | ||||||
|  | @ -142,11 +152,6 @@ h2 { | ||||||
| 	height: 100px; | 	height: 100px; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| .minecraft-vanilla { |  | ||||||
| 	width: 50%; |  | ||||||
| 	border-radius: 10%; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| .default nav a:hover { | .default nav a:hover { | ||||||
| 	color: #E0E0E0; | 	color: #E0E0E0; | ||||||
| 	background-color: #609A21; | 	background-color: #609A21; | ||||||
|  | @ -309,7 +314,7 @@ h2 { | ||||||
| 	padding-bottom: 10px; | 	padding-bottom: 10px; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| .login-form { | .login-form, .reset-form  { | ||||||
| 	width: 50%; | 	width: 50%; | ||||||
| 	text-align: center; | 	text-align: center; | ||||||
| 	grid-area: login-form; | 	grid-area: login-form; | ||||||
|  | @ -372,11 +377,15 @@ h2 { | ||||||
| 	color: #E0E0E0; | 	color: #E0E0E0; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | .auth-form-reg .password-label { | ||||||
|  |     margin-right: 5em; | ||||||
|  | } | ||||||
|  | 
 | ||||||
| .signin-main { | .signin-main { | ||||||
| 	padding-left: 10px; | 	padding-left: 10px; | ||||||
| 	width: 97%; | 	width: 97%; | ||||||
| 	display: grid; | 	display: grid; | ||||||
| 	grid-template-columns: 35% 60% 5%; | 	grid-template-columns: 30% 60% 10%; | ||||||
| 	grid-template-areas: "signin-left signin-form signin-right"; | 	grid-template-areas: "signin-left signin-form signin-right"; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | @ -389,7 +398,7 @@ h2 { | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| .signin-form { | .signin-form { | ||||||
| 	width: 50%; | 	width: 70%; | ||||||
| 	text-align: center; | 	text-align: center; | ||||||
| 	grid-area: signin-form; | 	grid-area: signin-form; | ||||||
| 	padding-bottom: 20px; | 	padding-bottom: 20px; | ||||||
|  | @ -425,4 +434,54 @@ h2 { | ||||||
| 
 | 
 | ||||||
| #wt2 { | #wt2 { | ||||||
| 	display: none; | 	display: none; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | .auth-section{ | ||||||
|  |     background-color: #424242; | ||||||
|  |     margin-top: 10px; | ||||||
|  |     padding: 10px; | ||||||
|  |     text-align: right; | ||||||
|  |     font-size: 12px; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | #login-link { | ||||||
|  |     padding-right: 20px; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | #registration-link { | ||||||
|  |     padding-right: 10px; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | .auth-form label, .auth-form-reg label, .reset-form label { | ||||||
|  |     color: #E0E0E0; | ||||||
|  | 	font-family: segoe print; | ||||||
|  | 	font-size: 16px; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | .auth-form input, .auth-form-reg input, .reset-form input { | ||||||
|  | 	font-family: Arial; | ||||||
|  | 	font-size: 14px; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | #id_username, #id_password, #id_password1, #id_password2, #id_email { | ||||||
|  |     margin-left: 5px; | ||||||
|  |     margin-top: 10px; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | .helptext { | ||||||
|  |     display: none; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | .usernick { | ||||||
|  |     margin-right: 10px; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | .forgot-pass-link { | ||||||
|  |     text-align: center; | ||||||
|  |     margin-bottom: 5px; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | .forgot-pass-link a { | ||||||
|  |     font-family: segoe print; | ||||||
|  | 	font-size: 14px; | ||||||
| } | } | ||||||
|  | @ -1,49 +0,0 @@ | ||||||
| <!DOCTYPE html> |  | ||||||
| <html lang="ru"> |  | ||||||
| 	<head> |  | ||||||
| 		<meta charset="utf-8"> |  | ||||||
| 		<meta name="viewport" content="width=device-width"> |  | ||||||
| 		<title>Dhaverd</title> |  | ||||||
| 		<link href="src/styles/style.css?v=01000071" rel="stylesheet" media="screen" /> |  | ||||||
| 		<link rel="stylesheet" href="src/styles/styleMobile.css?v=01000071" media="handheld,only screen and (max-device-width:480px)" /> |  | ||||||
| 		<link rel="icon" href="src/img/favicon.ico">			 |  | ||||||
| 	</head> |  | ||||||
| 	<body id="main"> |  | ||||||
| 		<header id="header" class="default index-logo"> |  | ||||||
| 			<div class="logo-img"> |  | ||||||
| 				<a  href="index.html"><img class="header-img" src="src/img/dhaverd2.png"></a> |  | ||||||
| 			</div> |  | ||||||
| 		</header> |  | ||||||
| 		<main> |  | ||||||
| 			<section class="side-bar"> |  | ||||||
| 				<p class="mainp"><a class="side-href" href="index.html">Главная</a></p> |  | ||||||
| 				<p class="gitea"><a class="side-href" href="http:\\176.114.129.4:3000">Gitea</a></p> |  | ||||||
| 				<p class="servers"><a class="side-href" href="servers.html">Сервера</a></p> |  | ||||||
| 				<p class="mychat"><a class="side-href" href="mychat.html">MyChat</a></p> |  | ||||||
| 				<p class="workout-area"><a class="side-href" href="workout.html">Программа тренировок</a></p> |  | ||||||
| 			</section> |  | ||||||
| 			<section class="main-content login-main-content" id="main-content"> |  | ||||||
| 				<h1 id="loginh1" class="page-title">Вход</h1> |  | ||||||
| 				<section class="login-main"> |  | ||||||
| 					<section class="login-left"></section> |  | ||||||
| 					<section class="login-form"> |  | ||||||
| 						<form id="form"> |  | ||||||
| 							<input id="login" class="login-input" type="text" name="login"> |  | ||||||
| 							<input id="password" class="login-input" type="password" name="password"> |  | ||||||
| 							<label class="password-label"><input id="password-checkbox" type="checkbox" value="">Показать пароль</label> |  | ||||||
| 							<input class="login-input login-button" type="submit" name="send" value="Вход"> |  | ||||||
| 						</form> |  | ||||||
| 					</section> |  | ||||||
| 					<section class="login-right"></section> |  | ||||||
| 				</section> |  | ||||||
| 			</section> |  | ||||||
| 		</main> |  | ||||||
| 		<footer> |  | ||||||
| 			<section> |  | ||||||
| 				<p id="footer">® Dhaverd 2022</p> |  | ||||||
| 			</section> |  | ||||||
| 		</footer> |  | ||||||
| 		<script src="src/scripts/jquery.min.js?v=0000001"></script> |  | ||||||
| 		<script src="src/scripts/login.js?v=0000001"></script>	 |  | ||||||
| 	</body>	 |  | ||||||
| </html> |  | ||||||
|  | @ -13,6 +13,15 @@ | ||||||
| 	</section> | 	</section> | ||||||
| 	<br> | 	<br> | ||||||
| 	<br> | 	<br> | ||||||
|  | 	<section class="server-temp"> | ||||||
|  | 		<h2 class="server-name">Minecraft 1.16.5 RagnaMod VI</h2> | ||||||
|  | 		<h3 class="server-ips">IP: 176.114.129.4:25565</h3> | ||||||
|  | 		<img class="ragnamod" src="{% static 'main/src/img/ragnamod.jpg' %}"> | ||||||
|  | 		<!--<section class="image-content"> | ||||||
|  | 				</section>--> | ||||||
|  | 	</section> | ||||||
|  | 	<br> | ||||||
|  | 	<br> | ||||||
| 	<section class="server-temp"> | 	<section class="server-temp"> | ||||||
| 		<h2 class="server-name">Project Zomboid</h2> | 		<h2 class="server-name">Project Zomboid</h2> | ||||||
| 		<h3 class="server-ips">IP: 176.114.129.4:16261</h3> | 		<h3 class="server-ips">IP: 176.114.129.4:16261</h3> | ||||||
|  |  | ||||||
|  | @ -1,50 +0,0 @@ | ||||||
| <!DOCTYPE html> |  | ||||||
| <html lang="ru"> |  | ||||||
| 	<head> |  | ||||||
| 		<meta charset="utf-8"> |  | ||||||
| 		<meta name="viewport" content="width=device-width"> |  | ||||||
| 		<title>Dhaverd</title> |  | ||||||
| 		<link href="src/styles/style.css?v=01000071" rel="stylesheet" media="screen" /> |  | ||||||
| 		<link rel="stylesheet" href="src/styles/styleMobile.css?v=01000071" media="handheld,only screen and (max-device-width:480px)" /> |  | ||||||
| 		<link rel="icon" href="src/img/favicon.ico">			 |  | ||||||
| 	</head> |  | ||||||
| 	<body id="main"> |  | ||||||
| 		<header id="header" class="default index-logo"> |  | ||||||
| 			<div class="logo-img"> |  | ||||||
| 				<a  href="index.html"><img class="header-img" src="src/img/dhaverd2.png"></a> |  | ||||||
| 			</div> |  | ||||||
| 		</header> |  | ||||||
| 		<main> |  | ||||||
| 			<section class="side-bar"> |  | ||||||
| 				<p class="mainp"><a class="side-href" href="index.html">Главная</a></p> |  | ||||||
| 				<p class="gitea"><a class="side-href" href="http:\\176.114.129.4:3000">Gitea</a></p> |  | ||||||
| 				<p class="servers"><a class="side-href" href="servers.html">Сервера</a></p> |  | ||||||
| 				<p class="mychat"><a class="side-href" href="mychat.html">MyChat</a></p> |  | ||||||
| 				<p class="workout-area"><a class="side-href" href="workout.html">Программа тренировок</a></p> |  | ||||||
| 			</section> |  | ||||||
| 			<section class="main-content signin-main-content" id="main-content"> |  | ||||||
| 				<h1 id="signinh1" class="page-title">Регистрация</h1> |  | ||||||
| 				<section class="signin-main"> |  | ||||||
| 					<section class="signin-left"></section> |  | ||||||
| 					<section class="signin-form"> |  | ||||||
| 						<form id="form"> |  | ||||||
| 							<input id="login" class="signin-input" type="text" name="login"> |  | ||||||
| 							<input id="password" class="signin-input" type="password" name="password"> |  | ||||||
| 							<input id="password2" class="signin-input" type="password" name="password"> |  | ||||||
| 							<label class="password-label"><input id="password-checkbox" type="checkbox" value="">Показать пароль</label> |  | ||||||
| 							<input class="signin-input signin-button" type="submit" name="send" value="Зарегистрироваться"> |  | ||||||
| 						</form> |  | ||||||
| 					</section> |  | ||||||
| 					<section class="signin-right"></section> |  | ||||||
| 				</section> |  | ||||||
| 			</section> |  | ||||||
| 		</main> |  | ||||||
| 		<footer> |  | ||||||
| 			<section> |  | ||||||
| 				<p id="footer">® Dhaverd 2022</p> |  | ||||||
| 			</section> |  | ||||||
| 		</footer> |  | ||||||
| 		<script src="src/scripts/jquery.min.js?v=0000001"></script> |  | ||||||
| 		<script src="src/scripts/signin.js?v=0000001"></script>	 |  | ||||||
| 	</body>	 |  | ||||||
| </html> |  | ||||||
|  | @ -8,22 +8,30 @@ | ||||||
| 		<link href="{% static 'main/src/styles/style.css' %}" rel="stylesheet" media="screen" /> | 		<link href="{% static 'main/src/styles/style.css' %}" rel="stylesheet" media="screen" /> | ||||||
| 		<link rel="stylesheet" href="{% static 'main/src/styles/styleMobile.css' %}" media="handheld,only screen and (max-device-width:480px)" /> | 		<link rel="stylesheet" href="{% static 'main/src/styles/styleMobile.css' %}" media="handheld,only screen and (max-device-width:480px)" /> | ||||||
| 		<link rel="icon" href="{% static 'main/src/img/favicon.ico' %}"> | 		<link rel="icon" href="{% static 'main/src/img/favicon.ico' %}"> | ||||||
| 		{% block javascripts %}{% endblock %} |  | ||||||
| 		<!--<script src="src/scripts/jquery.min.js"></script>--> | 		<!--<script src="src/scripts/jquery.min.js"></script>--> | ||||||
| 	</head> | 	</head> | ||||||
| 	<body id="main"> | 	<body id="main"> | ||||||
| 		<header id="header" class="default index-logo"> | 		<header id="header" class="default index-logo"> | ||||||
| 			<div class="logo-img"> | 			<div class="logo-img"> | ||||||
| 				<a  href="http://localhost:8000/"><img class="header-img" src="{% static 'main/src/img/dhaverd2.png' %}"></a> | 				<a  href="{% url 'index' %}"><img class="header-img" src="{% static 'main/src/img/dhaverd2.png' %}"></a> | ||||||
| 			</div> | 			</div> | ||||||
| 		</header> | 		</header> | ||||||
| 		<main> | 		<main> | ||||||
| 			<section class="side-bar"> | 			<section class="side-bar"> | ||||||
| 				<p class="mainp"><a class="side-href" href="http://localhost:8000/">Главная</a></p> | 				<p class="mainp"><a class="side-href" href="{% url 'index' %}">Главная</a></p> | ||||||
| 				<p class="gitea"><a class="side-href" href="http:\\176.114.129.4:3000">Gitea</a></p> | 				<p class="gitea"><a class="side-href" href="http:\\176.114.129.4:3000">Gitea</a></p> | ||||||
| 				<p class="servers"><a class="side-href" href="servers">Сервера</a></p> | 				<p class="servers"><a class="side-href" href="{% url 'servers' %}">Сервера</a></p> | ||||||
| 				<p class="mychat"><a class="side-href" href="mychat">MyChat</a></p> | 				<p class="mychat"><a class="side-href" href="{% url 'mychat' %}">MyChat</a></p> | ||||||
| 				<p class="workout-area"><a class="side-href" href="workout">Программа тренировок</a></p> | 				<p class="workout-area"><a class="side-href" href="{% url 'workout' %}">Программа тренировок</a></p> | ||||||
|  | 			</section> | ||||||
|  | 			<section class="auth-section"> | ||||||
|  | 				{% if user.is_authenticated %} | ||||||
|  | 					<a class="usernick">{{user}}</a> | ||||||
|  | 					<a id="logout-link" href="{% url 'logout' %}">Выход</a> | ||||||
|  | 				{% else %} | ||||||
|  | 					<a id="login-link" href="{% url 'login' %}">Вход</a> | ||||||
|  | 					<a id="registration-link" href="{% url 'register' %}">Регистрация</a> | ||||||
|  | 				{% endif %} | ||||||
| 			</section> | 			</section> | ||||||
| 			{% block maincontent %}{% endblock %} | 			{% block maincontent %}{% endblock %} | ||||||
| 		</main> | 		</main> | ||||||
|  | @ -32,5 +40,6 @@ | ||||||
| 				<p id="footer">® Dhaverd 2022</p> | 				<p id="footer">® Dhaverd 2022</p> | ||||||
| 			</section> | 			</section> | ||||||
| 		</footer> | 		</footer> | ||||||
|  | 		{% block javascripts %}{% endblock %} | ||||||
| 	</body>	 | 	</body>	 | ||||||
| </html> | </html> | ||||||
|  | @ -4,22 +4,27 @@ | ||||||
| {% block maincontent %} | {% block maincontent %} | ||||||
| <section class="main-content workout-main-content" id="main-content"> | <section class="main-content workout-main-content" id="main-content"> | ||||||
| 	<h1 class="page-title">Программа тренировок</h1> | 	<h1 class="page-title">Программа тренировок</h1> | ||||||
| 	<div class="nickname-form"> | 	{% if user.is_authenticated %} | ||||||
| 		<p class="content-text">Для просмотра иформации введите ник:</p> | 		<p class="content-text">Раздел в разработке!</p> | ||||||
| 		<input id="nickname-input" name="nickname-input" type="text" class="nickname-input"></input> | 		<div class="nickname-form"> | ||||||
|  | 			<p class="content-text">Для просмотра иформации введите ник:</p> | ||||||
|  | 			<input id="nickname-input" name="nickname-input" type="text" class="nickname-input"></input> | ||||||
|  | 			<br> | ||||||
|  | 			<button id='nick-btn' class="nickname-button">Показать</button> | ||||||
|  | 		</div> | ||||||
|  | 		<table id='wt1' class="workout-table"> | ||||||
|  | 		</table> | ||||||
| 		<br> | 		<br> | ||||||
| 		<button id='nick-btn' class="nickname-button">Показать</button> | 		<table id='wt2' class="workout-table"> | ||||||
| 	</div> | 		</table> | ||||||
| 	<table id='wt1' class="workout-table"> | 	{% else %} | ||||||
| 	</table> | 	<p class="content-text">Для просмотра информации войдите или зарегистрируйтесь!</p> | ||||||
| 	<br> | 	{% endif %} | ||||||
| 	<table id='wt2' class="workout-table"> |  | ||||||
| 	</table> |  | ||||||
| </section> | </section> | ||||||
| {% endblock %} | {% endblock %} | ||||||
| {% block titletext %}Dhaverd - Workout{% endblock %} | {% block titletext %}Dhaverd - Workout{% endblock %} | ||||||
| 
 | 
 | ||||||
| {% block javascripts %} | {% block javascripts %} | ||||||
| <script src="{% static 'main/src/scripts/jquery.min.js' %}"></script> | <script src="{% static 'main/src/scripts/jquery.min.js' %}"></script> | ||||||
| <script src="{% static 'src/scripts/workout.js' %}"></script> | <script src="{% static 'main/src/scripts/workout.js' %}"></script> | ||||||
| {% endblock %} | {% endblock %} | ||||||
|  | @ -0,0 +1,27 @@ | ||||||
|  | {% extends 'main/temp.html' %} | ||||||
|  | {% load static %} | ||||||
|  | 
 | ||||||
|  | {% block maincontent %} | ||||||
|  | <section class="main-content login-main-content" id="main-content"> | ||||||
|  | 	<h1 id="loginh1" class="page-title">Вход</h1> | ||||||
|  | 	<section class="login-main"> | ||||||
|  | 		<section class="login-left"></section> | ||||||
|  | 		<section class="login-form"> | ||||||
|  | 			<form class="auth-form" id="form" action="{% url 'login' %}" method="post"> | ||||||
|  | 				{{form}} | ||||||
|  | 				{% csrf_token %} | ||||||
|  | 				<br><label class="password-label"><input id="password-checkbox" type="checkbox" value="">Показать пароль</label> | ||||||
|  | 				<button type="submit" class="signin-button">Вход</button> | ||||||
|  | 			</form> | ||||||
|  | 		</section> | ||||||
|  | 		<section class="login-right"></section> | ||||||
|  | 	</section> | ||||||
|  | 	<section class="forgot-pass-link"><a href="{% url 'password_reset' %}">Забыли пароль?</a></section> | ||||||
|  | </section> | ||||||
|  | {% endblock %} | ||||||
|  | {% block titletext %}Dhaverd - Login{% endblock %} | ||||||
|  | 
 | ||||||
|  | {% block javascripts %} | ||||||
|  | <script src="{% static 'main/src/scripts/jquery.min.js' %}"></script> | ||||||
|  | <script src="{% static 'main/src/scripts/login.js' %}"></script> | ||||||
|  | {% endblock %} | ||||||
|  | @ -0,0 +1,20 @@ | ||||||
|  | {% extends 'main/temp.html' %} | ||||||
|  | {% load static %} | ||||||
|  | 
 | ||||||
|  | {% block maincontent %} | ||||||
|  | <section class="main-content resetpass-main-content" id="main-content"> | ||||||
|  | 	<h1 class="page-title">Восстановление пароля</h1> | ||||||
|  | 	<section class="login-main"> | ||||||
|  | 		<section class="login-left"></section> | ||||||
|  | 		<section class="reset-form"> | ||||||
|  | 			<form action="{% url 'password_reset' %}" method="post"> | ||||||
|  | 				{{ form }} | ||||||
|  | 				{% csrf_token %} | ||||||
|  | 				<button type="submit" class="signin-button">Восстановить</button> | ||||||
|  | 			</form> | ||||||
|  | 		</section> | ||||||
|  | 		<section class="login-right"></section> | ||||||
|  | 	</section> | ||||||
|  | </section> | ||||||
|  | {% endblock %} | ||||||
|  | {% block titletext %}Dhaverd - Reset Password{% endblock %} | ||||||
|  | @ -0,0 +1,26 @@ | ||||||
|  | {% extends 'main/temp.html' %} | ||||||
|  | {% load static %} | ||||||
|  | 
 | ||||||
|  | {% block maincontent %} | ||||||
|  | <section class="main-content signin-main-content" id="main-content"> | ||||||
|  | 	<h1 id="signinh1" class="page-title">Регистрация</h1> | ||||||
|  | 	<section class="signin-main"> | ||||||
|  | 		<section class="signin-left"></section> | ||||||
|  | 		<section class="signin-form"> | ||||||
|  | 			<form class="auth-form-reg"  id="form" action="{% url 'register' %}" method="post"> | ||||||
|  | 				{{ form }} | ||||||
|  | 				{% csrf_token %} | ||||||
|  | 				<label class="password-label"><input id="password-checkbox" type="checkbox" value="">Показать пароль</label> | ||||||
|  | 				<input class="signin-input signin-button" type="submit" name="send" value="Зарегистрироваться"> | ||||||
|  | 			</form> | ||||||
|  | 		</section> | ||||||
|  | 		<section class="signin-right"></section> | ||||||
|  | 	</section> | ||||||
|  | </section> | ||||||
|  | {% endblock %} | ||||||
|  | {% block titletext %}Dhaverd - Registration{% endblock %} | ||||||
|  | 
 | ||||||
|  | {% block javascripts %} | ||||||
|  | <script src="{% static 'main/src/scripts/jquery.min.js' %}"></script> | ||||||
|  | <script src="{% static 'main/src/scripts/signin.js' %}"></script> | ||||||
|  | {% endblock %} | ||||||
							
								
								
									
										16
									
								
								main/urls.py
								
								
								
								
							
							
						
						
									
										16
									
								
								main/urls.py
								
								
								
								
							|  | @ -1,9 +1,15 @@ | ||||||
| from django.urls import path | from django.urls import path, include | ||||||
| from . import views | from . import views | ||||||
|  | from .views import Register | ||||||
| 
 | 
 | ||||||
| urlpatterns = [ | urlpatterns = [ | ||||||
|     path('', views.index), |     path('', views.index, name='index'), | ||||||
|     path('servers', views.servers), |     path('servers', views.servers, name='servers'), | ||||||
|     path('mychat', views.mychat), |     path('mychat', views.mychat, name='mychat'), | ||||||
|     path('workout', views.workout) |     path('workout', views.workout, name='workout'), | ||||||
|  |     path('login', views.login, name='login'), | ||||||
|  |     path('registration', views.registration, name='registration'), | ||||||
|  |     path('logout', views.logout, name='logout'), | ||||||
|  |     path('', include('django.contrib.auth.urls')), | ||||||
|  |     path('register/', Register.as_view(), name='register'), | ||||||
| ] | ] | ||||||
|  | @ -1,5 +1,10 @@ | ||||||
| from django.shortcuts import render | import django.contrib.auth | ||||||
|  | from django.contrib.auth import authenticate | ||||||
|  | from django.shortcuts import render, redirect | ||||||
| from django.http import HttpResponse | from django.http import HttpResponse | ||||||
|  | from django.views import View | ||||||
|  | 
 | ||||||
|  | from main.forms import UserCreationForm | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| # Create your views here. | # Create your views here. | ||||||
|  | @ -17,3 +22,39 @@ def mychat(request): | ||||||
| 
 | 
 | ||||||
| def workout(request): | def workout(request): | ||||||
|     return render(request, 'main/workout.html') |     return render(request, 'main/workout.html') | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | def login(request): | ||||||
|  |     return render(request, 'registration/login.html') | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | def registration(request): | ||||||
|  |     return render(request, 'registration/signin.html') | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | def logout(request): | ||||||
|  |     pass | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | class Register(View): | ||||||
|  |     template_name = 'registration/signin.html' | ||||||
|  | 
 | ||||||
|  |     def get(self, request): | ||||||
|  |         context = { | ||||||
|  |             'form': UserCreationForm() | ||||||
|  |         } | ||||||
|  |         return render(request, self.template_name, context) | ||||||
|  | 
 | ||||||
|  |     def post(self, request): | ||||||
|  |         form = UserCreationForm(request.POST) | ||||||
|  |         if form.is_valid(): | ||||||
|  |             form.save() | ||||||
|  |             username = form.cleaned_data.get('username') | ||||||
|  |             password = form.cleaned_data.get('password1') | ||||||
|  |             user = authenticate(username=username, password=password) | ||||||
|  |             django.contrib.auth.login(request, user) | ||||||
|  |             return redirect('home') | ||||||
|  |         context = { | ||||||
|  |             'form': form | ||||||
|  |         } | ||||||
|  |         return render(request, self.template_name, context) | ||||||
		Loading…
	
		Reference in New Issue