<commit_before>from .models import Player
from .util import getPlayerForUser
from django.contrib.auth.decorators import login_required
from django.core.urlresolvers import reverse
from django.http import HttpResponseRedirect, HttpResponse
from django.shortcuts import render

def index(request):
  return render(request, 'server/index.html', {'currentPage': 'index'})

@login_required
def profile(request):
  player = getPlayerForUser(request)

  if (player is None):
    return HttpResponseRedirect(reverse('logout'))

  if ('phonenumber' in request.POST):
    player.phone = request.POST['phonenumber'];
    if (not player.phone.startswith("+")):
      if (player.phone.startswith("1")):
        player.phone = "+" + player.phone
      else:
        player.phone = "+1" + player.phone

    player.save()

  return render(request, 'server/profile.html', {'currentPage': 'profile', 'player': player})

@login_required<commit_msg>Fix crash<commit_after>from .models import Player, Game
from .util import getPlayerForUser
from django.contrib.auth.decorators import login_required
from django.core.urlresolvers import reverse
from django.http import HttpResponseRedirect, HttpResponse
from django.shortcuts import render

def index(request):
  return render(request, 'server/index.html', {'currentPage': 'index'})

@login_required
def profile(request):
  player = getPlayerForUser(request)

  if (player is None):
    return HttpResponseRedirect(reverse('logout'))

  if ('phonenumber' in request.POST):
    player.phone = request.POST['phonenumber'];
    if (not player.phone.startswith("+")):
      if (player.phone.startswith("1")):
        player.phone = "+" + player.phone
      else:
        player.phone = "+1" + player.phone

    player.save()

  return render(request, 'server/profile.html', {'currentPage': 'profile', 'player': player})

@login_required
{'fraction_non_alphanumeric': 0.12741935483870967, 'fraction_numerical': 0.002150537634408602, 'mean_word_length': 4.726153846153847, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1949008', 'n_tokens_mistral': 544, 'n_tokens_neox': 533, 'n_words': 139}