search searcho Mortgage n
osearchs Mortgage l Houseloanmortgageloans a
mo Houseloanmortgageloans t Szh asearche Site o House n 1s1a Mortgage c Loan searche Loans rsearchh House searcho Houseloanmortgageloans t Loans asearche s Mortgage arc House Loan Ssearcht Map
s
a1c1 Loan M
r Loans ga House esearch searchzsearch Map M Houseloanmortgageloans r Mortgage gsearchgsearch
sesearchrDHH 近期push了一个非常酷的feature, Signed cookies and permanent cookies,让你轻松的授权永久性cookies。
在这之前,代码应该是这样的写法:
cookies[:user_preference] = {}
现在已经不需要那么写了
cookies.permanent[:user_preference] = @current_user.preferences
如果你看过 Pratik Naik的 Railssummit演示,他曾谈到为实现“Remember me”的功能使用ActiveSupport::ActiveSupport::MessageVerifier。dhh的push很好的解决的这一点。
user.rb的模型中加入以下代码:
# User.rb
def self.authenticated_with_token(id, stored_salt)
u = find_by_id(user_id)
u && u.salt == stored_salt ? u : nil
end
当用户点击 “Remember me”的check box, 确保以下将会被执行:
cookies.permanent.signed[:remember_me] = [current_user.id, current_user.salt]
以上代码将会用 ActionController::Base.cookie_verifier_secret的secret specified来授权一个永久性的cookie,如果你还没有定义 cookie_verifier_secret, 那么可以在initializers中定义。
现在可以使用cookie这么登录了:
user = User.authenticated_with_token(*cookies.signed[:remember_me])
在这种特殊情况下,cookie值中使用salt是非常重要的, 为了确保用户在修改密码的时候 cookie 是无效的。
本文翻译自 Pratik Naik 的文章。 在此特别感谢 Pratik Naik。
Some time ago, I did need to buy a house for my business but I did not have enough cash and could not purchase anything. Thank heaven my colleague proposed to get the mortgage loans at trustworthy creditors. Thus, I did so and was happy with my small business loan.
My advise to you is that I will unremarkably strive to equip idea that provides total value & benefit to you all the time you come to this page. Everytime you visit here I want you to feel that it's time well spent. . I find it very profitable especially when you need
There is no matter if people are distinguished in buy research papers or sample essay performing, they would need prove their writing skills in any case. Thus to buy essay papers at the business writing service will be the great way out.
When it comes to articles submission, people, generally, don't realize where to begin! Nevertheless, I don't bother just about that because I understand that