0
私はgrails 3インターセプタを使って最初のログイン時にユーザメールをキャプチャしようとしていましたが、彼らはログインして、設定されたホームページではなく電子メールキャプチャフォームにリダイレクトされます。私は春のセキュリティを使用している場合は、関連情報です。私のコードスニペットは、私がこれまで行ってきたことを示しています。私の目標を達成するための簡単な方法や私が間違ったことがあるかどうか、私に助言してください。grails 3インターセプタを使用してフォームを実行し、grailsアプリケーションの通常の流れを再開する方法
class HomeInterceptor {
public HomeInterceptor() {
// match all requests except requests
// to the auth controller
matchAll().excludes(controller: 'logout')
.excludes(controller: 'login')
.excludes(controller: 'home')
.excludes(controller: 'user', action: 'userProfile')
.excludes(controller: 'user', action: 'showUserProfile')
}
boolean before() {
// if the user's email has not been captured,
// redirect to the user profile
def springSecurityService = AppHolder.bean(SpringSecurityService)
def loggedInUser = springSecurityService.currentUser as User
if (loggedInUser?.email == null){
flash.message = "Please enter your email before you can proceed"
redirect(controller: 'user', action: 'userProfile')
return false
}else {
return true
}
}
boolean after() { true }
void afterView() {
// no-op
}
}
おかげで、同じようにそれを試してみてください –