Ejemplo n.º 1
0
def regenerate_api_key(request):
    form = forms.RegenerateApiKeyForm(request.POST)
    if form.is_valid():
        key, is_new = models.ApiKey.objects.get_or_create(user=request.user)
        key.regenerate()
        key.save()
    return redirect('kb-account-main')
Ejemplo n.º 2
0
def regenerate_api_key(request):
    form = forms.RegenerateApiKeyForm(request.POST)
    if form.is_valid():
        profile = request.user.get_profile()
        profile.api_secret = apikey.ApiKey.NewSecret()
        profile.save()
    return redirect_to(request, url='/account')