Rails 3 提供了 match
方法供我们自定义 routes,然而我们要小心使用它以避免“跨站脚本攻击”(XSS Attack)。比如像这样的 routes:
注:(r3 代表 Rails 3,r4 代表 Rails 4)
# routes.rb
# Chinese (China) translations for Devise(3.5.2) | |
# by Kenrick-Zhou (https://github.com/Kenrick-Zhou) | |
# https://gist.github.com/Kenrick-Zhou/7909822 | |
zh-CN: | |
devise: | |
confirmations: | |
confirmed: "您的帐号已经确认,您现在已登录。" | |
send_instructions: "几分钟后,您将收到确认帐号的电子邮件。" | |
send_paranoid_instructions: "如果您的邮箱存在于我们的数据库中,您将收到一封确认账号的邮件。" |
[General] | |
loglevel = notify | |
skip-proxy = 127.0.0.1, 192.168.0.0/16, 10.0.0.0/8, 172.16.0.0/12, 100.64.0.0/10, localhost, *.local, ::ffff:0:0:0:0/1, ::ffff:128:0:0:0/1 | |
bypass-tun = 192.168.0.0/16, 10.0.0.0/8, 172.16.0.0/12 | |
# dns-server = 119.29.29.29,223.5.5.5,114.114.115.115 | |
# external-controller-access = [email protected]:6155 | |
# ipv6 = true | |
// REMEMBER TO CHANGE THE external-controller-access' PASSWORD |