Skip to content

Commit

Permalink
Add IsDefault property to LoginSettings and LoginSettingsDto
Browse files Browse the repository at this point in the history
This property determines if the current settings match the default settings. It has been added both to the DTO and the core settings class to keep the information consistent across the API and internal utility.
  • Loading branch information
pavelbannov committed Oct 25, 2024
1 parent f47f5c9 commit bd0d163
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
4 changes: 3 additions & 1 deletion web/ASC.Web.Api/ApiModels/ResponseDto/LoginSettingsDto.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,6 @@ public class LoginSettingsDto : IMapFrom<LoginSettings>
/// <summary>The time to wait for a response from the server</summary>
/// <type>System.Int32, System</type>
public int CheckPeriod { get; set; }
}

public bool IsDefault { get; set; }
}
9 changes: 9 additions & 0 deletions web/ASC.Web.Core/Utility/Settings/LoginSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,15 @@ public LoginSettings GetDefault()
CheckPeriod = 60
};
}

public bool IsDefault
{
get
{
var def = GetDefault();
return def.AttemptCount == AttemptCount && def.BlockTime == BlockTime && def.CheckPeriod == CheckPeriod;
}
}
}

public class LoginSettingsWrapper(LoginSettings loginSettings)
Expand Down

0 comments on commit bd0d163

Please sign in to comment.