|
@@ -131,15 +131,29 @@ func (s *NodeServiceServer) Login(ctx context.Context, req *nodepb.Object) (*nod
|
|
if err != nil {
|
|
if err != nil {
|
|
return nil, err
|
|
return nil, err
|
|
}
|
|
}
|
|
|
|
+ var found = false
|
|
for _, value := range collection {
|
|
for _, value := range collection {
|
|
if err = json.Unmarshal([]byte(value), &result); err != nil {
|
|
if err = json.Unmarshal([]byte(value), &result); err != nil {
|
|
continue // finish going through nodes
|
|
continue // finish going through nodes
|
|
}
|
|
}
|
|
if result.ID == nodeID && result.Network == network {
|
|
if result.ID == nodeID && result.Network == network {
|
|
|
|
+ found = true
|
|
break
|
|
break
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ if !found {
|
|
|
|
+ deletedNode, err := database.FetchRecord(database.DELETED_NODES_TABLE_NAME, nodeID)
|
|
|
|
+ if err != nil {
|
|
|
|
+ err = errors.New("node not found")
|
|
|
|
+ return nil, err
|
|
|
|
+ }
|
|
|
|
+ if err = json.Unmarshal([]byte(deletedNode), &result); err != nil {
|
|
|
|
+ err = errors.New("node data corrupted")
|
|
|
|
+ return nil, err
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
//compare password from request to stored password in database
|
|
//compare password from request to stored password in database
|
|
//might be able to have a common hash (certificates?) and compare those so that a password isn't passed in in plain text...
|
|
//might be able to have a common hash (certificates?) and compare those so that a password isn't passed in in plain text...
|
|
//TODO: Consider a way of hashing the password client side before sending, or using certificates
|
|
//TODO: Consider a way of hashing the password client side before sending, or using certificates
|