我正在尝试使用Grails Email Confirmation Plugin,但是我的应用程序旨在在根应用程序上下文中运行。它以localhost:8080/
而不是localhost:8080/appname
运行。该插件会发送一个类似于localhost:8080/appname/confirm/YbL4DRWapJjF...
的确认链接。当我删除/appname
时,链接可以正常工作。
有谁知道一种方法来配置插件,使其在链接中不包含应用程序名称,或者将/appname/confirm/{id}
映射到/confirm/{id}
最佳答案
这不是我最喜欢的解决方案(请参阅原始问题中的评论)。
我添加了以下网址映射...
class UrlMappings {
static mappings = {
...
"/appname/confirm/$id?"(controller: "user", action: "confirm")
...
}
}
然后在用户 Controller 中,添加了以下方法...
@Secured(["ROLE_USER","ROLE_ANONYMOUS"])
def confirm (String id) {
redirect(uri: "/confirm/$id")
}
关于email - Grails电子邮件确认插件假定上下文路径,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23728836/