ruby-on-rails,devise,devise-confirmable
Create a method in your user model to use it instead of the create method. Let's call it create_with_password def self.create_with_password(attr={}) generated_password = attr[:first_name] + "123" self.create(attr.merge(password: generated_password, password_confirmation: generated_password)) end Override devise's registration controller to use your new method which generates the two necessary fields for devise password and...
ruby-on-rails,devise-confirmable
Finally found it thanks to devise I can use the sign_in_count to display the button only for signed up users and not for logged in users by checking (current_user.sign_in_count == 1).And it will shown only once :) <% if current_user && !current_user.sign_in_count.blank? && current_user.sign_in_count == 1 && session[:tour].blank? %> <%...
ruby-on-rails-4,devise,devise-confirmable
This is easy, you can just create a Mailer for this: class ConfirmationsMailer < Devise::Mailer default from: '<[email protected]>' def confirmation_instructions(record, token, opts={}) @token = token #you can add your instance variables here devise_mail(record, :confirmation_instructions, opts) end end And then just tell Devise to use this class: config/initializers/devise.rb Devise.setup do |config|...
ruby-on-rails,heroku,devise,devise-confirmable
The host value is being over written somewhere in your application. Good place to start with is your initializers directory. Like mentioned elsewhere, check setup_mail.rb under initializers. Goto Rails console and check the output of: ActionMailer::Base.default_url_options[:host] ...
ruby-on-rails,email,devise,token,devise-confirmable
i overrided the default logic from devise to generate the token and then used it to confirm and send email... in user.rb def create_password_reset_token Rails.logger.info "=======Creating reset password token=======" generate_token(:reset_password_token) ##unless self.reset_password_token.present? update_attribute(:reset_password_sent_at,Time.zone.now) save! ####refresh the user to get latest token which is used to reset password as find_by_reset_password_token self.reload...
ruby-on-rails,devise,devise-confirmable
According to this blog you need to change your Devise mailer to use @token instead of the old @resource.confirmation_token. This should fix any token-based confirmation problems you're having. This is likely to fix any unlock or reset password token problems as well. Here is your mailer updated code <p>Welcome <%=...
ruby-on-rails,ruby,devise,devise-confirmable
Devise is built for authentication, which is either a password, or a quick check with a social network that this is actually the person they claim to be. The email address is used as identification. If you just want to identify a person by their email, I suggest you create...
ruby-on-rails,ruby-on-rails-4,devise,devise-confirmable
First, add devise :confirmable to your models/user.rb devise :confirmable Then, do the migration as: rails g migration add_confirmable_to_devise Will generate db/migrate/YYYYMMDDxxx_add_confirmable_to_devise.rb. Add the following to it in order to do the migration. class AddConfirmableToDevise < ActiveRecord::Migration # Note: You can't use change, as User.update_all will fail in the down migration...
ruby-on-rails,ruby,devise,devise-confirmable
You can add attr_accessor like class User < SomeClass attr_accessor :skip_user_confirmation before_save :skip_confirm private def skip_confirm self.skip_confirmation! if self.skip_user_confirmation end end IN general it should work, but you might want to change it a little end And then in controller add to user_attributes key :skip_user_confirmation, which will be true or...
ruby-on-rails-4,devise,devise-confirmable
As you don't want them to be able to login until they've later been confirmed by an admin, you can use skip_confirmation_notification! instead of skip_confirmation!. This will create the confirmation token and the user will need to be confirmed, but it won't send the email notification to enable them to...