Class: Writefully::SessionsController
Instance Method Summary
collapse
#authenticate_wf_authorship!, #set_flash, #wf_authorship_signed_in?
Instance Method Details
#create ⇒ Object
9
10
11
12
13
14
15
16
17
18
|
# File 'app/controllers/writefully/sessions_controller.rb', line 9
def create
@auth = Writefully.github_app.get_token(params[:code])
@github = Github.new oauth_token: @auth.token
@github_user = @github.users.get
@owner = find_or_create_owner
refresh_token
session[:wf_authorship_id] = @owner.id
redirect_to root_path, notice: 'signed_in'
end
|
#destroy ⇒ Object
20
21
22
23
|
# File 'app/controllers/writefully/sessions_controller.rb', line 20
def destroy
session[:wf_authorship_id] = nil
redirect_to root_path, notice: 'signed_out'
end
|
#new ⇒ Object
5
6
7
|
# File 'app/controllers/writefully/sessions_controller.rb', line 5
def new
@github_app = Writefully.github_app
end
|