Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Küppers, Dorothee
oos_2020_todo
Commits
13e8a48c
Commit
13e8a48c
authored
Jul 05, 2020
by
Hänzelmann, Antje
Browse files
login register
parent
2e64e15e
Changes
3
Hide whitespace changes
Inline
Side-by-side
templates/todo/login.html
View file @
13e8a48c
...
...
@@ -14,7 +14,7 @@
margin
:
0
;
padding
:
0
;
height
:
100%
;
background
:
#
FFFFFF
!important
;
background
:
#
ffffff
!important
;
}
.user_card
{
width
:
350px
;
...
...
@@ -39,7 +39,7 @@
#form-title
{
color
:
#fff
;
}
.login_btn
{
...
...
@@ -105,7 +105,7 @@
</form>
</div>
<div
class=
"mt-4"
>
<div
class=
"d-flex justify-content-center links"
>
Noch kein Konto?
<a
href=
"{% url 'register' %}"
class=
"ml-2"
>
Anmelden
</a>
...
...
templates/todo/register.html
View file @
13e8a48c
...
...
@@ -7,7 +7,6 @@
<script
src=
"https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"
></script>
<link
rel=
"stylesheet"
href=
"https://use.fontawesome.com/releases/v5.6.1/css/all.css"
integrity=
"sha384-gfdkjb5BdAXd+lj+gudLWI+BXq4IuLW5IT+brZEZsLFm++aCMlF1V92rMkPaX4PP"
crossorigin=
"anonymous"
>
<style>
body
,
html
{
...
...
@@ -39,9 +38,7 @@
#form-title
{
color
:
#fff
;
}
.login_btn
{
width
:
100%
;
background
:
#33ccff
!important
;
...
...
@@ -66,12 +63,6 @@
outline
:
0px
!important
;
}
#messages
{
background-color
:
grey
;
color
:
#fff
;
padding
:
10px
;
margin-top
:
10px
;
}
</style>
</head>
...
...
@@ -80,41 +71,64 @@
<div
class=
"d-flex justify-content-center h-100"
>
<div
class=
"user_card"
>
<div
class=
"d-flex justify-content-center"
>
<h3
id=
"form-title"
>
LOGIN
</h3>
<h3
id=
"form-title"
>
REGISTER ACCOUNT
</h3>
</div>
<div
class=
"d-flex justify-content-center form_container"
>
<form
method=
"POST"
action=
""
>
<div
class=
"input-group mb-3"
>
<div
class=
"input-group-append"
>
<span
class=
"input-group-text"
><i
class=
"fas fa-user"
></i></span>
</div>
<input
type=
"text"
name=
"username"
placeholder=
"Username..."
class=
"form-control"
>
<input
type=
"text"
name=
"username"
>
</div>
<div
class=
"input-group mb-2"
>
<div
class=
"input-group-append"
>
<span
class=
"input-group-text"
><i
class=
"fas fa-envelope-square"
></i></span>
</div>
<input
type=
"email"
name=
"email"
>
</div>
<div
class=
"input-group mb-2"
>
<div
class=
"input-group-append"
>
<span
class=
"input-group-text"
><i
class=
"fas fa-key"
></i></span>
</div>
<input
type=
"password"
name=
"password"
placeholder=
"Password..."
class=
"form-control"
>
<input
type=
"text"
name=
"password1"
>
</div>
<div
class=
"input-group mb-2"
>
<div
class=
"input-group-append"
>
<span
class=
"input-group-text"
><i
class=
"fas fa-key"
></i></span>
</div>
<input
type=
"text"
name=
"password2"
>
</div>
<div
class=
"d-flex justify-content-center mt-3 login_container"
>
<input
class=
"btn login_btn"
type=
"submit"
value=
"
Login
"
>
</div>
<div
class=
"d-flex justify-content-center mt-3 login_container"
>
<input
class=
"btn login_btn"
type=
"submit"
value=
"
Register Account
"
>
</div>
</form>
</div>
{{ form.errors }}
<div
class=
"mt-4"
>
<div
class=
"d-flex justify-content-center links"
>
Don't have an accou
nt?
<a
href=
"{% url '
register
' %}"
class=
"ml-2"
>
Sign Up
</a>
Noch kein Ko
nt
o
?
<a
href=
"{% url '
login
' %}"
class=
"ml-2"
>
Login
</a>
</div>
</div>
</div>
</div>
</div>
</body
>
<script
>
</html>
\ No newline at end of file
//Query All input fields
var
form_fields
=
document
.
getElementsByTagName
(
'
input
'
)
form_fields
[
0
].
placeholder
=
'
Username..
'
;
form_fields
[
1
].
placeholder
=
'
Email..
'
;
form_fields
[
2
].
placeholder
=
'
Passwort eingeben...
'
;
form_fields
[
3
].
placeholder
=
'
Nochmal eingeben..
'
;
for
(
var
field
in
form_fields
){
form_fields
[
field
].
className
+=
'
form-control
'
}
</script>
</body>
</html>
todo/views.py
View file @
13e8a48c
from
django.db.models
import
Max
from
django.http
import
HttpResponseRedirect
from
django.shortcuts
import
render
from
django.shortcuts
import
render
,
redirect
from
django.contrib
import
messages
from
django.urls
import
reverse_lazy
from
django.utils
import
timezone
...
...
@@ -17,6 +17,7 @@ def registerPage(request):
form
=
CreateUserForm
(
request
.
POST
)
if
form
.
is_valid
():
form
.
save
()
return
redirect
(
'login'
)
context
=
{
'form'
:
form
}
return
render
(
request
,
'accounts/register.html'
,
context
)
...
...
Write
Preview
Supports
Markdown
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