[이민권] 계정 삭제

- 버그 수정
This commit is contained in:
2024-01-25 17:08:51 +09:00
parent cbcae00c77
commit 564a2ee14a

View File

@ -835,6 +835,28 @@ func (sh *serviceDescription) authorize(w http.ResponseWriter, r *http.Request)
logger.Println("session updated :", authtype, uid, session)
authInfo := sh.auths.Find(session)
if authInfo == nil {
// 잘못된 세션
logger.Println("authorize failed. fail to find authInfo :", session)
w.WriteHeader(http.StatusBadRequest)
return
}
//혹시 삭제 된 계정 아닌지 확인해본다.
link, err := sh.mongoClient.FindOne(CollectionLink, bson.M{
"platform": authtype,
"uid": uid,
}, options.FindOne().SetProjection(bson.M{
"_ts": 1,
}))
if link["_ts"] != nil {
delts := link["_ts"].(primitive.DateTime)
if !delts.Time().IsZero() {
// 삭제된 계정. 삭제 되었다고 알려주자
w.Header().Add("MG-ACCOUNT-DELETED", "TRUE")
}
}
bt, _ := json.Marshal(output)
w.Write(bt)
} else {
@ -887,6 +909,7 @@ func (sh *serviceDescription) delacc(w http.ResponseWriter, r *http.Request) {
return
}
originAuthType := sType
sType, sId, err := sh.getProviderInfo(sType, sId)
if err != nil {
logger.Error("delacc failed. getProviderInfo err :", err)
@ -924,7 +947,7 @@ func (sh *serviceDescription) delacc(w http.ResponseWriter, r *http.Request) {
"$set": primitive.M{"_ts": curtime},
}
if sType == AuthPlatformFirebaseAuth {
if originAuthType == AuthPlatformFirebaseAuth {
sh.mongoClient.Delete(CollectionFirebaseUserInfo, bson.M{
"firebaseuserid": sId,
})