24 lines
556 B
Ruby
24 lines
556 B
Ruby
# -*- encoding : utf-8 -*-
|
|
class Forum::AuthsController < ApplicationController
|
|
layout "forum"
|
|
|
|
def new
|
|
end
|
|
|
|
def create
|
|
user = ForumUser.find_by_email(params[:email])
|
|
if user && user.authenticate(params[:password])
|
|
session[:forum_user_id] = user.id
|
|
redirect_to forum_forum_users_path, notice: "Connecté !"
|
|
else
|
|
flash.now.alert = "Email ou mot de passe incorect"
|
|
render "new"
|
|
end
|
|
end
|
|
|
|
def logout
|
|
session[:forum_user_id] = nil
|
|
redirect_to forum_forum_users_path, notice: "Logged out!"
|
|
end
|
|
end
|