* dev: magic link login and email password disable * dev: user account deactivation * dev: change nginx conf routes * feat: changemod space * fix: space app dir fixes * dev: invalidate cache for instances when creating workspace * dev: update email templates for test email * dev: fix build errors * fix: auth fixes and improvement (#4452) * chore: change password api updated and missing password error code added * chore: auth helper updated * chore: disable send code input suggestion * chore: change password function updated * fix: application error on sign in page * chore: change password validation added and enhancement * dev: space base path in web * dev: admin user deactivated * dev: user and instance admin session endpoint * fix: last_workspace_id endpoint updated * fix: magic sign in and email password check added --------- Co-authored-by: pablohashescobar <nikhilschacko@gmail.com> Co-authored-by: sriram veeraghanta <veeraghanta.sriram@gmail.com> Co-authored-by: guru_sainath <gurusainath007@gmail.com>
29 lines
882 B
Python
29 lines
882 B
Python
# Django imports
|
|
from django.views import View
|
|
from django.contrib.auth import logout
|
|
from django.http import HttpResponseRedirect
|
|
from django.utils import timezone
|
|
|
|
# Module imports
|
|
from plane.authentication.utils.host import base_host, user_ip
|
|
from plane.db.models import User
|
|
|
|
|
|
class SignOutAuthSpaceEndpoint(View):
|
|
|
|
def post(self, request):
|
|
# Get user
|
|
try:
|
|
user = User.objects.get(pk=request.user.id)
|
|
user.last_logout_ip = user_ip(request=request)
|
|
user.last_logout_time = timezone.now()
|
|
user.save()
|
|
# Log the user out
|
|
logout(request)
|
|
return HttpResponseRedirect(
|
|
base_host(request=request, is_space=True)
|
|
)
|
|
except Exception:
|
|
return HttpResponseRedirect(
|
|
base_host(request=request, is_space=True)
|
|
)
|