Class: Maquina::SessionsController
Instance Method Summary
collapse
#after_authentication_url, #authenticated?, #current_user, #require_authentication
Instance Method Details
#create ⇒ Object
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
# File 'app/controllers/maquina/sessions_controller.rb', line 15
def create
reset_session
@user = Maquina::User.authenticate_by(email: params.dig(:email), password: params.dig(:password))
if @user.present?
active_session = start_new_session_for(@user)
if active_session.present?
return redirect_to(calculate_redirect_path(active_session), notice: t("flash.sessions.create.notice"), status: :see_other)
end
end
@user = Maquina::User.new(email: params.dig(:email))
flash.now.alert = t("flash.sessions.create.alert")
render :new, status: :unprocessable_entity
end
|
#destroy ⇒ Object
32
33
34
35
36
37
38
|
# File 'app/controllers/maquina/sessions_controller.rb', line 32
def destroy
reset_session
Maquina::Current.reset
flash.notice = t("flash.sessions.destroy.notice")
redirect_to main_app.root_path, status: :see_other
end
|
#new ⇒ Object
11
12
13
|
# File 'app/controllers/maquina/sessions_controller.rb', line 11
def new
@user = Maquina::User.new
end
|