Rails 3&设计:与注册确认无效相关的通知

时间:2013-05-24 05:17:05

标签: devise ruby-on-rails-3.2 notifications

我正在使用设计我的Rails 3.2.9应用程序。注册后不会出现与确认相关的通知(如下面的devise.en.yml文件,en,devise,confirmmations)。注册后,用户将被重定向到登录页面,而不会发送任何通知,但会发送电子邮件。一旦用户点击电子邮件中的确认链接,他就会被重定向到应用程序的欢迎页面,同时没有任何关于登录或注册成功的通知

devise.en.yml:

en:
  devise:
    confirmations:#THESE ARE NOT WORKING
      confirmed: "Your account was successfully confirmed. You are now signed in."
      send_instructions: "You will receive an email with instructions about how to confirm your account in a few minutes."
      send_paranoid_instructions: "If your email address exists in our database, you will receive an email with instructions about how to confirm your account in a few minutes."
    failure:#WORKS
      already_authenticated: "You are already signed in."
      inactive: "Your account was not activated yet."
      invalid: "Invalid email or password."
      invalid_token: "Invalid authentication token."
      locked: "Your account is locked."
      not_found_in_database: "Invalid email or password."
      timeout: "Your session expired, please sign in again to continue."
      unauthenticated: "You need to sign in or sign up before continuing."
      unconfirmed: "You have to confirm your account before continuing."
    mailer:
      confirmation_instructions:
        subject: "Confirmation instructions"
      reset_password_instructions:
        subject: "Reset password instructions"
      unlock_instructions:
        subject: "Unlock Instructions"
     #some code..

修改

en:
  devise:
    confirmations:
      confirmed: "Your account was successfully confirmed. You are now signed in."
      send_instructions: "You will receive an email with instructions about how to confirm your account in a few minutes."
      send_paranoid_instructions: "If your email address exists in our database, you will receive an email with instructions about how to confirm your account in a few minutes."
    failure:
      already_authenticated: "You are already signed in."
      inactive: "Your account was not activated yet."
      invalid: "Invalid email or password."
      invalid_token: "Invalid authentication token."
    -----------#SOME CODE---------------
    user_registrations:
      user:
        destroyed: "Bye! Your account was successfully cancelled. We hope to see you again soon."
        signed_up: "Welcome! You have signed up successfully."
        signed_up_but_inactive: "You have signed up successfully. However, we could not sign you in because your account is not yet activated."
        signed_up_but_locked: "You have signed up successfully. However, we could not sign you in because your account is locked."
        signed_up_but_unconfirmed: "A message with a confirmation link has been sent to your email address. Please open the link to activate your account."
        update_needs_confirmation: "You updated your account successfully, but we need to verify your new email address. Please check your email and click on the confirm link to finalize confirming your new email address."
        updated: "You updated your account successfully."
     -----------#SOME CODE---------------

1 个答案:

答案 0 :(得分:0)

您必须在application.html.erb中添加以下行:

<p class="notice"><%= notice %></p>
<p class="alert"><%= alert %></p>