Class: Supabase::Rails::RegistrationsController
- Inherits:
-
BaseController
- Object
- ApplicationController
- BaseController
- Supabase::Rails::RegistrationsController
- Defined in:
- app/controllers/supabase/rails/registrations_controller.rb
Overview
Email + password sign-up. Two-branch happy path:
* `result.value.session` is non-nil → auto-sign-in is enabled on the
Supabase project → user is signed in immediately.
* `result.value.session` is nil → email-confirmation is required →
render a "Check your inbox" notice and route back to the sign-in
page so the user lands there after clicking the confirmation link.
On a 4xx upstream failure Authentication#supabase_sign_up surfaces the mapped AuthError so the host can show specific UI for ‘WEAK_PASSWORD` (422) while masking other 4xx errors to a generic “Invalid credentials” (FR-W7 / US-012). 5xx flashes a generic message.
Instance Method Summary collapse
Methods included from Authentication
#after_authentication_url, #authenticate_with_supabase, #authenticated?, #current_user, expose_current_user?, railtie_config, redact_email, #request_authentication, #require_authentication, #start_new_session_for, #store_location_for_redirect, #stored_location_for_redirect, #supabase_exchange_code_for_session, #supabase_resend, #supabase_reset_password, #supabase_sign_in_with_oauth, #supabase_sign_in_with_otp, #supabase_sign_in_with_password, #supabase_sign_up, #supabase_update_user, #supabase_verify_otp, #terminate_session
Instance Method Details
#create ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'app/controllers/supabase/rails/registrations_controller.rb', line 22 def create result = supabase_sign_up(email: params[:email], password: params[:password]) if result.success? if registered_session_present?(result.value) redirect_to after_authentication_url, notice: I18n.t("supabase.rails.registrations.created") else redirect_to new_session_path, notice: I18n.t("supabase.rails.registrations.pending_confirmation") end else flash.now[:alert] = result.error. render :new, status: :unprocessable_entity end end |
#new ⇒ Object
20 |
# File 'app/controllers/supabase/rails/registrations_controller.rb', line 20 def new; end |