Skip to content

Commit

Permalink
Merge pull request #339 from Elenpay/settlement_user_name
Browse files Browse the repository at this point in the history
Settlement view in NG
  • Loading branch information
AleksKSoftware authored Nov 13, 2023
2 parents 316b27f + 02f988f commit a0071c5
Show file tree
Hide file tree
Showing 2 changed files with 332 additions and 305 deletions.
17 changes: 15 additions & 2 deletions src/Helpers/ValidationHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,13 @@ public static void ValidateUsername(ValidatorEventArgs obj, List<ApplicationUser
obj.Status = ValidationStatus.Error;
return;
}

if (users.Any(user => user.UserName.Equals(obj.Value) && currentUserId != user.Id))
{
obj.ErrorText = "A user with the same username already exists";
obj.Status = ValidationStatus.Error;
return;
}

}

public static void ValidateChannelCapacity(ValidatorEventArgs obj)
Expand Down Expand Up @@ -108,7 +108,6 @@ public static void ValidateXPUB(ValidatorEventArgs obj)
obj.ErrorText = "The XPUB field cannot be empty";
obj.Status = ValidationStatus.Error;
}

}

public static void ValidatePubKey(ValidatorEventArgs obj, List<Node> nodes, string currentPubKey)
Expand All @@ -120,6 +119,7 @@ public static void ValidatePubKey(ValidatorEventArgs obj, List<Node> nodes, stri
obj.Status = ValidationStatus.Error;
return;
}

if (nodes.Any(node => node.PubKey.Equals(obj.Value) && currentPubKey != node.PubKey))
{
obj.ErrorText = "A node with the same pubkey already exists";
Expand Down Expand Up @@ -153,4 +153,17 @@ public static bool ValidateXPUB(string xpub)

return result;
}

public static bool IsValidEmail(string email)
{
try
{
var addr = new System.Net.Mail.MailAddress(email);
return addr.Address == email;
}
catch
{
return false;
}
}
}
Loading

0 comments on commit a0071c5

Please sign in to comment.