I am building a web app using Ruby on Rails. I am using Mailgun as my mailer for this app. when i sign up using Facebook it works fine but when i try to sign up using email and password , i keep getting this error "554 Please activate your Mailgun account. Check your inbox or log in to your control panel to resend the activation email." I have already authorized the eamil to the Authorized Recipients in mailgun dashboard. Here's my code:
Registrations_controller.rb
class RegistrationsController < Devise::RegistrationsController
protected
def update_resource(resource,params)
resource.update_without_password(params)
end
end
config/environments/development.rb
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# In the development environment your application's code is reloaded on
# every request. This slows down response time but is perfect for development
# since you don't have to restart the web server when you make code changes.
config.cache_classes = false
# Do not eager load code on boot.
config.eager_load = false
# Show full error reports.
config.consider_all_requests_local = true
# Enable/disable caching. By default caching is disabled.
if Rails.root.join('tmp/caching-dev.txt').exist?
config.action_controller.perform_caching = true
config.cache_store = :memory_store
config.public_file_server.headers = {
'Cache-Control' => 'public, max-age=172800'
}
else
config.action_controller.perform_caching = false
config.cache_store = :null_store
end
# Don't care if the mailer can't send.
config.action_mailer.raise_delivery_errors = true
config.action_mailer.perform_caching = false
# Print deprecation notices to the Rails logger.
config.active_support.deprecation = :log
# Raise an error on page load if there are pending migrations.
config.active_record.migration_error = :page_load
# Debug mode disables concatenation and preprocessing of assets.
# This option may cause significant delays in view rendering with a large
# number of complex assets.
config.assets.debug = true
# Suppress logger output for asset requests.
config.assets.quiet = true
# Raises error for missing translations
# config.action_view.raise_on_missing_translations = true
# Use an evented file watcher to asynchronously detect changes in source code,
# routes, locales, etc. This feature depends on the listen gem.
config.file_watcher = ActiveSupport::EventedFileUpdateChecker
config.action_mailer.default_url_options = { host: 'localhost', port: 3000 }
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
address: 'smtp.mailgun.org',
port: 587,
domain: 'sandboxc77c3a9be90a494081dad1628d554337.mailgun.org',
authentication: 'plain',
user_name: 'postmaster@sandboxc77c3a9be90a494081dad1628d554337.mailgun.org',
password: 'password'
}
end
initalizers/devise.rb
# If true, requires any email changes to be confirmed (exactly the same way as
config.reconfirmable = false
config.mailer_sender = 'ahmed @ iGloo <no-reply@igloo.com>'
views/devise/registrations/new.html.erb
<div class="row">
<div class="col-md-4 col-md-offset-4">
<h2>Sign up</h2>
<%= form_for(resource, as: resource_name, url: registration_path(resource_name)) do |f| %>
<%= render 'layouts/shared/devisemes' %>
<div class="form-group">
<%= f.text_field :fullname, autofocus: true , placeholder: "Full Name" , class: "form-control" %>
</div>
<div class="form-group">
<%= f.email_field :email, autofocus: true , placeholder: "Email" , class: "form-control" %>
</div>
<div class="form-group">
<%= f.label :password %>
<% if @minimum_password_length %>
<em>(<%= @minimum_password_length %> characters minimum)</em>
<% end %><br />
<%= f.password_field :password, autocomplete: "off" , placeholder: "Password" , class: "form-control" %>
</div>
<div class="actions">
<%= f.submit "Sign up" , class: "btn btn-normal btn-block" %>
</div>
<% end %>
<%= link_to "Sign up with Facebook", user_facebook_omniauth_authorize_path , class: "btn btn-facebook btn-block"%>
<%= render "devise/shared/links" %>
</div>
</div>
Aucun commentaire:
Enregistrer un commentaire