制定可确定没有最新版本的工作 [英] devise confirmable not working in newest version

查看:146
本文介绍了制定可确定没有最新版本的工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近升级从设计1.2至1.4.9,一切似乎除了我可证实模块工作。电子邮件的工作原理以及整个过程。但确认页面始终是空白。它的工作原理,并确认的电子邮件帐户,但它不会将用户重定向并抛出一个406错误。它做了同样的虚假确认尝试。

路线似乎做工精细,我在我的用户模型可证实规定,并没有别的改变。

任何想法?我失去了我需要更新1.4.9一些设置或东西吗?

更新

这似乎是与正在生成的URL中的问题。对于一些未知的原因,它是prepending与用户名的确认网址是什么?并且导致它打破。但我仍然不知道如何解决它。

<一个href=\"http://localhost:5000/users/confirmation.someusername?confirmation_token=R7apAPhC5c3rszvhsowp\">http://localhost:5000/users/confirmation.someusername?confirmation_token=R7apAPhC5c3rszvhsowp

在上面的URL中的用户名导致程序无法工作。

我检查了1.2新版本的控制器之间的差异(工作)和

1.2

 #GET /资源/确认?confirmation_token = ABCDEF
  高清节目
    self.resource = resource_class.confirm_by_token(PARAMS [:confirmation_token])    如果resource.errors.empty?
      set_flash_message:通知:确定
      sign_in_and_redirect(RESOURCE_NAME,资源)
    其他
      render_with_scope:新
    结束
  结束

1.4.9

 #GET /资源/确认?confirmation_token = ABCDEF
  高清节目
    self.resource = resource_class.confirm_by_token(PARAMS [:confirmation_token])    如果resource.errors.empty?
      set_flash_message(:通知:确认)如果is_navigational_format?
      sign_in(RESOURCE_NAME,资源)
      respond_with_navigational(资源){redirect_to的after_confirmation_path_for(RESOURCE_NAME,资源)}
    其他
      respond_with_navigational(resource.errors,:状态=&GT;:unprocessable_entity){render_with_scope:新}
    结束
  结束  保护    #再发送确认指令之后,所使用的路径。
    高清after_resending_confirmation_instructions_path_for(RESOURCE_NAME)
      new_session_path(RESOURCE_NAME)
    结束    #确认后使用的路径。
    高清after_confirmation_path_for(RESOURCE_NAME,资源)
      after_sign_in_path_for(资源)
    结束

错误

 入门GET/users/confirmation.sdfsdfsd?confirmation_token=vmxmx73xvM7sUfcvH9CX为127.0.0.1在2011-10-31 13时30分33秒+0100
  处理由设计:: ConfirmationsController#显示为
  参数:{confirmation_token=&gt;中vmxmx73xvM7sUfcvH9CX}
  SQL(1.1ms)SELECT a.attname,format_type(a.atttypid,a.atttypmod),d.adsrc,a.attnotnull
 从pg_attribute里一个LEFT JOIN pg_attrdefð
 ON a.attrelid = d.adrelid AND a.attnum = d.adnum
 WHERE a.attrelid ='用户':: regclass的
 和a.attnum&GT; 0并且不a.attisdropped
 ORDER BY a.attnum  用户负载(1.2ms的)选择用户。* FROM用户WHERE用户。confirmation_token=vmxmx73xvM7sUfcvH9CX'限制1
  SQL(为0.7m​​s)SELECT a.attname,format_type(a.atttypid,a.atttypmod),d.adsrc,a.attnotnull
 从pg_attribute里一个LEFT JOIN pg_attrdefð
 ON a.attrelid = d.adrelid AND a.attnum = d.adnum
 WHERE a.attrelid ='用户':: regclass的
 和a.attnum&GT; 0并且不a.attisdropped
 ORDER BY a.attnum已完成406在28ms不接受


解决方案

看看,看看,如果你复制的设计有意见,他们可能会过时的。

