Revisions

gist: 100421 Download_button fork
public
Public Clone URL: git://gist.github.com/100421.git
Embed All Files: show embed
Ruby #
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# Snippet from http://mislav.uniqpath.com/rails/haxor-backdoor-in-development/
class SessionsController < ApplicationController
 
  before_filter :haxor_backdoor, :only => :new
 
  # ...
 
  protected
 
    def haxor_backdoor
      if Rails.env.development?
        email = `git config --global user.email`.chomp
        self.current_user = User.find_by_email(email)
        redirect_to(:back) if logged_in?
      end
    end
 
end