Sha256: 6cf4f3f7db99e3fdca1ef1fc61528ce057d7ca80fef415c8939bc0d4ba87e687

Contents?: true

Size: 670 Bytes

Versions: 15

Compression:

Stored size: 670 Bytes

Contents

# frozen_string_literal: true

module Renalware
  module Users
    # Renders a section on the dashboard that displays the last date and time the
    # user signed in. This is a National Cyber Security Centre recommendation.
    class LastSigninComponent < ApplicationComponent
      include Renalware::UsersHelper
      pattr_initialize [:current_user!]
      delegate :last_sign_in_at, :current_sign_in_at, to: :current_user

      def effective_last_sign_in_at
        return if last_sign_in_at.blank? || last_sign_in_at == current_sign_in_at

        last_sign_in_at
      end

      def render?
        effective_last_sign_in_at.present?
      end
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
renalware-core-2.1.1 app/components/renalware/users/last_signin_component.rb
renalware-core-2.1.0 app/components/renalware/users/last_signin_component.rb
renalware-core-2.0.167 app/components/renalware/users/last_signin_component.rb
renalware-core-2.0.166 app/components/renalware/users/last_signin_component.rb
renalware-core-2.0.165 app/components/renalware/users/last_signin_component.rb
renalware-core-2.0.164 app/components/renalware/users/last_signin_component.rb
renalware-core-2.0.163 app/components/renalware/users/last_signin_component.rb
renalware-core-2.0.162 app/components/renalware/users/last_signin_component.rb
renalware-core-2.0.161 app/components/renalware/users/last_signin_component.rb
renalware-core-2.0.160 app/components/renalware/users/last_signin_component.rb
renalware-core-2.0.159 app/components/renalware/users/last_signin_component.rb
renalware-core-2.0.158 app/components/renalware/users/last_signin_component.rb
renalware-core-2.0.157 app/components/renalware/users/last_signin_component.rb
renalware-core-2.0.156 app/components/renalware/users/last_signin_component.rb
renalware-core-2.0.155 app/components/renalware/users/last_signin_component.rb