Skip to content

Commit

Permalink
Invitation expiration date changed to 7 days. Serializer updated to c…
Browse files Browse the repository at this point in the history
…heck for validity of invite.
  • Loading branch information
alihadimazeh committed Jun 20, 2024
1 parent ff77208 commit fd78932
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app/models/invitation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
# frozen_string_literal: true

class Invitation < ApplicationRecord
INVITATION_VALIDITY_PERIOD = 48.hours
INVITATION_VALIDITY_PERIOD = 7.days

has_secure_token :token

Expand Down
4 changes: 3 additions & 1 deletion app/serializers/invitation_serializer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ class InvitationSerializer < ApplicationSerializer
attributes :id, :email, :updated_at, :valid

def valid
object.updated_at.in(Invitation::INVITATION_VALIDITY_PERIOD)
expiration_time = object.updated_at + Invitation::INVITATION_VALIDITY_PERIOD

Time.current <= expiration_time
end
end
2 changes: 1 addition & 1 deletion config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ en:
invitation_to_join: BigBlueButton Invitation
you_have_been_invited: You have been invited to create a BigBlueButton account by %{name}.
get_started: To sign up, please click the button below and follow the steps.
valid_invitation: The invitation is valid for 24 hours.
valid_invitation: The invitation is valid for 7 days.
sign_up: Sign Up
new_user_signup:
new_user: New BigBlueButton User Signup
Expand Down

0 comments on commit fd78932

Please sign in to comment.