Sha256: 066fbb847f9d81ddc9a669f6abf1d0efcb376248dc7da2064b14415ea2a5d086
Contents?: true
Size: 816 Bytes
Versions: 2
Compression:
Stored size: 816 Bytes
Contents
class SignInsController::Create < BaseAction def perform return view_builder.build(Todos::IndexRedirect) if current_user return view_builder.build(Defaults::BadRequestView, status: :bad_request, errors: [user_params.error_message]) unless user_params.fetch return view_builder.build(SignIns::NewView, status: :not_found) unless user if user.authenticate(user_params.fetch[:password]) SignInService.perform!(session, user) view_builder.build(Todos::IndexRedirect) else view_builder.build(SignIns::NewView, status: :unprocessable_entity, errors: ["Incorrect credentials"]) end end private def user_params @user_params ||= ::SignInsController::UserParams.build(params) end def user @user ||= User.where(email: user_params.fetch[:email]).first end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
aldous-1.1.3 | examples/basic_todo/app/controller_actions/sign_ins_controller/create.rb |
aldous-1.1.2 | examples/basic_todo/app/controller_actions/sign_ins_controller/create.rb |