We are using devise gem on ruby on rails for user account. If anyone click on our verification link 3 days later, we can see this message -
Email needs to be confirmed within 3 days, please request a new one
we are seeing like this cause on the config/locales/devise.en.yml there is -
confirmation_period_expired: "needs to be confirmed within %{period}, please request a new one"
But I have changed the confirmation_period_expired variable like this -
confirmation_period_expired: " hello world"
but i can see the verification message like this -
Email hello world
Hope you understand the problem. by default "email" text is comming. I want to remove this.
I can see on the devise gem, this file is responsible for automatic adding "email" text.
Now just say me how can I remove the by default "email" text from the devise varification message?
To solve this problem on devise helper you will see a method resource.errors.full_messages
you have to rename it resource.errors.messages
Related
In my Rails 5 app I want to display custom error message if the user enters the password incorrectly for a custom strategy method. What I did is:
devise.en.yml
en:
devise:
failure:
custom_auth: "Email is already registered. \nPlease login <a href='https://www.some_page.com'>Some Page</a> or create an account with a different email address.
But it won't worked, the same as:
custom_auth: "Email is already registered. \nPlease login [Some Page](https://www.some_page.com/login) or create an account with a different email address.
Most likely you need to use html_safe, as in I18n.t("devise.failure.custom_auth").html_safe - otherwise the translation will be escaped, and the link will not work.
I have a Rails project that asks for the user`s first name at sign up.
Later on I want to display it on another page, when I attempt to using the following:
<h1>Hello, <%= current_customer.first_name %> !</h1>
This results in the output "Hello, !"
When first_name is replaced with a standard Devise field (email) it works.
Any idea as to what might be causing this?
First of all, thanks in adavance.
This might be so noob question.
I already did setup devise and mailboxer. devise works completely fine!
Then "username" column is added to Users table, and I configured just like this
/config/initializers/mailboxer.rb
#Configures the methods needed by mailboxer
config.email_method = :email
config.name_method = :username
Now I'm totally stucked!! I don't know how to make the rest for simple message system.
What I want is these message function listed below
index(index/received or index/sent)... you can see the list of messages received(from/to, subjectes, and received date are only shown)
show...you can see whole body of the message.
new... message create form, as an option, you can choose 'reply' from "show" page. in this case body text field already includes messages quotes.
Can someone make very simple example for me?
I can pay up to $50 for it via paypal!
I think I need to make
"messages_controller"
"message" model if you needed with mailboxer gem
"view/messages/index", "view/messages/show", "view/messages/new"
"routes" has to be modified.
Thanks
I assume you've resolved your issues by now, but for future reference, a sample app featuring the mailboxer gem is:
https://github.com/RKushnir/mailboxer-app
(not mine, but helpful to get up and going)
I want to create a PageMailer which emails users when someone interacts with one of their pages.
The User has_many pages, and so the page email is defined as user.email
I have tried attr_reader in the Page model, and also I've declared an email method, neither are currently working
I'm getting an error message which states: undefined method 'email' for <Page:0x512000d4>
Can anyone suggest a simple workaround?
thanks
Paul
send_fb_like_email(user, page)
undefined method 'email' for <Page:0x512000d4>
The error says it's trying to find the "email" of a "page".
Looks like you've accidentally switched the user and page params in one of the calls to the method. Go check all the places where you call this email method and see if you've done that.
How to override the Devise Passwords Controller:
https://github.com/plataformatec/devise/blob/master/app/controllers/devise/passwords_controller.rb
I want to do the following:
downcase all emails submitted for password reset. All the emails in the DB as lowercase. If a user tried to reset a valid email with any characters uppercase, the reset fails to find a user. And devise doesn't even give a error message saying no user found
If no user is found in def create, I want to add a flash that says, no user found, did you enter the right email?
How can I accomplish the 2 items above? I believe that required overriding the devise password controller. How do I do that? Or if you have a better solution that's even cleaner, I would like to hear it.
Thanks
the devise initializer has a option to make any field case insensitive:
config.case_insensitive_keys = [ :email ]
If I remember correctly it was added in the newer version and if you don't see some related comments in you initializer then you should upgrade your devise gem using bundle upgrade devise. I am using version 1.3.3.
And this version also shows an error "Email not found" if an invalid email is entered.
If you not getting the error message add <%= devise_error_messages! %> to your view. You can customize the error messages by editing config/locales/devise.en.yml