grails spring security facebook登录错误

时间:2012-11-20 00:48:02

标签: 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;
}

}

1 个答案:

答案 0 :(得分:0)

我不确定,但也许是因为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
}