<commit_before>class Roda
  module RodaPlugins
    module Rodauth
      Remember = Feature.define(:remember) do
        depends :logout
        route 'remember'
        notice_flash "Your remember setting has been updated"
        view 'remember', 'Change Remember Setting'
        additional_form_tags
        button 'Change Remember Setting'
        redirect
        require_account

        auth_value_methods(
          :extend_remember_deadline?,
          :remember_confirm_view,
          :remember_confirm_additional_form_tags,
          :remember_cookie_key,
          :remember_cookie_options,
          :remember_deadline_column,
          :remember_id_column,
          :remember_key_column,
          :remember_period,
          :remember_table,
          :remembered_session_key
        )
        auth_methods(
          :after_load_memory,
          :add_remember_key,
          :clear_remembered_session_key,
          :disable_remember_login,
          :forget_login,
          :get_remember_key,
          :generate_remember_key_value,
          :load_memory,
          :remember_key_value,
          :remember_login,
          :remove_remember_key
        )

        get_block do |r, auth|
          if r['confirm']
            auth.remember_confirm_view
          else
            auth.remember_view
          end
        end

        post_block do |r, auth|
          if r['confirm']
            if auth._account_from_session && auth.password_match?(r[auth.password_param].to_s)
              auth.clear_remembered_session_key
              r.redirect auth.remember_confirm_redirect
            else
              @password_error = auth.invalid_password_message
              auth.remember_confirm_view
            end
          else
            case r['remember']
            when 'remember'
              auth.remember_login
            when 'forget'
              auth.forget_login 
            when 'disable'
              auth.disable_remember_login 
            end
            auth.set_notice_flash auth.remember_notice_flash
            r.redirect auth.remember_redirect
          end
        end

        def after_logout
          super
          forget_login
        end

        def remember_confirm_view
          view('confirm-password', 'Confirm Password')
        end

        def remember_confirm_button
          'Confirm Password'
        end

        def remember_confirm_redirect<commit_msg>Add after_remember and after_remember_confirm methods<commit_after>class Roda
  module RodaPlugins
    module Rodauth
      Remember = Feature.define(:remember) do
        depends :logout
        route 'remember'
        notice_flash "Your remember setting has been updated"
        view 'remember', 'Change Remember Setting'
        additional_form_tags
        button 'Change Remember Setting'
        after
        redirect
        require_account

        auth_value_methods(
          :extend_remember_deadline?,
          :remember_confirm_view,
          :remember_confirm_additional_form_tags,
          :remember_cookie_key,
          :remember_cookie_options,
          :remember_deadline_column,
          :remember_id_column,
          :remember_key_column,
          :remember_period,
          :remember_table,
          :remembered_session_key
        )
        auth_methods(
          :add_remember_key,
          :after_load_memory,
          :after_remember_confirm,
          :clear_remembered_session_key,
          :disable_remember_login,
          :forget_login,
          :generate_remember_key_value,
          :get_remember_key,
          :load_memory,
          :remember_key_value,
          :remember_login,
          :remove_remember_key
        )

        get_block do |r, auth|
          if r['confirm']
            auth.remember_confirm_view
          else
            auth.remember_view
          end
        end

        post_block do |r, auth|
          if r['confirm']
            if auth._account_from_session && auth.password_match?(r[auth.password_param].to_s)
              auth.transaction do
                auth.clear_remembered_session_key
                auth.after_remember_confirm
              end
              r.redirect auth.remember_confirm_redirect
            else
              @password_error = auth.invalid_password_message
              auth.remember_confirm_view
            end
          else
            auth.transaction do
              case r['remember']
              when 'remember'
                auth.remember_login
              when 'forget'
                auth.forget_login 
              when 'disable'
                auth.disable_remember_login 
              end
              auth.after_remember
            end
            auth.set_notice_flash auth.remember_notice_flash
            r.redirect auth.remember_redirect
          end
        end

        def after_logout
          super
          forget_login
        end

        def after_remember_confirm
        end

        def remember_confirm_view
          view('confirm-password', '<PASSWORD>')
        end

        def remember_confirm_button
          'Confirm Password'
        end

        def remember_confirm_redirect
{'fraction_non_alphanumeric': 0.050837666088965915, 'fraction_numerical': 0.0, 'mean_word_length': 1.6232323232323231, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5984223', 'n_tokens_mistral': 1388, 'n_tokens_neox': 1298, 'n_words': 257}