MCPcopy Index your code
hub / github.com/Threadfin/Threadfin / ChangeCredentials

Function ChangeCredentials

src/internal/authentication/authentication.go:386–410  ·  view source on GitHub ↗

ChangeCredentials : change credentials

(userID, username, password string)

Source from the content-addressed store, hash-verified

384
385// ChangeCredentials : change credentials
386func ChangeCredentials(userID, username, password string) (err error) {
387 err = checkInit()
388 if err != nil {
389 return
390 }
391
392 err = createError(032)
393
394 if userData, ok := data["users"].(map[string]interface{})[userID]; ok {
395 //var userData = tmp.(map[string]interface{})
396 var salt = userData.(map[string]interface{})["_salt"].(string)
397
398 if len(username) > 0 {
399 userData.(map[string]interface{})["_username"] = SHA256(username, salt)
400 }
401
402 if len(password) > 0 {
403 userData.(map[string]interface{})["_password"] = SHA256(password, salt)
404 }
405
406 err = saveDatabase(data)
407 }
408
409 return
410}
411
412// GetAllUserData : get all user data
413func GetAllUserData() (allUserData map[string]interface{}, err error) {

Callers 1

saveUserDataFunction · 0.92

Calls 4

checkInitFunction · 0.85
createErrorFunction · 0.85
SHA256Function · 0.85
saveDatabaseFunction · 0.85

Tested by

no test coverage detected