grails - Grails Spring Security Facebook登录错误

标签 grails facebook-login google-openid

不知道为什么会这样,它在两个星期前成功了。这是异常日志:

No signature of method: xxxxx.UserInfo.findAllByEmail() is applicable for argument        types: () values: []
Possible solutions: findAllByEmail([Ljava.lang.Object;). Stacktrace follows:
groovy.lang.MissingMethodException: 
No signature of method: xxxxxx.UserInfo.findAllByEmail() is applicable for argument types: () values: []
Possible solutions: findAllByEmail([Ljava.lang.Object;)
                at org.grails.datastore.gorm.GormStaticApi$_methodMissing_closure2.doCall(GormStaticApi.groovy:105)
                at xxxxxx.FacebookController.checkEmail(FacebookController.groovy:87)
                at xcompare.FacebookController$_closure2.doCall(FacebookController.groovy:49)
                at xxxxxxx.OpenIDFilter.doFilter(OpenIDFilter.groovy:64)
                at java.lang.Thread.run(Thread.java:662)

这是FacebookController.groovy的代码:
private boolean checkEmail(String email){
    def users = UserInfo.findAllByEmail(email)
    if(users){
        // email is not available
        return false;
    }
    return true;
 } 

这是UserInfo的代码:
class UserInfo extends SecUser {
Provider provider
String activationCode
String firstName
String lastName
String email
Boolean active
UserType type
Date dateCreated
Date lastUpdated
Category category

static constraints = {
    email unique:true, nullable:true, email:true
    provider nullable:true
    activationCode nullable:true
    firstName blank:true, nullable:true
    lastName blank:true, nullable:true
    category nullable:true      
}

String toString() {
    // normal user
    if(!openIds){
        return username
    }
    // openid user
    String name = "";
    if(firstName){
        name += firstName;
        if(lastName){
            name += " "+lastName;
        }
    }else{
        name = email;
    }
    return name;
}

}

最佳答案

我不确定,但这也许是因为email为空。因此,请尝试:

private boolean checkEmail(String email){
    if (!email) {
        //TODO don't think that it's what you want
        return true
    }
    int count = UserInfo.countByEmail(email)
    return count == 0
} 

关于grails - Grails Spring Security Facebook登录错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13464996/

相关文章:

google-openid - Google OpenID 唯一标识符问题

php - 如何在 PHP 中实现 Google OpenID 身份验证并在 Localhost 上进行测试

grails - grails gorm如何使用3表层次结构进行联接

ios - Facebook IOS SDK 4.8.0 登录后不返回应用程序

http - 如何编写原始的多部分SOAP HTTP消息以通过Grails输出

php - 如何支持使用Facebook账号登录(facebook-php-sdk-v4)

android - Facebook SDK 导入 Android Studio 并将其添加到我的应用程序中

openid - 如何从 Google 访问头像?

grails - 带Grails Spring Security Core 2.0RC4的Requestmap重定向循环

grails - Grails 2,战法-> java.lang.ClassNotFoundException:grails.test.mixin.services.ServiceUnitTestMixin