You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hey y'all! Thanks so much for making this gem! Very excited to get started on a new Rails 7 app and NOT have to use Devise.
That being said, I am having lots of weird and strange issues getting things up and running.
I went through the normal steps in the README, got the user model and custom views created, no problem, but once I started trying to actually "sign up" or "login" the problems began.
To start with, I am not really getting any of the flash messages. I have indeed added the following necessary flash bits to my application.html.erb file, but they don't seem to be working.
<%= tag.div notice if notice %>
<%= tag.div alert if alert %>
I do get one flash message in a weird circumstance, but we'll get back to that later.
The main takeaway here is that I am not getting any of the helpful flash messages when trying to sign up or login. Like, when I try to sign up, it fails, redirects back to the sign up page, but gives me no indication why the sign up didn't work. I see that the url params have been added, like the authenticity_token, email, etc, but those values are not pre-populated into form. I would expect that if the sign up were to fail, that I would see some sort of flash message telling me why, and then the form would stay populated with the values I already put in. That does not seem to be happening at all.
After some poking around and eventually giving up on the sign up form, I tried creating a new user in the rails console, and I got this curious error...
Validation failed: Password is too short (minimum is 12 characters) (ActiveRecord::RecordInvalid)
And that is despite the fact that I had set my minimum to 4 characters in revise_auth.rb config for easier local testing...
config.minimum_password_length = 4
So what gives?! Does that config option not actually work? And yes, I did restart my rails server after setting that config option.
Thoughts on that part?
I finally gave up on that config option, and just created a new user in the rails console with a 12 character password, and it FINALLY WORKED. Ugh. I even set the confirmed_at value, just in case that might have been throwing things off?
Once again, I am not getting any of the flash messages when I try to login. The login fails, it redirects back to the login page with the authenticity_token parameter in the url, and completely refreshes the form. I see the email url parameter as well, but that value does not stay populated in the form. So, something funny is going on.
The funny business continues regarding flash messages...
First off, the application that I am trying to build is one where I want the entire thing behind authentication. It will be an internal tool for the company I work for, and really no one will be using it unless they are logged in. So, I currently have my ApplicationController looking like this...
class ApplicationController < ActionController::Base
allow_browser versions: :modern
before_action :authenticate_user!
end
And then I overrode the auth controller as such:
class ReviseAuthController < ::ApplicationController
skip_before_action :authenticate_user!
end
On the surface it's working because when I hit the root path, it then redirects me to login. That part is great.
But, when login fails and it redirects back to login with the additional url parameters, if I then go up into the url, delete everything back to the root, and then hit enter again it does something strange. It first tries to hit the root_path, which is behind authentication, so then it redirects me back to the login page, and then it displays the one and only flash message that I have ever seen from this gem. It says:
Sign up or log in to continue.
Why is that the only time that I see a flash message? Is this some kind of Rails 7 / Turbo bug?!
Anyhoo, I dug around in your code base and double-checked the SessionsController, went back into the rails console, and then tried running this bit of code to see what's up...
user = User.authenticate_by(email: *my email*, password: *my password*)
And, in the console, that does indeed return my user!! So that part of the code is working correctly.
But for some reason, it does not log me in and it does not redirect me to where I want to go.
Thanks for listening to my rambling, and I hope you can help me.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hey y'all! Thanks so much for making this gem! Very excited to get started on a new Rails 7 app and NOT have to use Devise.
That being said, I am having lots of weird and strange issues getting things up and running.
I went through the normal steps in the README, got the user model and custom views created, no problem, but once I started trying to actually "sign up" or "login" the problems began.
To start with, I am not really getting any of the flash messages. I have indeed added the following necessary flash bits to my
application.html.erb
file, but they don't seem to be working.I do get one flash message in a weird circumstance, but we'll get back to that later.
The main takeaway here is that I am not getting any of the helpful flash messages when trying to sign up or login. Like, when I try to sign up, it fails, redirects back to the sign up page, but gives me no indication why the sign up didn't work. I see that the url params have been added, like the authenticity_token, email, etc, but those values are not pre-populated into form. I would expect that if the sign up were to fail, that I would see some sort of flash message telling me why, and then the form would stay populated with the values I already put in. That does not seem to be happening at all.
After some poking around and eventually giving up on the sign up form, I tried creating a new user in the rails console, and I got this curious error...
And that is despite the fact that I had set my minimum to 4 characters in
revise_auth.rb
config for easier local testing...So what gives?! Does that config option not actually work? And yes, I did restart my rails server after setting that config option.
Thoughts on that part?
I finally gave up on that config option, and just created a new user in the rails console with a 12 character password, and it FINALLY WORKED. Ugh. I even set the
confirmed_at
value, just in case that might have been throwing things off?So, moving on to login!
Once again, I am not getting any of the flash messages when I try to login. The login fails, it redirects back to the login page with the
authenticity_token
parameter in the url, and completely refreshes the form. I see the email url parameter as well, but that value does not stay populated in the form. So, something funny is going on.The funny business continues regarding flash messages...
First off, the application that I am trying to build is one where I want the entire thing behind authentication. It will be an internal tool for the company I work for, and really no one will be using it unless they are logged in. So, I currently have my ApplicationController looking like this...
And then I overrode the auth controller as such:
On the surface it's working because when I hit the root path, it then redirects me to login. That part is great.
But, when login fails and it redirects back to login with the additional url parameters, if I then go up into the url, delete everything back to the root, and then hit enter again it does something strange. It first tries to hit the root_path, which is behind authentication, so then it redirects me back to the login page, and then it displays the one and only flash message that I have ever seen from this gem. It says:
Why is that the only time that I see a flash message? Is this some kind of Rails 7 / Turbo bug?!
Anyhoo, I dug around in your code base and double-checked the SessionsController, went back into the rails console, and then tried running this bit of code to see what's up...
And, in the console, that does indeed return my user!! So that part of the code is working correctly.
But for some reason, it does not log me in and it does not redirect me to where I want to go.
Thanks for listening to my rambling, and I hope you can help me.
All the best!
Beta Was this translation helpful? Give feedback.
All reactions