def associate_success(request, openid_response, redirect_to): openids = request.session.get('openids', []) openid = from_openid_response(openid_response) openids.append(openid) request.session['openids'] = openids uassoc = UserAssociation(openid_url=str(openid), user_id=request.user.id) uassoc.save(send_email=False) messages.info(request, _('Openid идентификатор успешно добавлен')) return HttpResponseRedirect(urlquote(redirect_to))
def default_on_success(request, openid_response, message): """Дефолтный вид лля удачных запросов""" request.session['openid'] = from_openid_response(openid_response) return render_to_response('authopenid/success.html', { 'message': message, }, request )
def on_success(request, identity_url, openid_response): if 'openids' not in request.session.keys(): request.session['openids'] = [] # Eliminate any duplicates request.session['openids'] = [ o for o in request.session['openids'] if o.openid != identity_url ] request.session['openids'].append(from_openid_response(openid_response)) # Set up request.openids and request.openid, reusing middleware logic OpenIdMiddleware().process_request(request) return HttpResponseRedirect(reverse("openid_done"))
def login_success(request, openid_response, redirect_to): """ Обработка успешного ответа для логина по openid """ request.session['openid'] = from_openid_response(openid_response) user = cauth.authenticate(openid_url=openid_response.identity_url) if user: cauth.login(request, user) logger.debug(u'Авторизирован как %s', user) return HttpResponseRedirect(redirect_to) else: logger.debug(u"Незарегистрирован %s" % request.session.get('openid')) return HttpResponseRedirect(u"%s?%s" % (reverse('oid_registration'), \ urllib.urlencode({REDIRECT_FIELD_NAME: urlquote(redirect_to)})))
def default_on_success(request, identity_url, openid_response): if "openids" not in request.session.keys(): request.session["open_ids"] = [] # Eliminate any duplicates request.session["open_ids"] = [o for o in request.session["open_ids"] if o.openid != identity_url] request.session["open_ids"].append(from_openid_response(openid_response)) # Set up request.openids and request.openid, reusing middleware logic OpenIDMiddleware().process_request(request) next = request.GET.get("next", "").strip() if not next or not is_valid_next_url(next): next = getattr(settings, "OPENID_REDIRECT_NEXT", "/") return HttpResponseRedirect(next)