def associate_steam(request): """Associate a Steam account with a Lutris account""" LOGGER.info("Associating Steam user with Lutris account") if not request.user.is_authenticated: LOGGER.info("User is authenticated, completing login") return login_complete(request) else: openid_response = parse_openid_response(request) account_url = reverse('user_account', args=(request.user.username, )) if openid_response.status == 'failure': messages.warning(request, "Failed to associate Steam account") REQUEST_LOGGER.error("Failed to associate Steam account for %s", request.user.username, extra={ 'status_code': 400, 'request': request }) return redirect(account_url) openid_backend = OpenIDBackend() try: openid_backend.associate_openid(request.user, openid_response) except IdentityAlreadyClaimed: messages.warning( request, "This Steam account is already claimed by another Lutris " "account.\nPlease contact an administrator if you want " "to reattribute your Steam account to this current account.") return redirect(account_url) request.user.set_steamid() request.user.save() return redirect(reverse("library_steam_sync"))
def associate_steam(request): """Associate a Steam account with a Lutris account""" LOGGER.info("Associating Steam user with Lutris account") if not request.user.is_authenticated: return login_complete(request) account_url = reverse('user_account', args=(request.user.username, )) try: openid_response = parse_openid_response(request) except HTTPFetchingError: messages.warning( request, "Steam server is unreachable, please try again in a few moments") return redirect(account_url) if openid_response.status == 'failure': messages.warning(request, "Failed to associate Steam account") LOGGER.warning("Failed to associate Steam account for %s", request.user.username) return redirect(account_url) openid_backend = OpenIDBackend() try: openid_backend.associate_openid(request.user, openid_response) except IdentityAlreadyClaimed: messages.warning( request, "This Steam account is already claimed by another Lutris " "account.\nPlease contact an administrator if you want " "to reattribute your Steam account to this current account.") return redirect(account_url) request.user.set_steamid() request.user.save() return redirect(reverse("library_steam_sync"))
def associate_steam(request): if not request.user.is_authenticated(): return login_complete(request) else: openid_response = parse_openid_response(request) account_url = reverse('user_account', args=(request.user.username, )) if openid_response.status == 'failure': messages.warning(request, "Failed to associate Steam account") return redirect(account_url) openid_backend = OpenIDBackend() try: openid_backend.associate_openid(request.user, openid_response) except IdentityAlreadyClaimed: messages.warning( request, "This Steam account is already claimed by another Lutris " "account.\nPlease contact an administrator if you want " "to reattribute your Steam account to this current account.") return redirect(account_url) request.user.set_steamid() request.user.save() return redirect(reverse("library_steam_sync"))
def __init__(self): self.openid_backend = OpenIDBackend()
def setUp(self): super(OpenIDBackendTests, self).setUp() self.backend = OpenIDBackend()
def setUp(self): super(OpenIDBackendTests, self).setUp() self.backend = OpenIDBackend() self.message = TestMessage()
def setUp(self): super(OpenIDBackendTests, self).setUp() self.backend = OpenIDBackend() self.old_openid_use_email_for_username = getattr( settings, 'OPENID_USE_EMAIL_FOR_USERNAME', False)