Class: UserSessionsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- UserSessionsController
- Defined in:
- app/controllers/user_sessions_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'app/controllers/user_sessions_controller.rb', line 12 def create user_session_plan = params[:user_session] if /@/ =~ user_session_plan['username'] #we have email address instead of username user = User.find_by_email(user_session_plan['username']) user_session_plan['username'] = user.username unless user.nil? end @user_session = UserSession.new(user_session_plan) if @user_session.save flash[:notice] = t :login_successful_flash redirect_to_forwarding_url else render :action => 'new' end end |
#destroy ⇒ Object
29 30 31 32 33 34 |
# File 'app/controllers/user_sessions_controller.rb', line 29 def destroy @user_session = UserSession.find @user_session.destroy flash[:notice] = t :logout_successful_flash redirect_to login_url end |
#new ⇒ Object
8 9 10 |
# File 'app/controllers/user_sessions_controller.rb', line 8 def new @user_session = UserSession.new end |