我也有类似的问题在越来越多的用户ID我的网址,有利于 confirmation_url 的设计不再使用 user_confirmation_url (为1.0 ?,但它仍然工作有点更长),所以你可能会选择删除您的自定义设计的意见或更新网址帮手。

I recently upgraded from Devise 1.2 to 1.4.9 and everything seems to work except my confirmable module. Email works as well as the entire process. But the confirmation page is always blank. It works and it confirms the email account, but it does not redirect the user and throws a 406 error. It does the same for false confirmation attempts.

Routes seem to work fine, I have confirmable specified in my user model, and nothing else has changed.

Any ideas? Am I missing some settings or something I need to update for 1.4.9?

UPDATE

It seems to be a problem with the URL being generated. For some unknown reason it is prepending the confirmations URL with the user name? and that is causing it to break. But i'm still not sure how to fix it.

http://localhost:5000/users/confirmation.someusername?confirmation_token=R7apAPhC5c3rszvhsowp

The username in the URL above causes the process not to work.

I checked the diff between the controller in 1.2 (which works) and the new version.

1.2

  # GET /resource/confirmation?confirmation_token=abcdef
  def show
    self.resource = resource_class.confirm_by_token(params[:confirmation_token])

    if resource.errors.empty?
      set_flash_message :notice, :confirmed
      sign_in_and_redirect(resource_name, resource)
    else
      render_with_scope :new
    end
  end

1.4.9

  # GET /resource/confirmation?confirmation_token=abcdef
  def show
    self.resource = resource_class.confirm_by_token(params[:confirmation_token])

    if resource.errors.empty?
      set_flash_message(:notice, :confirmed) if is_navigational_format?
      sign_in(resource_name, resource)
      respond_with_navigational(resource){ redirect_to after_confirmation_path_for(resource_name, resource) }
    else
      respond_with_navigational(resource.errors, :status => :unprocessable_entity){ render_with_scope :new }
    end
  end

  protected

    # The path used after resending confirmation instructions.
    def after_resending_confirmation_instructions_path_for(resource_name)
      new_session_path(resource_name)
    end

    # The path used after confirmation.
    def after_confirmation_path_for(resource_name, resource)
      after_sign_in_path_for(resource)
    end

error

Started GET "/users/confirmation.sdfsdfsd?confirmation_token=vmxmx73xvM7sUfcvH9CX" for 127.0.0.1 at 2011-10-31 13:30:33 +0100
  Processing by Devise::ConfirmationsController#show as 
  Parameters: {"confirmation_token"=>"vmxmx73xvM7sUfcvH9CX"}
  SQL (1.1ms)   SELECT a.attname, format_type(a.atttypid, a.atttypmod), d.adsrc, a.attnotnull
 FROM pg_attribute a LEFT JOIN pg_attrdef d
 ON a.attrelid = d.adrelid AND a.attnum = d.adnum
 WHERE a.attrelid = '"users"'::regclass
 AND a.attnum > 0 AND NOT a.attisdropped
 ORDER BY a.attnum

  User Load (1.2ms)  SELECT "users".* FROM "users" WHERE "users"."confirmation_token" = 'vmxmx73xvM7sUfcvH9CX' LIMIT 1
  SQL (0.7ms)   SELECT a.attname, format_type(a.atttypid, a.atttypmod), d.adsrc, a.attnotnull
 FROM pg_attribute a LEFT JOIN pg_attrdef d
 ON a.attrelid = d.adrelid AND a.attnum = d.adnum
 WHERE a.attrelid = '"users"'::regclass
 AND a.attnum > 0 AND NOT a.attisdropped
 ORDER BY a.attnum

Completed 406 Not Acceptable in 28ms

解决方案

Look and see if you copied the have devise views, they may be out of date.

I had a similar issue getting odd user ids in my url, devise no longer uses user_confirmation_url in favor of confirmation_url (as of 1.0?, but it still worked a bit longer) so you might either delete your custom devise views or update the url helper.

这篇关于制定可确定没有最新版本的工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