Sha256: d7a017ad7b4ca46536b1cc100b3f2a2d3166335cf9868f081727e994cc95c00d
Contents?: true
Size: 1.32 KB
Versions: 4
Compression:
Stored size: 1.32 KB
Contents
# frozen_string_literal # # Controller for managing two-factor credentials for <%= plural_class_name %>. # Automatically generated by the orthodox gem (https://github.com/katanacode/orthodox) # (c) Copyright 2019 Katana Code Ltd. All Rights Reserved. class <%= plural_class_name %>::TfasController < <%= plural_class_name %>::BaseController skip_before_action :authenticate_<%= singular_name %> before_action :authenticate_<%= singular_name %>_without_tfa ## # How long will we show the QRCode and recovery codes before they can no longer be # accessed? CAPTURE_TIME_ALLOWANCE = 15.seconds def create current_<%= singular_name %>.create_otp_credential! redirect_to(<%= plural_name %>_tfa_url, notice: "Successfully activated Two-Factor Authentication") end # This is where the <%= singular_name %> gets to see their recovery codes and QR Code. # After CAPTURE_TIME_ALLOWANCE they cannot re-visit this page def show if current_<%= singular_name %>.otp_credential.created_at < CAPTURE_TIME_ALLOWANCE.ago redirect_to <%= plural_name %>_dashboard_url end end def destroy current_<%= singular_name %>.destroy_otp_credential redirect_to(<%= plural_name %>_dashboard_url, notice: "Successfully de-activated Two-Factor Authentication") end end
Version data entries
4 entries across 4 versions & 1 rubygems