mirror of
				https://github.com/optim-enterprises-bv/databunker.git
				synced 2025-10-31 01:47:57 +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) | 		returnError(w, r, "bad mode", 405, nil, event) | ||||||
| 		return | 		return | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	brief = normalizeBrief(brief) | 	brief = normalizeBrief(brief) | ||||||
| 	if isValidBrief(brief) == false { | 	if isValidBrief(brief) == false { | ||||||
| 		returnError(w, r, "bad brief format", 405, nil, event) | 		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) | 	exists, err := e.db.checkLegalBasis(brief) | ||||||
| 	if err != nil { | 	if err != nil { | ||||||
| 		returnError(w, r, "internal error", 405, nil, event) | 		returnError(w, r, "internal error", 405, err, event) | ||||||
| 		return | 		return | ||||||
| 	} | 	} | ||||||
| 	if exists == false { | 	if exists == false { | ||||||
| 		returnError(w, r, "not found", 405, nil, event) | 		returnError(w, r, "not found", 404, nil, event) | ||||||
| 		return	 | 		return | ||||||
| 	} | 	} | ||||||
| 	 |  | ||||||
| 	userTOKEN := "" | 	userTOKEN := "" | ||||||
| 	if mode == "token" { | 	if mode == "token" { | ||||||
| 		if enforceUUID(w, address, event) == false { | 		if enforceUUID(w, address, event) == false { | ||||||
| 			return | 			return | ||||||
| 		} | 		} | ||||||
| 		userBson, _ := e.db.lookupUserRecord(address) | 		userBson, err := e.db.lookupUserRecord(address) | ||||||
| 		if userBson == nil { | 		if err != nil || userBson == nil { | ||||||
| 			returnError(w, r, "internal error", 405, nil, event) | 			returnError(w, r, "internal error", 405, err, event) | ||||||
| 			return | 			return | ||||||
| 		} | 		} | ||||||
| 		if e.enforceAuth(w, r, event) == "" { | 		if e.enforceAuth(w, r, event) == "" { | ||||||
| @@ -51,7 +49,11 @@ func (e mainEnv) agreementAccept(w http.ResponseWriter, r *http.Request, ps http | |||||||
| 		} | 		} | ||||||
| 		userTOKEN = address | 		userTOKEN = address | ||||||
| 	} else { | 	} 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 { | 		if userBson != nil { | ||||||
| 			userTOKEN = userBson["token"].(string) | 			userTOKEN = userBson["token"].(string) | ||||||
| 			event.Record = userTOKEN | 			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) | 	lbasis, err := e.db.getLegalBasis(brief) | ||||||
| 	if err != nil { | 	if err != nil { | ||||||
| 		returnError(w, r, "internal error", 405, nil, event) | 		returnError(w, r, "internal error", 405, err, event) | ||||||
| 		return | 		return | ||||||
| 	} | 	} | ||||||
| 	if lbasis == nil { | 	if lbasis == nil { | ||||||
| 		returnError(w, r, "not  found", 405, nil, event) | 		returnError(w, r, "not  found", 405, nil, event) | ||||||
| 		return	 | 		return	 | ||||||
| 	} | 	} | ||||||
| 	 |  | ||||||
| 	userTOKEN := "" | 	userTOKEN := "" | ||||||
| 	authResult := "" | 	authResult := "" | ||||||
| 	if mode == "token" { | 	if mode == "token" { | ||||||
|   | |||||||
| @@ -62,3 +62,7 @@ func (e mainEnv) pluginUserDelete(pluginid, userTOKEN) { | |||||||
| 	// not implemented | 	// 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 { | 	} else { | ||||||
| 		if mode == "phone" || mode == "email" { | 		if mode == "email" { | ||||||
| 			notifyURL := e.conf.Notification.NotificationURL | 			//notifyURL := e.conf.Notification.NotificationURL | ||||||
| 			notifyBadLogin(notifyURL, mode, address) | 			//notifyBadLogin(notifyURL, mode, address) | ||||||
|  | 			e.pluginUserLookup(address) | ||||||
| 			returnError(w, r, "record not found", 405, errors.New("record not found"), event) | 			returnError(w, r, "record not found", 405, errors.New("record not found"), event) | ||||||
| 			return | 			return | ||||||
| 		} | 		} | ||||||
|   | |||||||
| @@ -236,12 +236,12 @@ if (conf["custom_css_link"]) { | |||||||
|                         xhr.onload = function () { |                         xhr.onload = function () { | ||||||
|                             if (xhr.status === 200) { |                             if (xhr.status === 200) { | ||||||
|                                 document.location = "/site/login.html"; |                                 document.location = "/site/login.html"; | ||||||
|                             } else if (conf["MagicLookup"]) { |                             } else /* if (conf["MagicLookup"]) */ { | ||||||
|                                 //error |                                 //error | ||||||
|                                 var loading = document.getElementById('loading'); |                                 var loading = document.getElementById('loading'); | ||||||
|                                 loading.style.display = "block"; |                                 loading.style.display = "block"; | ||||||
|                                 lookupCount = 5; |                                 lookupCount = 5; | ||||||
|                                 lookupTimer = setInterval(lookupUser, 500, url); |                                 lookupTimer = setInterval(lookupUser, 2500, url); | ||||||
|                             } |                             } | ||||||
|                         } |                         } | ||||||
|                         xhr.send(); |                         xhr.send(); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 root
					root