Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
V
vebinar_15
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Нұрасыл Қайратұлы
vebinar_15
Commits
1ea31ee9
Commit
1ea31ee9
authored
Jan 10, 2024
by
Nurasyl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Initial commit
parents
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
164 additions
and
0 deletions
+164
-0
index.js
JS/index.js
+92
-0
style.css
Styles/style.css
+42
-0
index.html
index.html
+30
-0
No files found.
JS/index.js
0 → 100644
View file @
1ea31ee9
document
.
addEventListener
(
"DOMContentLoaded"
,
()
=>
{
let
authLoginInputVal
=
""
;
let
authPasswordInputVal
=
""
;
let
regisLoginInputVal
=
""
;
let
regisPasswordInputVal
=
""
;
let
regisPasswordVerifyInputVal
=
""
;
const
changeHandler
=
(
event
)
=>
{
switch
(
event
.
target
.
className
)
{
case
"authLogin"
:
authLoginInputVal
=
event
.
target
.
value
;
break
;
case
"authPassword"
:
authPasswordInputVal
=
event
.
target
.
value
;
break
;
case
"regisLogin"
:
regisLoginInputVal
=
event
.
target
.
value
;
break
;
case
"regisPassword"
:
regisPasswordInputVal
=
event
.
target
.
value
;
break
;
case
"regisVerifyPassword"
:
regisPasswordVerifyInputVal
=
event
.
target
.
value
;
break
;
default
:
break
;
};
};
const
clickHandler
=
(
event
)
=>
{
if
(
event
.
target
.
className
===
"spanCreate"
)
{
formLogin
.
style
.
display
=
"none"
;
formRegister
.
style
.
display
=
"flex"
;
}
else
{
formLogin
.
style
.
display
=
"flex"
;
formRegister
.
style
.
display
=
"none"
;
};
};
const
formLogin
=
document
.
getElementById
(
"form_login"
);
const
authLoginInput
=
formLogin
.
children
[
1
];
const
authPasswordInput
=
formLogin
.
children
[
2
];
const
authSpan
=
formLogin
.
children
[
4
];
const
formRegister
=
document
.
getElementById
(
"register_form"
);
const
regisLoginInput
=
formRegister
.
children
[
1
];
const
regisPasswordInput
=
formRegister
.
children
[
2
];
const
regisPasswordVerifyInput
=
formRegister
.
children
[
3
];
const
regisSpan
=
formRegister
.
children
[
5
];
authLoginInput
.
addEventListener
(
"keydown"
,
changeHandler
);
authPasswordInput
.
addEventListener
(
"keydown"
,
changeHandler
);
regisLoginInput
.
addEventListener
(
"keydown"
,
changeHandler
);
regisPasswordInput
.
addEventListener
(
"keydown"
,
changeHandler
);
regisPasswordVerifyInput
.
addEventListener
(
"keydown"
,
changeHandler
);
authSpan
.
addEventListener
(
"click"
,
clickHandler
);
regisSpan
.
addEventListener
(
"click"
,
clickHandler
);
formLogin
.
addEventListener
(
"submit"
,
(
event
)
=>
{
event
.
preventDefault
();
if
(
!
authLoginInputVal
||
!
authPasswordInputVal
)
{
alert
(
"Заполните все поля!"
);
}
else
{
const
storageLogin
=
localStorage
.
getItem
(
"login"
);
if
(
authLoginInputVal
===
storageLogin
)
{
alert
(
`Добро пожаловать!
${
authLoginInputVal
}
`
);
}
else
{
alert
(
"Пользователь с таким логином не найден."
)
};
};
});
formRegister
.
addEventListener
(
"submit"
,
(
event
)
=>
{
event
.
preventDefault
();
if
(
!
regisLoginInputVal
||
!
regisPasswordInputVal
||
!
regisPasswordVerifyInputVal
)
{
alert
(
"Заполните все поля!"
);
}
else
{
console
.
log
(
regisPasswordVerifyInputVal
,
regisPasswordInputVal
);
if
(
regisPasswordInputVal
===
regisPasswordVerifyInputVal
)
{
alert
(
`Добро пожаловать!
${
regisLoginInputVal
}
`
);
localStorage
.
setItem
(
"login"
,
regisLoginInputVal
);
}
else
{
alert
(
"Пароль не совпадает"
);
};
};
});
});
\ No newline at end of file
Styles/style.css
0 → 100644
View file @
1ea31ee9
*
{
box-sizing
:
border-box
;
}
.container
{
width
:
1200px
;
margin
:
0
auto
;
display
:
flex
;
justify-content
:
center
;
}
.form
{
border
:
1px
solid
gray
;
border-radius
:
15px
;
padding
:
15px
25px
;
display
:
flex
;
flex-direction
:
column
;
align-items
:
center
;
justify-content
:
space-around
;
background-color
:
bisque
;
height
:
300px
;
width
:
300px
;
}
.form
input
,
button
{
width
:
90%
;
height
:
35px
;
border-radius
:
5px
;
}
.form
span
{
cursor
:
pointer
;
}
.form
span
:hover
{
color
:
cadetblue
;
}
#register_form
{
display
:
none
;
}
\ No newline at end of file
index.html
0 → 100644
View file @
1ea31ee9
<!DOCTYPE html>
<html
lang=
"en"
>
<head>
<meta
charset=
"UTF-8"
>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1.0"
>
<link
rel=
"stylesheet"
href=
"./Styles/style.css"
>
<script
src=
"./JS/index.js"
></script>
<title>
Document
</title>
</head>
<body>
<div
class=
"container"
>
<form
class=
"form"
id=
"form_login"
>
<h1>
Авторизация
</h1>
<input
class=
"authLogin"
type=
"text"
placeholder=
"Логин"
>
<input
class=
"authPassword"
type=
"password"
placeholder=
"Пароль"
>
<button
type=
"submit"
>
Войти
</button>
<span
class=
"spanCreate"
>
Нет аккаунта? Создать...
</span>
</form>
<form
class=
"form"
id=
"register_form"
>
<h1>
Регистрация
</h1>
<input
class=
"regisLogin"
type=
"text"
placeholder=
"Логин"
>
<input
class=
"regisPassword"
type=
"password"
placeholder=
"Пароль"
>
<input
class=
"regisVerifyPassword"
type=
"password"
placeholder=
"Повторно введите пароль"
>
<button
type=
"submit"
>
Регистрация
</button>
<span
class=
"spanLogin"
>
Уже есть аккаунта? Войти...
</span>
</form>
</div>
</body>
</html>
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment