Fix some spelling and grammar on log messages.

This commit is contained in:
Allie Micka 2016-09-18 11:26:09 +02:00 committed by Valentin Samir
parent 37c975eaf7
commit 816d350548

View File

@ -61,7 +61,7 @@ class LogoutMixin(object):
username = self.request.session.get("username") username = self.request.session.get("username")
if username: if username:
if all_session: if all_session:
logger.info("Logging out user %s from all of they sessions." % username) logger.info("Logging out user %s from all sessions." % username)
else: else:
logger.info("Logging out user %s." % username) logger.info("Logging out user %s." % username)
users = [] users = []
@ -143,7 +143,7 @@ class LogoutView(View, LogoutMixin):
def get(self, request, *args, **kwargs): def get(self, request, *args, **kwargs):
""" """
methode called on GET request on this view method called on GET request on this view
:param django.http.HttpRequest request: The current request object :param django.http.HttpRequest request: The current request object
""" """
@ -184,7 +184,7 @@ class LogoutView(View, LogoutMixin):
logout_msg = _( logout_msg = _(
"<h3>Logout successful</h3>" "<h3>Logout successful</h3>"
"You have successfully logged out from the Central Authentication Service. " "You have successfully logged out from the Central Authentication Service. "
"For security reasons, exit your web browser." "For security reasons, close your web browser."
) )
elif session_nb > 1: elif session_nb > 1:
logout_msg = _( logout_msg = _(
@ -197,7 +197,7 @@ class LogoutView(View, LogoutMixin):
logout_msg = _( logout_msg = _(
"<h3>Logout successful</h3>" "<h3>Logout successful</h3>"
"You were already logged out from the Central Authentication Service. " "You were already logged out from the Central Authentication Service. "
"For security reasons, exit your web browser." "For security reasons, close your web browser."
) )
# depending of settings, redirect to the login page with a logout message or display # depending of settings, redirect to the login page with a logout message or display
@ -261,7 +261,7 @@ class FederateAuth(CsrfExemptView):
""" """
# if settings.CAS_FEDERATE is not True redirect to the login page # if settings.CAS_FEDERATE is not True redirect to the login page
if not settings.CAS_FEDERATE: if not settings.CAS_FEDERATE:
logger.warning("CAS_FEDERATE is False, set it to True to use the federated mode") logger.warning("CAS_FEDERATE is False, set it to True to use federation")
return redirect("cas_server:login") return redirect("cas_server:login")
# POST with a provider suffix, this is probably an SLO request. csrf is disabled for # POST with a provider suffix, this is probably an SLO request. csrf is disabled for
# allowing SLO requests reception # allowing SLO requests reception
@ -305,13 +305,13 @@ class FederateAuth(CsrfExemptView):
""" """
# if settings.CAS_FEDERATE is not True redirect to the login page # if settings.CAS_FEDERATE is not True redirect to the login page
if not settings.CAS_FEDERATE: if not settings.CAS_FEDERATE:
logger.warning("CAS_FEDERATE is False, set it to True to use the federated mode") logger.warning("CAS_FEDERATE is False, set it to True to use federation")
return redirect("cas_server:login") return redirect("cas_server:login")
renew = bool(request.GET.get('renew') and request.GET['renew'] != "False") renew = bool(request.GET.get('renew') and request.GET['renew'] != "False")
# Is the user is already authenticated, no need to request authentication to the user # Is the user is already authenticated, no need to request authentication to the user
# identity provider. # identity provider.
if self.request.session.get("authenticated") and not renew: if self.request.session.get("authenticated") and not renew:
logger.warning("User already authenticated, dropping federate authentication request") logger.warning("User already authenticated, dropping federated authentication request")
return redirect("cas_server:login") return redirect("cas_server:login")
try: try:
# get the identity provider from its suffix # get the identity provider from its suffix
@ -320,7 +320,7 @@ class FederateAuth(CsrfExemptView):
auth = self.get_cas_client(request, provider, renew) auth = self.get_cas_client(request, provider, renew)
# if no ticket submited, redirect to the identity provider CAS login page # if no ticket submited, redirect to the identity provider CAS login page
if 'ticket' not in request.GET: if 'ticket' not in request.GET:
logger.info("Trying to authenticate again %s" % auth.provider.server_url) logger.info("Trying to authenticate %s again" % auth.provider.server_url)
return HttpResponseRedirect(auth.get_login_url()) return HttpResponseRedirect(auth.get_login_url())
else: else:
ticket = request.GET['ticket'] ticket = request.GET['ticket']
@ -360,8 +360,8 @@ class FederateAuth(CsrfExemptView):
else: else:
logger.info( logger.info(
( (
"Got a invalid ticket %s from %s for service %s. " "Got an invalid ticket %s from %s for service %s. "
"Retrying to authenticate" "Retrying authentication"
) % ( ) % (
ticket, ticket,
auth.provider.server_url, auth.provider.server_url,
@ -485,7 +485,7 @@ class LoginView(View, LogoutMixin):
def post(self, request, *args, **kwargs): def post(self, request, *args, **kwargs):
""" """
methode called on POST request on this view method called on POST request on this view
:param django.http.HttpRequest request: The current request object :param django.http.HttpRequest request: The current request object
""" """
@ -497,7 +497,7 @@ class LoginView(View, LogoutMixin):
messages.add_message( messages.add_message(
self.request, self.request,
messages.ERROR, messages.ERROR,
_(u"Invalid login ticket, please retry to login") _(u"Invalid login ticket, please try to log in again")
) )
elif ret == self.USER_LOGIN_OK: elif ret == self.USER_LOGIN_OK:
# On successful login, update the :class:`models.User<cas_server.models.User>` ``date`` # On successful login, update the :class:`models.User<cas_server.models.User>` ``date``
@ -554,7 +554,7 @@ class LoginView(View, LogoutMixin):
""" """
if not self.check_lt(): if not self.check_lt():
self.init_form(self.request.POST) self.init_form(self.request.POST)
logger.warning("Receive an invalid login ticket") logger.warning("Received an invalid login ticket")
return self.INVALID_LOGIN_TICKET return self.INVALID_LOGIN_TICKET
elif not self.request.session.get("authenticated") or self.renew: elif not self.request.session.get("authenticated") or self.renew:
# authentication request receive, initialize the form to use # authentication request receive, initialize the form to use
@ -569,10 +569,10 @@ class LoginView(View, LogoutMixin):
logger.info("User %s successfully authenticated" % self.request.session["username"]) logger.info("User %s successfully authenticated" % self.request.session["username"])
return self.USER_LOGIN_OK return self.USER_LOGIN_OK
else: else:
logger.warning("A logging attemps failed") logger.warning("A login attempt failed")
return self.USER_LOGIN_FAILURE return self.USER_LOGIN_FAILURE
else: else:
logger.warning("Receuve a logging attempt whereas the user is already logged") logger.warning("Received a login attempt for an already-active user")
return self.USER_ALREADY_LOGGED return self.USER_ALREADY_LOGGED
def init_get(self, request): def init_get(self, request):
@ -600,7 +600,7 @@ class LoginView(View, LogoutMixin):
def get(self, request, *args, **kwargs): def get(self, request, *args, **kwargs):
""" """
methode called on GET request on this view method called on GET request on this view
:param django.http.HttpRequest request: The current request object :param django.http.HttpRequest request: The current request object
""" """
@ -667,7 +667,7 @@ class LoginView(View, LogoutMixin):
def service_login(self): def service_login(self):
""" """
Perform login agains a service Perform login against a service
:return: :return:
* The rendering of the ``settings.CAS_WARN_TEMPLATE`` if the user asked to be * The rendering of the ``settings.CAS_WARN_TEMPLATE`` if the user asked to be
@ -949,7 +949,7 @@ class Auth(CsrfExemptView):
@staticmethod @staticmethod
def post(request): def post(request):
""" """
methode called on POST request on this view method called on POST request on this view
:param django.http.HttpRequest request: The current request object :param django.http.HttpRequest request: The current request object
:return: ``HttpResponse(u"yes\\n")`` if the POSTed tuple (username, password, service) :return: ``HttpResponse(u"yes\\n")`` if the POSTed tuple (username, password, service)
@ -1005,7 +1005,7 @@ class Validate(View):
@staticmethod @staticmethod
def get(request): def get(request):
""" """
methode called on GET request on this view method called on GET request on this view
:param django.http.HttpRequest request: The current request object :param django.http.HttpRequest request: The current request object
:return: :return:
@ -1116,7 +1116,7 @@ class ValidateService(View):
def get(self, request): def get(self, request):
""" """
methode called on GET request on this view method called on GET request on this view
:param django.http.HttpRequest request: The current request object: :param django.http.HttpRequest request: The current request object:
:return: The rendering of ``cas_server/serviceValidate.xml`` if no errors is raised, :return: The rendering of ``cas_server/serviceValidate.xml`` if no errors is raised,
@ -1284,7 +1284,7 @@ class Proxy(View):
def get(self, request): def get(self, request):
""" """
methode called on GET request on this view method called on GET request on this view
:param django.http.HttpRequest request: The current request object: :param django.http.HttpRequest request: The current request object:
:return: The returned value of :meth:`process_proxy` if no error is raised, :return: The returned value of :meth:`process_proxy` if no error is raised,
@ -1323,7 +1323,7 @@ class Proxy(View):
if not pattern.proxy: if not pattern.proxy:
raise ValidateError( raise ValidateError(
u'UNAUTHORIZED_SERVICE', u'UNAUTHORIZED_SERVICE',
u'the service %s do not allow proxy ticket' % self.target_service u'the service %s does not allow proxy tickets' % self.target_service
) )
# is the proxy granting ticket valid # is the proxy granting ticket valid
ticket = ProxyGrantingTicket.get(self.pgt) ticket = ProxyGrantingTicket.get(self.pgt)
@ -1387,7 +1387,7 @@ class SamlValidate(CsrfExemptView):
def post(self, request): def post(self, request):
""" """
methode called on POST request on this view method called on POST request on this view
:param django.http.HttpRequest request: The current request object :param django.http.HttpRequest request: The current request object
:return: the rendering of ``cas_server/samlValidate.xml`` if no error is raised, :return: the rendering of ``cas_server/samlValidate.xml`` if no error is raised,
@ -1417,7 +1417,7 @@ class SamlValidate(CsrfExemptView):
) )
) )
logger.debug( logger.debug(
"SamlValidate: User attributs are:\n%s" % pprint.pformat(self.ticket.attributs) "SamlValidate: User attributes are:\n%s" % pprint.pformat(self.ticket.attributs)
) )
return render( return render(
@ -1446,7 +1446,7 @@ class SamlValidate(CsrfExemptView):
if ticket.service != self.target: if ticket.service != self.target:
raise SamlValidateError( raise SamlValidateError(
u'AuthnFailed', u'AuthnFailed',
u'TARGET %s do not match ticket service' % self.target u'TARGET %s does not match ticket service' % self.target
) )
return ticket return ticket
except (IndexError, KeyError): except (IndexError, KeyError):