Class: SessionsController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- SessionsController
- Defined in:
- app/controllers/sessions_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'app/controllers/sessions_controller.rb', line 6 def create if session_params[:name] != "admin" # NOTE: Application user is "admin" only, other user name is invalid for now. flash.now[:notice] = I18n.t("messages.login_failed") return render :new end unless @user.authenticate(session_params[:password]) flash.now[:notice] = I18n.t("messages.login_failed") return render :new end sign_in @user if session_params[:password] == Settings.default_password flash[:warning] = t('terms.changeme_password') end redirect_to root_path end |
#destroy ⇒ Object
23 24 25 26 |
# File 'app/controllers/sessions_controller.rb', line 23 def destroy session.delete :succeed_password redirect_to new_sessions_path end |