Repository navigation
Replies: 3 comments 4 replies
|
First, thanks for reaching out!
Unfortunately, this is an incorrect assumption. All tables where you want a different name from the default must be configured via a separate method call for the table. If you are using non-default column names, you'll need a separate configuration method per column as well. The 422 response could mean multiple things, such as the login parameter submitted not present, too short, too long, or not a valid email. Rodauth should be setting a flash error (in web mode) or including more specific errors in the json response (in json mode).
It's possible that errors may be specific to the hanami-rodauth integration (e.g. you aren't seeing a flash or field error with more detail), which is not part of Rodauth. You'll have to discuss those issues with the maintainer of the hanami-rodauth integration. For further help in this forum, please submit a minimal self-contained reproducible example that only uses features that ship with Rodauth. |
Thanks, I was failing to make the connection between the feature documentation, key for enablement, migration, and configuration options. I now know how all of this is connected now and have fixed my
Correct. The implementation is below in case you are curious (it's basically the glue that allows Hanami to talk to Roda/Rodauth -- a translation layer for templates/partials). Rodauth Hanami Feature# auto_register: false
# frozen_string_literal: true
require "rodauth"
Rodauth::Feature.define :hanami do
auth_value_method :hanami_view, nil
def view template, title
return super unless view_template? template
view_rendering.template(
view_base.class.layout_path(view_base.config.layout),
view_rendering.scope(rodauth: self)
) do
render template
end
end
def render template
return super unless view_template? template
view_rendering.template view_template_name(template), view_rendering.scope(rodauth: self)
end
private
def view_template? template_name
view_rendering.renderer.__send__ :lookup,
view_template_name(template_name),
view_base.config.default_format
end
# :reek:UtilityFunction
def view_template_name(template_name) = "authentication/#{template_name.tr "-", "_"}"
def view_rendering
@view_rendering ||= view_base.rendering format: view_base.config.default_format,
context: view_context
end
def view_context
@view_context ||= begin
action_request = Hanami::Action::Request.new(
env: request.env,
params: request.params,
session_enabled: true
)
view_base.config.default_context.class.new request: action_request
end
end
def view_base
@view_base ||= Class.new(hanami_view.call).new
end
end
Thanks, understood, and don't want to eat up more of your time than I have too. I'll work on getting a Hanami demonstration app that only uses Rodauth for you next (might take me a moment, though). |
|
OK, I've fixed all issues with my |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Hello. 👋
I'm trying to setup a slightly more complicated configuration where I have the following table (emphasis on singular instead of plural names):
I'm using Rodauth middleware with the following configuration (truncated for simplicity):
Middleware Code Snippet
In the above, I want to call attention to the following configuration:
I assume this is correct but when I use "register" I can see the route in the UI but my associated template won't render properly. The fields are there but my layout is missing. I know this works because my
login.html.erbis picked up. Regardless, when I click on the "Create Account" button from theregisterform, I get the following in the logs:...but no records are created. I tried searching the Rodauth gem source for "sign-up" related paths, templates, etc. but seem to missing the connection.
I also tried to put a debug statement in the
after_create_accountcallback (not shown in the code snippet above) but the breakpoint is never reached. What am I missing?All reactions