Class: Rodauth::Rails::Generators::ViewsGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Defined in:
lib/generators/rodauth/views_generator.rb

Constant Summary collapse

VIEWS =
{
  login:               %w[_login_form _login_form_footer login multi_phase_login],
  create_account:      %w[create_account],
  logout:              %w[logout],
  reset_password:      %w[reset_password_request reset_password],
  remember:            %w[remember],
  change_login:        %w[change_login],
  change_password:     %w[change_password],
  close_account:       %w[close_account],
  email_auth:          %w[_email_auth_request_form email_auth],
  verify_account:      %w[verify_account_resend verify_account],
  verify_login_change: %w[verify_login_change],
  lockout:             %w[unlock_account_request unlock_account],
  two_factor_base:     %w[two_factor_manage two_factor_auth two_factor_disable],
  otp:                 %w[otp_setup otp_auth otp_disable],
  otp_unlock:          %w[otp_unlock otp_unlock_not_available],
  sms_codes:           %w[sms_setup sms_confirm sms_auth sms_request sms_disable],
  recovery_codes:      %w[recovery_codes add_recovery_codes recovery_auth],
  webauthn:            %w[webauthn_setup webauthn_auth webauthn_remove],
  webauthn_autofill:   %w[webauthn_autofill],
  confirm_password:    %w[confirm_password],
}

Instance Method Summary collapse

Instance Method Details

#create_viewsObject



48
49
50
51
52
53
54
55
56
57
58
# File 'lib/generators/rodauth/views_generator.rb', line 48

def create_views
  return unless validate_features

  views.each do |view|
    copy_file view_location(view), "app/views/#{directory}/#{view}.html.erb" do |content|
      content = content.gsub("rodauth.", "rodauth(:#{configuration_name}).") if configuration_name
      content = content.gsub("rodauth/", "#{directory}/")
      content
    end
  end
end