行动邮件问题

时间:2018-07-15 09:56:36

标签: ruby-on-rails ruby ruby-on-rails-5

我使用Ruby on Rails开发了一个新的Web应用程序,并引入了“ devise” gem来注册和配置用户帐户。现在,我们面临着“未发送配置电子邮件问题”。该程序已在网络上正常完成,但是未发送配置电子邮件,则用户无法登录此应用程序。我想知道如何解决此问题。

以下是应用程序运行期间的控制台消息。(秘密密码被屏蔽。)

Started POST "/users" for 127.0.0.1 at 2018-07-15 18:32:41 +0900
Processing by Users::RegistrationsController#create as HTML
 Parameters: {"utf8"=>"✓", "authenticity_token"=>"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", "user"=>{"email"=>"aaaaa@gmail.com", "password"=>"[FILTERED]", "password_confirmation"=>"[FILTERED]"}, "commit"=>"Sign up"}
  (0.2ms)  BEGIN
 ↳ app/controllers/users/registrations_controller.rb:14
 User Exists (0.3ms)  SELECT  1 AS one FROM `users` WHERE `users`.`email` = BINARY 'aaaaa@gmail.com' LIMIT 1
 ↳ app/controllers/users/registrations_controller.rb:14
 User Create (0.4ms)  INSERT INTO `users` (`email`, `encrypted_password`, `confirmation_token`, `confirmation_sent_at`, `created_at`, `updated_at`) VALUES ('aaaaa@gmail.com', 'zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz', '2018-07-15 09:32:41', '2018-07-15 09:32:41', '2018-07-15 09:32:41')
 ↳ app/controllers/users/registrations_controller.rb:14
  (3.9ms)  COMMIT
 ↳ app/controllers/users/registrations_controller.rb:14
 Rendering users/mailer/confirmation_instructions.html.erb
 Rendered users/mailer/confirmation_instructions.html.erb (0.8ms)
Redirected to http://localhost:3000/
Completed 302 Found in 1861ms (ActiveRecord: 4.8ms)


Started GET "/" for 127.0.0.1 at 2018-07-15 18:32:43 +0900
Processing by HomeController#index as HTML
 Rendering home/index.html.erb within layouts/application
 Rendered home/index.html.erb within layouts/application (0.4ms)
Completed 200 OK in 29ms (Views: 28.0ms | ActiveRecord: 0.0ms)

此外,此配置系统使用 Gmail 客户端。我获得了运行该程序的密码并进行了注册,但默认文件中的“ users / mailer / confirmation_instructions.html.erb”没有任何更改。

这是/app/controllers/users/registrations_controller.rb文件。

# frozen_string_literal: true

class Users::RegistrationsController < Devise::RegistrationsController
  before_action :configure_sign_up_params, only: [:create]
  before_action :configure_account_update_params, only: [:update]

  #GET /resource/sign_up
  def new
    super
  end

  #POST /resource
  def create
    super
  end

  #GET /resource/edit
  def edit
    super
  end

  #PUT /resource
  def update
    super
  end

  #DELETE /resource
  def destroy
    super
  end

  #GET /resource/cancel
  #Forces the session data which is usually expired after sign
  #in to be expired now. This is useful if the user wants to
  #cancel oauth signing in/up in the middle of the process,
  #removing all OAuth session data.
  def cancel
    super
  end

  protected

 # If you have extra params to permit, append them to the sanitizer.
  def configure_sign_up_params
    devise_parameter_sanitizer.permit(:sign_up, keys: [:attribute])
  end

 # If you have extra params to permit, append them to the sanitizer.
  def configure_account_update_params
    devise_parameter_sanitizer.permit(:account_update, keys: [:attribute])
  end

 # The path used after sign up.
  def after_sign_up_path_for(resource)
    super(resource)
  end

 # The path used after sign up for inactive accounts.
  def after_inactive_sign_up_path_for(resource)
    super(resource)
  end
end

我期待听到很多建议。

0 个答案:

没有答案