<commit_before>require 'sinatra/base'

module Sinatra
  module SimpleAuth
    module Helpers
      def authorized?
        session[:arni]
      end

      def auth!(password)
        if password == options.password
          session[:arni] = true
          redirect_back_or_default(options.home)
        end
        redirect '/a'
      end

      def logout!
        session.clear
        redirect '/'
      end

      def protected!
        unless authorized?
          store_location
          redirect '/a'
        end
      end

      def store_location
        session[:return_to] = request.fullpath if request.get?
      end

      protected
      def redirect_back_or_default(default)
        if session[:return_to] && session[:return_to] !=~ /^\/a\/?$/
          back = session[:return_to].clone
          session[:return_to] = nil
          redirect back
        end
        redirect default
      end
<commit_msg>fix deprecation warning: use settings instead of options<commit_after>require 'sinatra/base'

module Sinatra
  module SimpleAuth
    module Helpers
      def authorized?
        session[:arni]
      end

      def auth!(password)
        if password == settings.password
          session[:arni] = true
          redirect_back_or_default(settings.home)
        end
        redirect '/a'
      end

      def logout!
        session.clear
        redirect '/'
      end

      def protected!
        unless authorized?
          store_location
          redirect '/a'
        end
      end

      def store_location
        session[:return_to] = request.fullpath if request.get?
      end

      protected
      def redirect_back_or_default(default)
        if session[:return_to] && session[:return_to] !=~ /^\/a\/?$/
          back = session[:return_to].clone
          session[:return_to] = nil
          redirect back
        end
        redirect default
      end

{'fraction_non_alphanumeric': 0.07879428873611846, 'fraction_numerical': 0.0, 'mean_word_length': 1.7341040462427746, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '3485321', 'n_tokens_mistral': 513, 'n_tokens_neox': 499, 'n_words': 131}