簡體   English   中英

Grails Spring Security Facebook登錄錯誤

[英]grails spring security facebook login error

不知道為什么會這樣,它在兩個星期前成功了。 這是異常日志:

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
} 

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM