mirror of
https://github.com/Growstuff/growstuff.git
synced 2026-10-29 10:18:29 -04:00
* Add authentication dialogs for sign in and sign up - Implemented AuthDialog component to manage sign in and sign up modals. - Created SignInModal and SignUpModal components for handling respective authentication processes. - Added AuthFields component for reusable form fields and error handling. - Updated various views to utilize the new authentication dialogs instead of traditional links. - Enhanced user experience by allowing sign in and sign up actions to occur without full page reloads. - Added feature specs for testing the functionality of the new dialogs. * Refactor modals and input fields for improved accessibility and styling; adjust button sizes and text formatting * Refactor authentication forms and modals for improved usability and accessibility; integrate reCAPTCHA handling and enhance error messaging * Refactor SignUpModal layout for improved responsiveness and accessibility; organize fields into rows and enhance styling * Refactor session view spec to streamline field checks; remove redundant test and retain essential content expectations
23 lines
648 B
Ruby
23 lines
648 B
Ruby
# frozen_string_literal: true
|
|
|
|
class SessionsController < Devise::SessionsController
|
|
respond_to :html, :json
|
|
|
|
def create
|
|
super do |_resource|
|
|
flash[:notice] = t('devise.sessions.signed_in') if request.format.json?
|
|
flash[:alert] = t('messages.crops_waiting') if Crop.pending_approval.present? && current_member.role?(:crop_wrangler)
|
|
end
|
|
end
|
|
|
|
private
|
|
|
|
# The sign in dialog reloads the page it was opened over, so a success needs
|
|
# no body. A failure is Devise's own 401 with an `error` message.
|
|
def respond_with(*args, &)
|
|
return head :no_content if request.format.json? && member_signed_in?
|
|
|
|
super
|
|
end
|
|
end
|