Skip to content

Commit

Permalink
[#8] /credentails expiry date
Browse files Browse the repository at this point in the history
  • Loading branch information
mjstealey committed Aug 11, 2022
1 parent 1e57e3a commit 37aae0c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions portal/apps/credentials/api/viewsets.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from datetime import datetime, timezone
from datetime import datetime, timedelta, timezone
from uuid import uuid4

from django.shortcuts import get_object_or_404
Expand All @@ -11,7 +11,7 @@

from portal.apps.credentials.api.serializers import CredentialSerializerDetail, CredentialSerializerList
from portal.apps.credentials.api.utils import generate_rsa_2048_key
from portal.apps.credentials.models import PublicCredentials
from portal.apps.credentials.models import CREDENTIAL_EXPIRY_DAYS, PublicCredentials

# constants
PUBLIC_KEY_MIN_NAME_LEN = 5
Expand Down Expand Up @@ -115,6 +115,7 @@ def create(self, request):
new_key = None
# create project
pub_key = PublicCredentials()
pub_key.expiry_date = datetime.now(timezone.utc) + timedelta(days=CREDENTIAL_EXPIRY_DAYS)
pub_key.name = public_key_name
pub_key.public_credential = public_key_credential
pub_key.uuid = uuid4()
Expand Down

0 comments on commit 37aae0c

Please sign in to comment.