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](logo.svg)
|
||||
|
||||
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
|
||||
https://docs.djangoproject.com/en/4.0/ref/settings/
|
||||
"""
|
||||
|
||||
from pathlib import Path
|
||||
import os
|
||||
from pathlib import Path
|
||||
|
||||
# Build paths inside the project like this: BASE_DIR / 'subdir'.
|
||||
BASE_DIR = Path(__file__).resolve().parent.parent
|
||||
STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')
|
||||
|
||||
|
||||
# Quick-start development settings - unsuitable for production
|
||||
# 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!
|
||||
DEBUG = True
|
||||
|
||||
ALLOWED_HOSTS = ["localhost", "127.0.0.1"]
|
||||
ALLOWED_HOSTS = []
|
||||
|
||||
|
||||
# Application definition
|
||||
@ -38,7 +37,6 @@ INSTALLED_APPS = [
|
||||
'django.contrib.sessions',
|
||||
'django.contrib.messages',
|
||||
'django.contrib.staticfiles',
|
||||
'OpenRefineAuth.apps.OpenrefineauthConfig'
|
||||
]
|
||||
|
||||
MIDDLEWARE = [
|
||||
@ -118,15 +116,17 @@ USE_TZ = True
|
||||
# Static files (CSS, JavaScript, Images)
|
||||
# https://docs.djangoproject.com/en/4.0/howto/static-files/
|
||||
|
||||
STATIC_URL = '/static/'
|
||||
STATIC_URL = 'static/'
|
||||
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
|
||||
# https://docs.djangoproject.com/en/4.0/ref/settings/#default-auto-field
|
||||
|
||||
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'))
|
||||
"""
|
||||
from django.contrib import admin
|
||||
from django.contrib.staticfiles.storage import staticfiles_storage
|
||||
from django.urls import path, include
|
||||
from OpenRefineAuth import views
|
||||
from django.views.generic.base import TemplateView
|
||||
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
|
||||
from django.views.generic import TemplateView, RedirectView
|
||||
|
||||
from .views import SignUpView
|
||||
|
||||
urlpatterns = [
|
||||
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('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>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>{% block title %}Django baseic login{% endblock %}</title>
|
||||
{% load static %}
|
||||
<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>
|
||||
<body>
|
||||
<main>
|
||||
<main>
|
||||
{% block content %}
|
||||
{% endblock %}
|
||||
</main>
|
||||
</main>
|
||||
</body>
|
||||
</html>
|
@ -1,13 +1,15 @@
|
||||
<!-- templates/home.html -->
|
||||
<!-- templates/home.html-->
|
||||
{% extends 'base.html' %}
|
||||
|
||||
{% block title %}Home{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
{% if user.is_authenticated %}
|
||||
Hi {{ user.username }}!
|
||||
Hi {{ user.username }}!
|
||||
<p><a href="{% url 'logout' %}">Log Out</a></p>
|
||||
{% else %}
|
||||
<p>You are not logged in</p>
|
||||
<a href="{% url 'login' %}">Log In</a>
|
||||
<p>You are not logged in</p>
|
||||
<p><a href="{% url 'login' %}">Log In</a></p>
|
||||
<p><a href="{% url 'signup' %}">Sign Up</a></p>
|
||||
{% endif %}
|
||||
{% endblock %}
|
@ -4,12 +4,10 @@
|
||||
{% block title %}Login{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<h2>Log In</h2>
|
||||
{% load static %}
|
||||
<img width="20%" height="20%" src="{% static "images/logo.jpg" %}" alt="logo"/>
|
||||
|
||||
{% csrf_token %}
|
||||
{{ form.as_p }}
|
||||
<button type="submit">Log In</button>
|
||||
</form>
|
||||
<h2>Log In</h2>
|
||||
<form method="post">
|
||||
{% csrf_token %}
|
||||
{{ form.as_p }}
|
||||
<button type="submit">Log In</button>
|
||||
</form>
|
||||
{% 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