diff --git a/front-end/assets/css/global.css b/front-end/assets/css/global.css index 1f5c1d3..f682477 100644 --- a/front-end/assets/css/global.css +++ b/front-end/assets/css/global.css @@ -340,4 +340,8 @@ a { .button:hover { background-color: var(--dark-color); +} + +.login-info { + padding: 10px; } \ No newline at end of file diff --git a/mwmbl/settings_common.py b/mwmbl/settings_common.py index 99201f3..38a890e 100644 --- a/mwmbl/settings_common.py +++ b/mwmbl/settings_common.py @@ -131,3 +131,5 @@ ACCOUNT_EMAIL_REQUIRED = True ACCOUNT_EMAIL_VERIFICATION = "mandatory" DEFAULT_FROM_EMAIL = "admin@mwmbl.org" + +LOGIN_REDIRECT_URL = "/" diff --git a/mwmbl/templates/index.html b/mwmbl/templates/index.html index 3b7c073..c7b35e8 100644 --- a/mwmbl/templates/index.html +++ b/mwmbl/templates/index.html @@ -75,8 +75,13 @@ >
- Login - Sign up + {% if user.is_authenticated %} +

Logged in as {{ user.username }}

+ Log out + {% else %} + Login + Sign up + {% endif %}
diff --git a/mwmbl/templates/profile.html b/mwmbl/templates/profile.html deleted file mode 100644 index 2923d40..0000000 --- a/mwmbl/templates/profile.html +++ /dev/null @@ -1,8 +0,0 @@ -{% extends "base.html" %} -{% block title %}Profile Page{% endblock title %} -{% block content %} -
-

This is the profile page for {{user.username}}

-
- -{% endblock content %} diff --git a/mwmbl/urls.py b/mwmbl/urls.py index a18b679..2d3de15 100644 --- a/mwmbl/urls.py +++ b/mwmbl/urls.py @@ -17,17 +17,15 @@ Including another URLconf from django.contrib import admin from django.urls import path, include -from mwmbl.api import api_original as api, api_v1 -from mwmbl.views import profile, search_results, fetch_url, home +from mwmbl.api import api_v1 +from mwmbl.views import search_results, fetch_url, home urlpatterns = [ path('admin/', admin.site.urls), - # path('', api.urls), path('api/v1/', api_v1.urls), path('accounts/', include('allauth.urls')), path('', home, name="home"), - path('accounts/profile/', profile, name="profile"), path('app/search/', search_results, name="search_results"), path('app/fetch/', fetch_url, name="fetch_url") ] diff --git a/mwmbl/views.py b/mwmbl/views.py index 04cb2b8..97ff64a 100644 --- a/mwmbl/views.py +++ b/mwmbl/views.py @@ -41,15 +41,14 @@ def justext_with_dom(html_text, stoplist, length_low=LENGTH_LOW_DEFAULT, return paragraphs, title -@login_required -def profile(request): - return render(request, 'profile.html') - - def home(request): query = request.GET.get("q") results = ranker.search(query) if query else None - return render(request, "index.html", {"results": results, "query": query}) + return render(request, "index.html", { + "results": results, + "query": query, + "user": request.user, + }) def search_results(request):