Class: Locomotive::ContentEntryImpersonationsController

Inherits:
BaseController
  • Object
show all
Defined in:
app/controllers/locomotive/content_entry_impersonations_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject


6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'app/controllers/locomotive/content_entry_impersonations_controller.rb', line 6

def create
  if content_entry.with_authentication?
    # automatically sign in the entry
    session[:authenticated_entry_type]    = content_type.slug
    session[:authenticated_entry_id]      = content_entry.id.to_s

    # add a flag to notify that the sign in was done by impersonating the entry
    session[:authenticated_impersonation] = '1'

    # notify signed in
    notify(:signed_in, content_entry, request)
    redirect_to preview_url(current_site)
  else
    redirect_to content_entries_path(current_site, content_type.slug)
  end
end