old_contents: # -*- coding: utf-8 -*-
  
  #...............................licence...........................................
  #
  #     (C) Copyright 2008 Telefonica Investigacion y Desarrollo
  #     S.A.Unipersonal (Telefonica I+D)
  #
  #     This file is part of Morfeo EzWeb Platform.
  #
  #     Morfeo EzWeb Platform is free software: you can redistribute it and/or modify
  #     it under the terms of the GNU Affero General Public License as published by
  #     the Free Software Foundation, either version 3 of the License, or
  #     (at your option) any later version.
  #
  #     Morfeo EzWeb Platform is distributed in the hope that it will be useful,
  #     but WITHOUT ANY WARRANTY; without even the implied warranty of
  #     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  #     GNU Affero General Public License for more details.
  #
  #     You should have received a copy of the GNU Affero General Public License
  #     along with Morfeo EzWeb Platform.  If not, see <http://www.gnu.org/licenses/>.
  #
  #     Info about members and contributors of the MORFEO project
  #     is available at
  #
  #     http://morfeo-project.org
  #
  #...............................licence...........................................#
  
  
  #
  
  
  from django.contrib.auth import authenticate, login, logout
  from django.http import HttpResponseRedirect
  from django.utils.translation import ugettext as _
  
  
  class Http403(Exception):
      pass
  
  
  def user_authentication(request, user_name):
      user = request.user
      if not user.is_authenticated():
          raise Http403(_("You must be logged"))
  
      if user_name and user.username != user_name:
          raise Http403(_("You do not have permission"))
  
      return user
  
  
  def get_user_authentication(request):
      user = request.user
      if not user.is_authenticated():
          raise Http403(_("You must be logged"))
  
      return user
  
  
  def login_with_third_party_cookie(request):
      if 'username' not in request.REQUEST:
          return (HttpResponseRedirect('/accounts/login/'), None)
  
      username = request.REQUEST.get('username')
  
      user = authenticate(username=username, password=None, request=request)
  
      if (not user):
          return (HttpResponseRedirect('/accounts/login/'), None)
  
      login(request, user)
      return (None, user)
new_contents: # -*- coding: utf-8 -*-
  
  #...............................licence...........................................
  #
  #     (C) Copyright 2008 Telefonica Investigacion y Desarrollo
  #     S.A.Unipersonal (Telefonica I+D)
  #
  #     This file is part of Morfeo EzWeb Platform.
  #
  #     Morfeo EzWeb Platform is free software: you can redistribute it and/or modify
  #     it under the terms of the GNU Affero General Public License as published by
  #     the Free Software Foundation, either version 3 of the License, or
  #     (at your option) any later version.
  #
  #     Morfeo EzWeb Platform is distributed in the hope that it will be useful,
  #     but WITHOUT ANY WARRANTY; without even the implied warranty of
  #     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  #     GNU Affero General Public License for more details.
  #
  #     You should have received a copy of the GNU Affero General Public License
  #     along with Morfeo EzWeb Platform.  If not, see <http://www.gnu.org/licenses/>.
  #
  #     Info about members and contributors of the MORFEO project
  #     is available at
  #
  #     http://morfeo-project.org
  #
  #...............................licence...........................................#
  
  
  #
  
  
  from django.utils.translation import ugettext as _
  
  
  class Http403(Exception):
      pass
  
  
  def get_user_authentication(request):
      user = request.user
      if not user.is_authenticated():
          raise Http403(_("You must be logged"))
  
      return user
  
subject: Remove unused code