34c9393d21713b0b0445286ad085a46ec5bb249a,polyaxon/users/views.py,LoginView,dispatch,#LoginView#Any#,76

Before Change


    @method_decorator(never_cache)
    def dispatch(self, request, *args, **kwargs):
        response = super(LoginView, self).dispatch(request, *args, **kwargs)
        if request.user.is_authenticated:
            token, _ = Token.objects.get_or_create(user=request.user)
            response.set_cookie("token", value=token)
            response.set_cookie("user", value=request.user.username)
        return response


class LogoutView(AuthLogoutView):

After Change


    @method_decorator(never_cache)
    def dispatch(self, request, *args, **kwargs):
        if not request.user.is_anonymous:
            return HttpResponseRedirect("/")
        response = super(LoginView, self).dispatch(request, *args, **kwargs)
        login_user(request=request, response=response, user=request.user, login=False)
        return response
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 9

Instances


Project Name: polyaxon/polyaxon
Commit Name: 34c9393d21713b0b0445286ad085a46ec5bb249a
Time: 2018-05-19
Author: mouradmourafiq@gmail.com
File Name: polyaxon/users/views.py
Class Name: LoginView
Method Name: dispatch


Project Name: polyaxon/polyaxon
Commit Name: 2a822c1ea9bfcd972574e639114a03ea940c7b49
Time: 2018-06-13
Author: mouradmourafiq@gmail.com
File Name: polyaxon/libs/repos/utils.py
Class Name:
Method Name: get_latest_code_reference


Project Name: polyaxon/polyaxon
Commit Name: 8a09e29f99149f5c097aa7866e4e4fce469aaeeb
Time: 2019-02-16
Author: mouradmourafiq@gmail.com
File Name: polyaxon/libs/repos/utils.py
Class Name:
Method Name: get_code_reference