Hi,
I have a few questions regarding rodauth and sequel:
1.
How do you get the current_user when using jwt in rodauth?
Is there a current_user helper or something similar?
should I just do the following:
Account.find(id: rodauth.account_from_session[:id])
2.
When saving a new record in sequel and there’re validators in model, it raises an error instead of returning a validation message.
eg:
Sequel::Model.plugin :validation_helpers
def validate
super
validates_min_length 5, :body
end
—
it’s not possible to do:
if post.save
{success: “”}.to_json
else
{error: post.errors...}.to_json
end
but something like this will work
post.safe
{success: “”}.to_json
rescue
{error: post.errors…}.to_json
How should such things be done?
3.
After setting custom routes for rodauth I had complains that login didn’t match and then there’s no password confirmation messages.
(Not sure why it asked for login confirmation). I added the last 2 lines from the code below and it solved the problem.
Interesting, it returned validation messages to the console(without raising an error)
Is this the expected behaviour?
prefix “auth”
login_route “signin”
require_login_confirmation? false
require_password_confirmation? false
4. Is it possible to replace {login: “”, password: “”} to {email: “”, password: “”} when making a post request to signin/signup route?
Thank you!