mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-12-20 07:45:26 +03:00
rework build scripts
This commit is contained in:
@@ -528,28 +528,38 @@ namespace MediaBrowser.Server.Implementations.Library
|
||||
/// <returns>Task.</returns>
|
||||
public Task ResetPassword(User user)
|
||||
{
|
||||
return ChangePassword(user, string.Empty);
|
||||
return ChangePassword(user, GetSha1String(string.Empty));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Changes the password.
|
||||
/// </summary>
|
||||
/// <param name="user">The user.</param>
|
||||
/// <param name="newPassword">The new password.</param>
|
||||
/// <param name="newPasswordSha1">The new password sha1.</param>
|
||||
/// <returns>Task.</returns>
|
||||
public async Task ChangePassword(User user, string newPassword)
|
||||
/// <exception cref="System.ArgumentNullException">
|
||||
/// user
|
||||
/// or
|
||||
/// newPassword
|
||||
/// </exception>
|
||||
/// <exception cref="System.ArgumentException">Passwords for guests cannot be changed.</exception>
|
||||
public async Task ChangePassword(User user, string newPasswordSha1)
|
||||
{
|
||||
if (user == null)
|
||||
{
|
||||
throw new ArgumentNullException("user");
|
||||
}
|
||||
if (string.IsNullOrWhiteSpace(newPasswordSha1))
|
||||
{
|
||||
throw new ArgumentNullException("newPasswordSha1");
|
||||
}
|
||||
|
||||
if (user.ConnectLinkType.HasValue && user.ConnectLinkType.Value == UserLinkType.Guest)
|
||||
{
|
||||
throw new ArgumentException("Passwords for guests cannot be changed.");
|
||||
}
|
||||
|
||||
user.Password = string.IsNullOrEmpty(newPassword) ? GetSha1String(string.Empty) : GetSha1String(newPassword);
|
||||
user.Password = newPasswordSha1;
|
||||
|
||||
await UpdateUser(user).ConfigureAwait(false);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user