Local Passwords validation
This commit is contained in:
parent
ce8f3ebce0
commit
8132db37d0
163 changed files with 1812 additions and 4772 deletions
|
|
@ -65,9 +65,9 @@ namespace Yavsc.Helpers
|
|||
return sb.ToString();
|
||||
}
|
||||
|
||||
public static UserDirectoryInfo GetUserFiles(string userName, string subdir)
|
||||
public static UserDirectoryInfo GetUserFiles(string userId, string subdir)
|
||||
{
|
||||
UserDirectoryInfo di = new UserDirectoryInfo(UserFilesDirName, userName, subdir);
|
||||
UserDirectoryInfo di = new UserDirectoryInfo(UserFilesDirName, userId, subdir);
|
||||
return di;
|
||||
}
|
||||
public static bool IsRegularFile(string userName, string subdir)
|
||||
|
|
@ -82,7 +82,7 @@ namespace Yavsc.Helpers
|
|||
|
||||
public static char[] AlfaNum = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789".ToCharArray();
|
||||
// Only accept descent remote file names
|
||||
public static char[] ValidFileNameChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-=_~. %#".ToCharArray();
|
||||
public static char[] ValidFileNameChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-=_~. %#@".ToCharArray();
|
||||
|
||||
// Estimate signature file name format
|
||||
public static Func<string, string, long, string>
|
||||
|
|
|
|||
|
|
@ -23,12 +23,13 @@ namespace Yavsc.ViewModels.UserFiles
|
|||
{
|
||||
|
||||
}
|
||||
public UserDirectoryInfo(string userReposPath, string username, string path)
|
||||
|
||||
public UserDirectoryInfo(string userReposPath, string userId, string path)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(username))
|
||||
if (string.IsNullOrWhiteSpace(userId))
|
||||
throw new NotSupportedException("No user name, no user dir.");
|
||||
UserName = username;
|
||||
var finalPath = path == null ? username : Path.Combine(username, path);
|
||||
UserName = userId;
|
||||
var finalPath = path == null ? userId : Path.Combine(userId, path);
|
||||
if (!finalPath.IsValidYavscPath())
|
||||
throw new InvalidOperationException(
|
||||
$"File name contains invalid chars ({finalPath})");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue