/
Dmitry-F
/
cbt_tool
Обзор
Документация
Войти
/
Dmitry-F
/
cbt_tool
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
python-ml-service
app/controllers/auth_sessions_controller.rb
27 строк
839 B
Dmitriy-Filatov
fix: redirect to clients_path after login instead of therapists_path
24 фев 2026, 17:22
24 фев 2026, 17:22
8b5a74d
Код
Авторство
О чём код?
class AuthSessionsController < ApplicationController skip_before_action :require_login, only: [ :new, :create ] def new # Просто рендерит форму входа end def create therapist = Therapist.find_by(email: params[:email]) if therapist.nil? flash.now[:alert] = "Пользователь с таким email не зарегистрирован" render :new, status: :unprocessable_entity elsif !therapist.authenticate(params[:password]) flash.now[:alert] = "Неверный пароль" render :new, status: :unprocessable_entity else session[:therapist_id] = therapist.id redirect_to clients_path, notice: "Вы вошли" end end def destroy session[:therapist_id] = nil redirect_to signin_path, notice: "Вы вышли" end end