Class: UserSessionsController
- Inherits:
-
Devise::SessionsController
- Object
- Devise::SessionsController
- UserSessionsController
- Includes:
- Spree::CurrentOrder, SpreeBase
- Defined in:
- app/controllers/user_sessions_controller.rb
Instance Method Summary collapse
- #create ⇒ Object
-
#destroy ⇒ Object
~ end.
- #nav_bar ⇒ Object
-
#new ⇒ Object
GET /resource/sign_in.
Instance Method Details
#create ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'app/controllers/user_sessions_controller.rb', line 16 def create authenticate_user! if user_signed_in? api_key = current_user.generate_api_key! user_response = Hash.new user_response[:user] = Hash.new user_response[:user][:email]=current_user.email user_response[:user][:authentication_token]=current_user.authentication_token user_response[:user][:sign_in_count]=current_user.sign_in_count respond_to do |format| format.html { flash.notice = t(:logged_in_succesfully) redirect_back_or_default(products_path) } format.json { render :json => user_response.to_json } end else flash.now[:error] = t('devise.failure.invalid') render :new end end |
#destroy ⇒ Object
~ end
60 61 62 63 |
# File 'app/controllers/user_sessions_controller.rb', line 60 def destroy session.clear super end |
#nav_bar ⇒ Object
65 66 67 |
# File 'app/controllers/user_sessions_controller.rb', line 65 def render :partial => "shared/nav_bar" end |
#new ⇒ Object
GET /resource/sign_in
13 14 15 |
# File 'app/controllers/user_sessions_controller.rb', line 13 def new super end |