diff options
| author | dkanada <dkanada@users.noreply.github.com> | 2020-02-02 00:09:18 +0900 |
|---|---|---|
| committer | dkanada <dkanada@users.noreply.github.com> | 2020-02-02 00:09:18 +0900 |
| commit | 26dd67a441d251bef56c14d8058e7068e38e06af (patch) | |
| tree | be4c8f2f442d31d903a1175dd6cbdad44a2e6457 | |
| parent | 6341d986a95be928a85ecd81c08fefdc5c3ec3b6 (diff) | |
change authentication flow
| -rw-r--r-- | Emby.Server.Implementations/Session/SessionManager.cs | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/Emby.Server.Implementations/Session/SessionManager.cs b/Emby.Server.Implementations/Session/SessionManager.cs index ec3e87573..659483a36 100644 --- a/Emby.Server.Implementations/Session/SessionManager.cs +++ b/Emby.Server.Implementations/Session/SessionManager.cs @@ -1379,20 +1379,16 @@ namespace Emby.Server.Implementations.Session user = _userManager.GetUserByName(request.Username); } - if (user != null) + if (user == null) { - // TODO: Move this to userManager? - if (!string.IsNullOrEmpty(request.DeviceId) - && !_deviceManager.CanAccessDevice(user, request.DeviceId)) - { - throw new SecurityException("User is not allowed access from this device."); - } + AuthenticationFailed?.Invoke(this, new GenericEventArgs<AuthenticationRequest>(request)); + throw new SecurityException("Invalid username or password entered."); } - if (user == null) + if (!string.IsNullOrEmpty(request.DeviceId) + && !_deviceManager.CanAccessDevice(user, request.DeviceId)) { - AuthenticationFailed?.Invoke(this, new GenericEventArgs<AuthenticationRequest>(request)); - throw new SecurityException("Invalid user or password entered."); + throw new SecurityException("User is not allowed access from this device."); } if (enforcePassword) |
