Skip to content

Commit

Permalink
feat: debug login with given name (#900)
Browse files Browse the repository at this point in the history
* cleanup: remove "pain" post type (#742)

* Убран тип поста Боль

* Фикс миграции

Co-authored-by: Mikhail Polykovskij <mikhail.polykovskiy@x5.ru>

* Increase "ban_reason" length

* Disable comments auto-subscription

* feat: Badges (#704)

* Badges draft

* Badges CSS for comments, posts, profiles

* Almost done, needs data and icons

* CSS fixes + frontend bugs

* More logical fixes

* Fixing bugs, rename things

* Add icons and initial data

* fix: badge notifications + typos

* feat: show subscription duration in profile  (#733)

* Add friends page #723

* Adds subscription status to profile

* send 403 if user tries to look someones friends #723

* bring back old name for add to friends button #723

* Fixes typo, covers PR suggestions

* Visual improvements

Co-authored-by: ollkostin <ollkostin@gmail.com>
Co-authored-by: kedMertens <kedmail@pm.me>
Co-authored-by: vas3k <me@vas3k.ru>

* feat: Remove sending limits for friend's comments

* Threads now public

* Fix #753. Add badges to /stats/ page

* fix: Increase latest_badges on stats to 20

* Add "align-items: center;" to stats/badges

* feat: exclude replies from friends notifications

* fix: bad gradient of badges block (#760)

Signed-off-by: Vitalii Dmitriev <dmitvitalii@gmail.com>

* Add highlight to badged comments, improve CSS

* Cooking achievements (#755)

* Draft for cooking achievements

* Fixing bg color and using proper URLs

* Fixing pictures order

* Fixing pastry_cook_2

* feat: add socialism and anarchism to list of tags (#637)

А то сейчас доступны три правые системы взглядов и ни одной левой 🤔

* feat: remove "libertarianism" and "anarchism" tags

* fix: mobile CSS bugs

* feat: remove expertise from profile, move achievements

* fix #764: "show all posts" link in profile is wrong

* feat: remove NLTK dependency + add test docker build step

* fix #714: add login button to public pages (#763)

* add login button

* fix css

* fix url

* fix css justify

* Refactor daily and weekly digest renderers

* Remove old supervisor config

* fix: use sum of prices for top badges page

* Add data archives cleanup to crontab

* fix #765: css padding for upvote button

* Upstream

* Логин под именем указанного пользователя

Co-authored-by: Mikhail Polykovskij <mikhail.polykovskiy@x5.ru>
Co-authored-by: vas3k <me@vas3k.ru>
Co-authored-by: kedMertens <39831696+kedMertens@users.noreply.github.com>
Co-authored-by: ollkostin <ollkostin@gmail.com>
Co-authored-by: kedMertens <kedmail@pm.me>
Co-authored-by: Vitalii Dmitriev <dmitvitalii@gmail.com>
Co-authored-by: Dmitry Kochkin <cooch@mail.ru>
Co-authored-by: Ivan Mir <ivmirx@users.noreply.github.com>
Co-authored-by: Kamil <babaevkamil@gmail.com>
  • Loading branch information
10 people committed Feb 11, 2022
1 parent 7c1264c commit 60005ea
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
12 changes: 11 additions & 1 deletion auth/views/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from django.conf import settings
from django.core.cache import cache
from django.http import HttpResponseNotAllowed
from django.shortcuts import redirect, render
from django.shortcuts import redirect, render, get_object_or_404

from auth.helpers import auth_required, set_session_cookie
from auth.models import Session
Expand Down Expand Up @@ -103,3 +103,13 @@ def debug_random_login(request):
session = Session.create_for_user(user)

return set_session_cookie(redirect("profile", user.slug), user, session)


def debug_login(request, user_slug):
if not (settings.DEBUG or settings.TESTS_RUN):
raise AccessDenied(title="Эта фича доступна только при DEBUG=true")

user = get_object_or_404(User, slug=user_slug)
session = Session.create_for_user(user)

return set_session_cookie(redirect("profile", user.slug), user, session)
3 changes: 2 additions & 1 deletion club/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from django.views.generic import RedirectView

from auth.helpers import auth_switch
from auth.views.auth import login, logout, debug_dev_login, debug_random_login, join
from auth.views.auth import login, logout, debug_dev_login, debug_random_login, debug_login, join
from auth.views.email import email_login, email_login_code
from auth.views.external import external_login
from auth.views.patreon import patreon_login, patreon_oauth_callback
Expand Down Expand Up @@ -163,6 +163,7 @@
path("godmode/digest/", godmode_digest_settings, name="godmode_digest_settings"),
path("godmode/dev_login/", debug_dev_login, name="debug_dev_login"),
path("godmode/random_login/", debug_random_login, name="debug_random_login"),
path("godmode/login/<str:user_slug>/", debug_login, name="debug_login"),

# misc
path("misc/calendar/ical", generate_ical_invite, name="generate_ical_invite"),
Expand Down

0 comments on commit 60005ea

Please sign in to comment.