Merge pull request 'RANDOMSEC-19' (#2) from RANDOMSEC-19 into master
Reviewed-on: #2
This commit is contained in:
commit
bc109087ba
@ -1,4 +1,5 @@
|
|||||||
# MultiUserOpenRefine
|
# MultiUserOpenRefine
|
||||||
|
|
||||||
![MultiUserOpenRefine](logo.svg)
|
![MultiUserOpenRefine](logo.svg)
|
||||||
|
|
||||||
MultiUserOpenRefine is an extension to open-source tool that, in addition to
|
MultiUserOpenRefine is an extension to open-source tool that, in addition to
|
||||||
|
@ -9,13 +9,12 @@ https://docs.djangoproject.com/en/4.0/topics/settings/
|
|||||||
For the full list of settings and their values, see
|
For the full list of settings and their values, see
|
||||||
https://docs.djangoproject.com/en/4.0/ref/settings/
|
https://docs.djangoproject.com/en/4.0/ref/settings/
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from pathlib import Path
|
|
||||||
import os
|
import os
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
# Build paths inside the project like this: BASE_DIR / 'subdir'.
|
# Build paths inside the project like this: BASE_DIR / 'subdir'.
|
||||||
BASE_DIR = Path(__file__).resolve().parent.parent
|
BASE_DIR = Path(__file__).resolve().parent.parent
|
||||||
STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')
|
|
||||||
|
|
||||||
# Quick-start development settings - unsuitable for production
|
# Quick-start development settings - unsuitable for production
|
||||||
# See https://docs.djangoproject.com/en/4.0/howto/deployment/checklist/
|
# See https://docs.djangoproject.com/en/4.0/howto/deployment/checklist/
|
||||||
@ -26,7 +25,7 @@ SECRET_KEY = 'django-insecure-t52#vo-k9ty*$@u9bf75hrkd#^o_)gadrz9$7w%xnkb-0#y!bi
|
|||||||
# SECURITY WARNING: don't run with debug turned on in production!
|
# SECURITY WARNING: don't run with debug turned on in production!
|
||||||
DEBUG = True
|
DEBUG = True
|
||||||
|
|
||||||
ALLOWED_HOSTS = ["localhost", "127.0.0.1"]
|
ALLOWED_HOSTS = []
|
||||||
|
|
||||||
|
|
||||||
# Application definition
|
# Application definition
|
||||||
@ -38,7 +37,6 @@ INSTALLED_APPS = [
|
|||||||
'django.contrib.sessions',
|
'django.contrib.sessions',
|
||||||
'django.contrib.messages',
|
'django.contrib.messages',
|
||||||
'django.contrib.staticfiles',
|
'django.contrib.staticfiles',
|
||||||
'OpenRefineAuth.apps.OpenrefineauthConfig'
|
|
||||||
]
|
]
|
||||||
|
|
||||||
MIDDLEWARE = [
|
MIDDLEWARE = [
|
||||||
@ -118,15 +116,17 @@ USE_TZ = True
|
|||||||
# Static files (CSS, JavaScript, Images)
|
# Static files (CSS, JavaScript, Images)
|
||||||
# https://docs.djangoproject.com/en/4.0/howto/static-files/
|
# https://docs.djangoproject.com/en/4.0/howto/static-files/
|
||||||
|
|
||||||
STATIC_URL = '/static/'
|
STATIC_URL = 'static/'
|
||||||
STATICFILES_DIRS = (
|
STATICFILES_DIRS = (
|
||||||
os.path.join(BASE_DIR, "static"),
|
os.path.join(BASE_DIR, 'static'),
|
||||||
)
|
)
|
||||||
|
STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')
|
||||||
|
|
||||||
|
|
||||||
|
LOGIN_REDIRECT_URL = 'home'
|
||||||
|
LOGOUT_REDIRECT_URL = 'home'
|
||||||
|
|
||||||
# Default primary key field type
|
# Default primary key field type
|
||||||
# https://docs.djangoproject.com/en/4.0/ref/settings/#default-auto-field
|
# https://docs.djangoproject.com/en/4.0/ref/settings/#default-auto-field
|
||||||
|
|
||||||
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
|
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
|
||||||
|
|
||||||
LOGIN_REDIRECT_URL = '/'
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -14,14 +14,16 @@ Including another URLconf
|
|||||||
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
|
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
|
||||||
"""
|
"""
|
||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
|
from django.contrib.staticfiles.storage import staticfiles_storage
|
||||||
from django.urls import path, include
|
from django.urls import path, include
|
||||||
from OpenRefineAuth import views
|
from django.views.generic import TemplateView, RedirectView
|
||||||
from django.views.generic.base import TemplateView
|
|
||||||
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
|
from .views import SignUpView
|
||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
path('admin/', admin.site.urls),
|
path('admin/', admin.site.urls),
|
||||||
path('accounts/', include('django.contrib.auth.urls')),
|
path('', include('django.contrib.auth.urls')),
|
||||||
|
path('signup/', SignUpView.as_view(), name='signup'),
|
||||||
path('', TemplateView.as_view(template_name='home.html'), name='home'),
|
path('', TemplateView.as_view(template_name='home.html'), name='home'),
|
||||||
|
path('favicon.ico', RedirectView.as_view(url=staticfiles_storage.url('images/favicon.ico'))),
|
||||||
]
|
]
|
||||||
urlpatterns += staticfiles_urlpatterns()
|
|
||||||
|
16
Serwer_django/Serwer_django/views.py
Normal file
16
Serwer_django/Serwer_django/views.py
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
from django.contrib.auth.forms import UserCreationForm
|
||||||
|
from django.contrib.auth.models import User
|
||||||
|
from django.urls import reverse_lazy
|
||||||
|
from django.views import generic
|
||||||
|
|
||||||
|
|
||||||
|
class SignUpForm(UserCreationForm):
|
||||||
|
class Meta:
|
||||||
|
model = User
|
||||||
|
fields = ('username', 'email',)
|
||||||
|
|
||||||
|
|
||||||
|
class SignUpView(generic.CreateView):
|
||||||
|
form_class = SignUpForm
|
||||||
|
success_url = reverse_lazy('login')
|
||||||
|
template_name = 'registration/signup.html'
|
Binary file not shown.
3
Serwer_django/static/base.css
Normal file
3
Serwer_django/static/base.css
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
body {
|
||||||
|
background-color: #818fb7;
|
||||||
|
}
|
BIN
Serwer_django/static/images/favicon.ico
Normal file
BIN
Serwer_django/static/images/favicon.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.4 KiB |
@ -2,13 +2,17 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
{% load static %}
|
||||||
<title>{% block title %}Django baseic login{% endblock %}</title>
|
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
|
||||||
|
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap-theme.min.css">
|
||||||
|
<link rel="stylesheet" href="{% static 'base.css'%}">
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title>{% block title %}Auth{% endblock %}</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<main>
|
<main>
|
||||||
{% block content %}
|
{% block content %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
</main>
|
</main>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
@ -1,13 +1,15 @@
|
|||||||
<!-- templates/home.html -->
|
<!-- templates/home.html-->
|
||||||
{% extends 'base.html' %}
|
{% extends 'base.html' %}
|
||||||
|
|
||||||
{% block title %}Home{% endblock %}
|
{% block title %}Home{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
{% if user.is_authenticated %}
|
{% if user.is_authenticated %}
|
||||||
Hi {{ user.username }}!
|
Hi {{ user.username }}!
|
||||||
|
<p><a href="{% url 'logout' %}">Log Out</a></p>
|
||||||
{% else %}
|
{% else %}
|
||||||
<p>You are not logged in</p>
|
<p>You are not logged in</p>
|
||||||
<a href="{% url 'login' %}">Log In</a>
|
<p><a href="{% url 'login' %}">Log In</a></p>
|
||||||
|
<p><a href="{% url 'signup' %}">Sign Up</a></p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endblock %}
|
{% endblock %}
|
@ -4,12 +4,10 @@
|
|||||||
{% block title %}Login{% endblock %}
|
{% block title %}Login{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<h2>Log In</h2>
|
<h2>Log In</h2>
|
||||||
{% load static %}
|
<form method="post">
|
||||||
<img width="20%" height="20%" src="{% static "images/logo.jpg" %}" alt="logo"/>
|
{% csrf_token %}
|
||||||
|
{{ form.as_p }}
|
||||||
{% csrf_token %}
|
<button type="submit">Log In</button>
|
||||||
{{ form.as_p }}
|
</form>
|
||||||
<button type="submit">Log In</button>
|
|
||||||
</form>
|
|
||||||
{% endblock %}
|
{% endblock %}
|
13
Serwer_django/templates/registration/signup.html
Normal file
13
Serwer_django/templates/registration/signup.html
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
<!-- templates/registration/signup.html -->
|
||||||
|
{% extends 'base.html' %}
|
||||||
|
|
||||||
|
{% block title %}Sign Up{% endblock %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<h2>Sign Up</h2>
|
||||||
|
<form method="post">
|
||||||
|
{% csrf_token %}
|
||||||
|
{{ form.as_p }}
|
||||||
|
<button type="submit">Sign Up</button>
|
||||||
|
</form>
|
||||||
|
{% endblock %}
|
Loading…
Reference in New Issue
Block a user