Class: BulkOps::GithubAuthorizationController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- BulkOps::GithubAuthorizationController
- Defined in:
- app/controllers/bulk_ops/github_authorization_controller.rb
Instance Method Summary collapse
- #authorize ⇒ Object
-
#logout ⇒ Object
DELETE /github_credentials/1 DELETE /github_credentials/1.json.
Instance Method Details
#authorize ⇒ Object
3 4 5 6 7 8 |
# File 'app/controllers/bulk_ops/github_authorization_controller.rb', line 3 def return false unless BulkOps::GithubAccess.valid_state?(params['state'],params['user_id']) BulkOps::GithubAccess.set_auth_token! params['code'], params['user_id'] redirect_target = session[:git_auth_redirect] || "/bulk_ops/operations" redirect_to redirect_target, notice: "Successfully logged in to Github" end |
#logout ⇒ Object
DELETE /github_credentials/1 DELETE /github_credentials/1.json
12 13 14 15 16 17 18 19 |
# File 'app/controllers/bulk_ops/github_authorization_controller.rb', line 12 def logout BulkOps::GithubCredential.find_by(user_id: current_user.id).destroy respond_to do |format| redirect_target = session[:git_auth_redirect] || "/bulk_ops/operations" format.html { redirect_to redirect_target, notice: 'Logged out of github' } format.json { head :no_content } end end |