{"id":8316,"date":"2022-06-27T05:54:37","date_gmt":"2022-06-26T20:54:37","guid":{"rendered":"https:\/\/yumishin.com\/?p=8316"},"modified":"2022-06-27T05:54:37","modified_gmt":"2022-06-26T20:54:37","slug":"devise-7","status":"publish","type":"post","link":"https:\/\/yumishin.com\/?p=8316","title":{"rendered":"\u3010rails\u30fbdevise\u3011\u30a2\u30ab\u30a6\u30f3\u30c8\u30ed\u30c3\u30af\u3092\u884c\u3046\u969b\u306edevise.rb\u306e\u8a18\u8ff0"},"content":{"rendered":"<h2 id=\"i-0\">\u3010rails\u30fbdevise\u3011\u30a2\u30ab\u30a6\u30f3\u30c8\u30ed\u30c3\u30af\u3092\u5b9f\u88c5\u3059\u308b\u65b9\u6cd5<\/h2>\n<h3 id=\"i-1\">\u524d\u63d0<\/h3>\n<p>devise\u3092\u4f7f\u3063\u305fRails\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3092\u4f5c\u6210\u3057\u3066\u304a\u308a\u3001\u30ed\u30b0\u30a4\u30f3\u6a5f\u80fd\u304c\u5b9f\u88c5\u3055\u308c\u3066\u3044\u308b\u3053\u3068<\/p>\n<h3 id=\"i-2\">\u5b9f\u88c5\u624b\u9806<\/h3>\n<p>\u307e\u305a\u306f\u4ee5\u4e0b\u306econfig\/initializers\/devise.rb\u3092\u7de8\u96c6\u3059\u308b<\/p>\n<div class=\"pre_tag\"><span><i class=\"fa fa-code\"><\/i> \u30b3\u30fc\u30c9<\/span><\/p>\n<pre><code>  # ==&gt; Configuration for :lockable\n  # Defines which strategy will be used to lock an account.\n  # :failed_attempts = Locks an account after a number of failed attempts to sign in.\n  # :none            = No lock strategy. You should handle locking by yourself.\n  config.lock_strategy = :failed_attempts #\u3000\u30a2\u30ab\u30a6\u30f3\u30c8\u30ed\u30c3\u30af\u6a5f\u80fd\u3092\u4f7f\u7528\u3059\u308b\u304b\n\n  # Defines which key will be used when locking and unlocking an account\n  config.unlock_keys = [ :email ] # \u30ed\u30c3\u30af\u3001\u30a2\u30f3\u30ed\u30c3\u30af\u306b\u4f7f\u7528\u3059\u308b\u9805\u76ee\u3092\u6307\u5b9a\u3059\u308b\n\n  # Defines which strategy will be used to unlock an account.\n  # :email = Sends an unlock link to the user email\n  # :time  = Re-enables login after a certain amount of time (see :unlock_in below)\n  # :both  = Enables both strategies\n  # :none  = No unlock strategy. You should handle unlocking by yourself.\n  config.unlock_strategy = :email # \u30a2\u30f3\u30ed\u30c3\u30af\u3059\u308b\u65b9\u6cd5\u3092\u9078\u629e\u3002\u4eca\u56de\u306femail\u3092\u4f7f\u7528\n\n  # Number of authentication tries before locking an account if lock_strategy\n  # is failed attempts.\n  config.maximum_attempts = 5 # \u30a2\u30f3\u30ed\u30c3\u30af\u307e\u3067\u306e\u8a66\u884c\u30df\u30b9\u56de\u6570\n\n  # Time interval to unlock the account if :time is enabled as unlock_strategy.\n  config.unlock_in = 1.hour\u3000# \u3082\u3057\u30a2\u30ab\u30a6\u30f3\u30c8\u3092\u6642\u9593\u3067\u30a2\u30f3\u30ed\u30c3\u30af\u3059\u308b\u5834\u5408\u306f\u3001\u3053\u3061\u3089\u3082\u8a2d\u5b9a\n\n  # Warn on the last attempt before the account is locked.\n  config.last_attempt_warning = true # \u30a2\u30ab\u30a6\u30f3\u30c8\u30ed\u30c3\u30af\u524d\u306e\u6700\u5f8c\u306e\u8a66\u884c\u3067\u8b66\u544a\u3059\u308b\u304b\u9078\u629e\u3002\u4eca\u56de\u306f\u8b66\u544a\u3042\u308a\u3092\u8a2d\u5b9a<\/code><\/pre>\n<\/div>\n<p>\u3082\u3057lockable\u7528\u306e\u30ab\u30e9\u30e0\u304c\u8ffd\u52a0\u3055\u308c\u3066\u3044\u306a\u3044\u5834\u5408\u306f\u3001\u8ffd\u52a0\u3057\u307e\u3059\u3002<\/p>\n<p>\u203b\u307e\u305fmodel\u306b\u3082lockable\u3092\u8a18\u8f09\u3057\u307e\u3059\u3002<\/p>\n<p>\u203b\u6700\u5f8c\u30b5\u30fc\u30d0\u30fc\u3092\u4e00\u5ea6\u7acb\u3061\u4e0a\u3052\u76f4\u3055\u306a\u3044\u3068\u3001\u8a2d\u5b9a\u304c\u53cd\u6620\u3055\u308c\u306a\u3044\u3067\u4e88\u671f\u305b\u306c\u6319\u52d5\u3092\u3059\u308b\u6642\u304c\u3042\u308a\u307e\u3059\u3002\u30b5\u30fc\u30d0\u30fc\u3092\u7acb\u3061\u4e0a\u3052\u76f4\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<p>\u8a73\u7d30\u306f<a href=\"https:\/\/github.com\/heartcombo\/devise\/wiki\/How-To:-Add-:lockable-to-Users\">\u3053\u3061\u3089<\/a>\u304c\u308f\u304b\u308a\u3084\u3059\u3044\u306e\u3067\u3001\u305c\u3072\u53c2\u8003\u306b\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u3010rails\u30fbdevise\u3011\u30a2\u30ab\u30a6\u30f3\u30c8\u30ed\u30c3\u30af\u3092\u5b9f\u88c5\u3059\u308b\u65b9\u6cd5 \u524d\u63d0 devise\u3092\u4f7f\u3063\u305fRails\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3092\u4f5c\u6210\u3057\u3066\u304a\u308a\u3001\u30ed\u30b0\u30a4\u30f3\u6a5f\u80fd\u304c\u5b9f\u88c5\u3055\u308c\u3066\u3044\u308b\u3053\u3068 \u5b9f\u88c5\u624b\u9806 \u307e\u305a\u306f\u4ee5\u4e0b\u306econfig\/initializers\/ &#8230; <\/p>\n","protected":false},"author":1,"featured_media":8317,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[256],"tags":[],"class_list":{"0":"post-8316","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-it","8":"entry"},"_links":{"self":[{"href":"https:\/\/yumishin.com\/index.php?rest_route=\/wp\/v2\/posts\/8316","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/yumishin.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/yumishin.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/yumishin.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/yumishin.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=8316"}],"version-history":[{"count":1,"href":"https:\/\/yumishin.com\/index.php?rest_route=\/wp\/v2\/posts\/8316\/revisions"}],"predecessor-version":[{"id":8318,"href":"https:\/\/yumishin.com\/index.php?rest_route=\/wp\/v2\/posts\/8316\/revisions\/8318"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/yumishin.com\/index.php?rest_route=\/wp\/v2\/media\/8317"}],"wp:attachment":[{"href":"https:\/\/yumishin.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=8316"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/yumishin.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=8316"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/yumishin.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=8316"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}