Class: Gitkite::GitkitController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- Gitkite::GitkitController
- Defined in:
- app/controllers/gitkite/gitkit_controller.rb
Instance Method Summary collapse
- #send_email ⇒ Object
-
#sign_in ⇒ Object
Show sign in form.
-
#sign_in_callback ⇒ Object
Redirect from Gitkit to handle signin callback.
-
#sign_in_success ⇒ Object
This will be called after successfull signin.
- #sign_out ⇒ Object
Instance Method Details
#send_email ⇒ Object
62 63 |
# File 'app/controllers/gitkite/gitkit_controller.rb', line 62 def send_email end |
#sign_in ⇒ Object
Show sign in form
11 12 13 14 15 |
# File 'app/controllers/gitkite/gitkit_controller.rb', line 11 def sign_in if !request.params['mode'] redirect_to gitkit_sign_in_url(:params => {:mode=>'select'}) end end |
#sign_in_callback ⇒ Object
Redirect from Gitkit to handle signin callback
7 8 |
# File 'app/controllers/gitkite/gitkit_controller.rb', line 7 def sign_in_callback end |
#sign_in_success ⇒ Object
This will be called after successfull signin
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'app/controllers/gitkite/gitkit_controller.rb', line 18 def sign_in_success g_user = signed_in? if g_user user = { :email => g_user.email, :user_id => g_user.user_id, :name => g_user.name, :photo_url => g_user.photo_url, :provider_id => g_user.provider_id } @user = User.find_by(user_id: user[:user_id]) if @user.nil? @user = User.create user else @user.update user end session[:user] = @user.id if session[:previous_url] previous_url = session[:previous_url] session.delete :previous_url redirect_to previous_url else redirect_to main_app.root_url end else @user = false session.delete :user flash.alert = "Sign in failed. Please try again." redirect_to gitkit_sign_in_url end end |
#sign_out ⇒ Object
56 57 58 59 60 |
# File 'app/controllers/gitkite/gitkit_controller.rb', line 56 def sign_out reset_session .delete :gtoken redirect_to main_app.root_url end |