10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
# File 'app/controllers/searls/auth/logins_controller.rb', line 10
def create
user = searls_auth_config.user_finder_by_email.call(params[:email])
if user.present?
attach_short_code_to_session!(user)
EmailsLink.new.email(
user:,
redirect_path: params[:redirect_path],
redirect_subdomain: params[:redirect_subdomain],
short_code: session[:searls_auth_short_code]
)
flash[:notice] = searls_auth_config.resolve(
:flash_notice_after_login_attempt,
user, params
)
redirect_to searls_auth.verify_path(
redirect_path: params[:redirect_path],
redirect_subdomain: params[:redirect_subdomain]
)
else
flash.now[:error] = searls_auth_config.resolve(
:flash_error_after_login_attempt_unknown_email,
searls_auth.register_path(
email: params[:email],
redirect_path: params[:redirect_path],
redirect_subdomain: params[:redirect_subdomain]
),
params
)
render searls_auth_config.login_view, layout: searls_auth_config.layout, status: :unprocessable_entity
end
end
|