lib/balrog/middleware/controller.rb
# This method is called if a user attempts to sign in with a password
# and will authenticate the user if the password is correct.
This method is called if a user attempts to sign in with a password
and will authenticate the user if the password is correct.
This method is called if a user attempts to sign in with a password and will authenticate the user if the password is correct .
def password_login(env)
      if env['rack.request.form_hash']
        submitted_password = env['rack.request.form_hash']['password']
      end
      unless submitted_password
        return [302, {"Location" => referer}, [""]]
      end
      unless password_hash
        warn <<~EOF
          !! Balrog has not been configured with a password_hash. You shall not
          !! pass! When adding Balrog::Middleware to your middleware stack, pass
          !! in a block and call `password_hash` passing in a bcrypt hash.
          !!
          !! Check out https://github.com/pixielabs/balrog for more information.
        EOF
      end
      if password_hash == submitted_password
        authenticate_user(env)
      end
      referer = env["HTTP_REFERER"] || '/'
      [302, {"Location" => referer}, [""]]
    end
def password_login ( env ) if env [ 'rack.request.form_hash' ] submitted_password = env [ 'rack.request.form_hash' ] [ 'password' ] end unless submitted_password return [ 302 , { "Location" => referer } , [ "" ] ] end unless password_hash warn <<~EOF 

          !! Balrog has not been configured with a password_hash. You shall not
          !! pass! When adding Balrog::Middleware to your middleware stack, pass
          !! in a block and call `password_hash` passing in a bcrypt hash.
          !!
          !! Check out https://github.com/pixielabs/balrog for more information.

         EOF end if password_hash == submitted_password authenticate_user ( env ) end referer = env [ "HTTP_REFERER" ] || '/' [ 302 , { "Location" => referer } , [ "" ] ] end
This method is called if a user attempts to sign in with a password
and will authenticate the user if the password is correct.
This method is called if a user attempts to sign in with a password and will authenticate the user if the password is correct .
# Extract the submitted_password from the rack request hash. # If there is no submitted_password, redirect the user before authentication. # If there is no password_hash, alert the developer. # Authenticate the user if the submitted_password matches the password_hash.
env