kopia lustrzana https://github.com/OpenDroneMap/WebODM
Removed superuser creation on boot, added welcome view
rodzic
cf7f385938
commit
316dad4d43
|
@ -50,11 +50,6 @@ def boot():
|
|||
# Add permission to view processing nodes
|
||||
default_group.permissions.add(Permission.objects.get(codename="view_processingnode"))
|
||||
|
||||
# Check super user
|
||||
if User.objects.filter(is_superuser=True).count() == 0:
|
||||
User.objects.create_superuser('admin', 'admin@example.com', 'admin')
|
||||
logger.info("Created superuser")
|
||||
|
||||
# Unlock any Task that might have been locked
|
||||
Task.objects.filter(processing_lock=True).update(processing_lock=False)
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@ from webodm import settings
|
|||
|
||||
urlpatterns = [
|
||||
url(r'^$', views.index, name='index'),
|
||||
url(r'^welcome/$', views.welcome, name='welcome'),
|
||||
url(r'^dashboard/$', views.dashboard, name='dashboard'),
|
||||
url(r'^map/project/(?P<project_pk>[^/.]+)/task/(?P<task_pk>[^/.]+)/$', views.map, name='map'),
|
||||
url(r'^map/project/(?P<project_pk>[^/.]+)/$', views.map, name='map'),
|
||||
|
|
23
app/views.py
23
app/views.py
|
@ -1,6 +1,8 @@
|
|||
import json
|
||||
|
||||
from django.contrib.auth.models import User
|
||||
from django.http import Http404
|
||||
from django.http import HttpResponseForbidden
|
||||
from django.shortcuts import render, redirect, get_object_or_404
|
||||
from django.http import HttpResponse
|
||||
from guardian.shortcuts import get_objects_for_user
|
||||
|
@ -12,7 +14,12 @@ from django.contrib.auth.decorators import login_required
|
|||
from django.utils.translation import ugettext as _
|
||||
|
||||
def index(request):
|
||||
return redirect('dashboard' if request.user.is_authenticated()
|
||||
# Check first access where the user is expected to
|
||||
# create an admin account
|
||||
if User.objects.filter(is_superuser=True).count() == 0:
|
||||
return redirect('welcome')
|
||||
|
||||
return redirect('dashboard' if request.user.is_authenticated()
|
||||
else 'login')
|
||||
|
||||
@login_required
|
||||
|
@ -100,6 +107,20 @@ def processing_node(request, processing_node_id):
|
|||
**get_view_params(request),
|
||||
})
|
||||
|
||||
def welcome(request):
|
||||
if User.objects.filter(is_superuser=True).count() > 0:
|
||||
return redirect('index')
|
||||
|
||||
if request.method == 'GET':
|
||||
return render(request, 'app/registration/registration_base.html',
|
||||
{
|
||||
'title': 'Welcome'
|
||||
})
|
||||
elif request.method == 'POST':
|
||||
pass
|
||||
else:
|
||||
raise Http404()
|
||||
|
||||
|
||||
def get_view_params(request):
|
||||
"""
|
||||
|
|
Ładowanie…
Reference in New Issue