Replies: 1 comment 2 replies
-
You could run Active Record validations like this: before_omniauth_create_account do
if rails_account.invalid?
validation_error = rails_account.errors.full_messages.first
set_redirect_error_flash validation_error
redirect omniauth_login_failure_redirect
end
end You might need to assign the domain to the model instance before running validations. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
If you have extended the
Account
model for example thedomain
withbelongs_to :domain, required: true
or usingbefore_validation
the creation of a new account through rodauth_omniauth after successfull callback phase ignores the Rails model validations and directly insert the invalid account. Of course there is abefore_omniauth_create_account
(currently I do not know how to redirect in this function if something is not valid) but maybe its more "rails" style to follow the model's validations. Or is there anything I completly overlooked?Have a great day!
Beta Was this translation helpful? Give feedback.
All reactions