Skip to content

Commit

Permalink
Merge pull request #1773 from MushroomObserver/nimmo-mrtg-login
Browse files Browse the repository at this point in the history
Log in `MRTG` for better stats
  • Loading branch information
nimmolo committed Jan 9, 2024
2 parents 9c43556 + 7e36a8e commit 64aaa1e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/controllers/account_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def create
return render(action: :new) unless validate_and_save_new_user!

UserGroup.create_user(@new_user)
flash_notice("#{:runtime_signup_success.tp}#:{email_spam_notice.tp}")
flash_notice("#{:runtime_signup_success.tp} #{:email_spam_notice.tp}")
QueuedEmail::VerifyAccount.create_email(@new_user)
end

Expand Down
5 changes: 4 additions & 1 deletion app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,10 @@ def clear_user_globals
end

def try_user_autologin(user_from_session)
if user_verified_and_allowed?(user = user_from_session)
if Rails.env.production? && request.remote_ip == "127.0.0.1"
# Request from the server itself, MRTG needs to log in to test page loads.
login_valid_user(User.find_by(login: "mrtg"))
elsif user_verified_and_allowed?(user = user_from_session)
# User was already logged in.
refresh_logged_in_user_instance(user)
elsif user_verified_and_allowed?(user = validate_user_in_autologin_cookie)
Expand Down

0 comments on commit 64aaa1e

Please sign in to comment.