b18662872a2575996418c7e0b8bb744017a2c54d,apps/api/views.py,,login,#,23

Before Change


            errors = form.errors
        if form.is_valid():
            login_user(request, form.get_user())
            logging.user(request, "~FG~BB~SKAPI Login~FW: %s" % request.environ.get("HTTP_USER_AGENT", ""))
            code = 1
    else:
        errors = dict(method="Invalid method. Use POST. You used %s" % request.method)

After Change


def login(request):
    code = -1
    errors = None
    user_agent = request.environ.get("HTTP_USER_AGENT", "")

    if not user_agent:
        errors = dict(user_agent="You must set a user agent to login.")
        logging.user(request, "~FG~BB~SK~FRBlocked ~FGAPI Login~SN~FW: %s" % user_agent)
    elif request.method == "POST":
        form = LoginForm(data=request.POST)
        if form.errors:
            errors = form.errors
        if form.is_valid():
            login_user(request, form.get_user())
            logging.user(request, "~FG~BB~SKAPI Login~SN~FW: %s" % user_agent)
            code = 1
    else:
        errors = dict(method="Invalid method. Use POST. You used %s" % request.method)
        
    return dict(code=code, errors=errors)
    
@json.json_view
def signup(request):
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 4

Non-data size: 5

Instances


Project Name: samuelclay/NewsBlur
Commit Name: b18662872a2575996418c7e0b8bb744017a2c54d
Time: 2013-06-15
Author: samuel@ofbrooklyn.com
File Name: apps/api/views.py
Class Name:
Method Name: login


Project Name: tyarkoni/pliers
Commit Name: 30bb1928d465ae04b4389d5bb8bf5394bc161e24
Time: 2018-09-17
Author: delavega@utexas.edu
File Name: pliers/stimuli/audio.py
Class Name: AudioStim
Method Name: get_sampling_rate


Project Name: jazzband/django-debug-toolbar
Commit Name: 508d83c4111c5884ca7a520b1ccfe7b6c68f2aaf
Time: 2010-02-26
Author: jannis@leidel.info
File Name: debug_toolbar/middleware.py
Class Name: DebugToolbarMiddleware
Method Name: _show_toolbar


Project Name: numerai/submission-criteria
Commit Name: e6708dd96f352f3f7adaa03756e7cd3242ad1e74
Time: 2017-11-10
Author: xander@numer.ai
File Name: common.py
Class Name:
Method Name: connect_to_postgres