mirror of
https://github.com/optim-enterprises-bv/databunker.git
synced 2025-10-30 17:37:50 +00:00
lookup for new users
This commit is contained in:
@@ -20,7 +20,6 @@ func (e mainEnv) agreementAccept(w http.ResponseWriter, r *http.Request, ps http
|
||||
returnError(w, r, "bad mode", 405, nil, event)
|
||||
return
|
||||
}
|
||||
|
||||
brief = normalizeBrief(brief)
|
||||
if isValidBrief(brief) == false {
|
||||
returnError(w, r, "bad brief format", 405, nil, event)
|
||||
@@ -28,22 +27,21 @@ func (e mainEnv) agreementAccept(w http.ResponseWriter, r *http.Request, ps http
|
||||
}
|
||||
exists, err := e.db.checkLegalBasis(brief)
|
||||
if err != nil {
|
||||
returnError(w, r, "internal error", 405, nil, event)
|
||||
returnError(w, r, "internal error", 405, err, event)
|
||||
return
|
||||
}
|
||||
if exists == false {
|
||||
returnError(w, r, "not found", 405, nil, event)
|
||||
return
|
||||
returnError(w, r, "not found", 404, nil, event)
|
||||
return
|
||||
}
|
||||
|
||||
userTOKEN := ""
|
||||
if mode == "token" {
|
||||
if enforceUUID(w, address, event) == false {
|
||||
return
|
||||
}
|
||||
userBson, _ := e.db.lookupUserRecord(address)
|
||||
if userBson == nil {
|
||||
returnError(w, r, "internal error", 405, nil, event)
|
||||
userBson, err := e.db.lookupUserRecord(address)
|
||||
if err != nil || userBson == nil {
|
||||
returnError(w, r, "internal error", 405, err, event)
|
||||
return
|
||||
}
|
||||
if e.enforceAuth(w, r, event) == "" {
|
||||
@@ -51,7 +49,11 @@ func (e mainEnv) agreementAccept(w http.ResponseWriter, r *http.Request, ps http
|
||||
}
|
||||
userTOKEN = address
|
||||
} else {
|
||||
userBson, _ := e.db.lookupUserRecordByIndex(mode, address, e.conf)
|
||||
userBson, err := e.db.lookupUserRecordByIndex(mode, address, e.conf)
|
||||
if err != nil {
|
||||
returnError(w, r, "internal error", 405, err, event)
|
||||
return
|
||||
}
|
||||
if userBson != nil {
|
||||
userTOKEN = userBson["token"].(string)
|
||||
event.Record = userTOKEN
|
||||
@@ -158,14 +160,13 @@ func (e mainEnv) agreementWithdraw(w http.ResponseWriter, r *http.Request, ps ht
|
||||
}
|
||||
lbasis, err := e.db.getLegalBasis(brief)
|
||||
if err != nil {
|
||||
returnError(w, r, "internal error", 405, nil, event)
|
||||
returnError(w, r, "internal error", 405, err, event)
|
||||
return
|
||||
}
|
||||
if lbasis == nil {
|
||||
returnError(w, r, "not found", 405, nil, event)
|
||||
return
|
||||
}
|
||||
|
||||
userTOKEN := ""
|
||||
authResult := ""
|
||||
if mode == "token" {
|
||||
|
||||
@@ -62,3 +62,7 @@ func (e mainEnv) pluginUserDelete(pluginid, userTOKEN) {
|
||||
// not implemented
|
||||
}
|
||||
|
||||
func (e mainEnv) pluginUserLookup(email string) {
|
||||
// not implemented
|
||||
}
|
||||
|
||||
|
||||
@@ -322,9 +322,10 @@ func (e mainEnv) userPrelogin(w http.ResponseWriter, r *http.Request, ps httprou
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if mode == "phone" || mode == "email" {
|
||||
notifyURL := e.conf.Notification.NotificationURL
|
||||
notifyBadLogin(notifyURL, mode, address)
|
||||
if mode == "email" {
|
||||
//notifyURL := e.conf.Notification.NotificationURL
|
||||
//notifyBadLogin(notifyURL, mode, address)
|
||||
e.pluginUserLookup(address)
|
||||
returnError(w, r, "record not found", 405, errors.New("record not found"), event)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -236,12 +236,12 @@ if (conf["custom_css_link"]) {
|
||||
xhr.onload = function () {
|
||||
if (xhr.status === 200) {
|
||||
document.location = "/site/login.html";
|
||||
} else if (conf["MagicLookup"]) {
|
||||
} else /* if (conf["MagicLookup"]) */ {
|
||||
//error
|
||||
var loading = document.getElementById('loading');
|
||||
loading.style.display = "block";
|
||||
lookupCount = 5;
|
||||
lookupTimer = setInterval(lookupUser, 500, url);
|
||||
lookupTimer = setInterval(lookupUser, 2500, url);
|
||||
}
|
||||
}
|
||||
xhr.send();
|
||||
|
||||
Reference in New Issue
Block a user