SEBWIN-369: Ensured quit link ignores trailing slash.
This commit is contained in:
parent
09b7da5eae
commit
7d8720d6a2
2 changed files with 16 additions and 4 deletions
|
@ -7,6 +7,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
using CefSharp;
|
using CefSharp;
|
||||||
using SafeExamBrowser.Browser.Contracts.Filters;
|
using SafeExamBrowser.Browser.Contracts.Filters;
|
||||||
using SafeExamBrowser.Browser.Events;
|
using SafeExamBrowser.Browser.Events;
|
||||||
|
@ -23,6 +24,7 @@ namespace SafeExamBrowser.Browser.Handlers
|
||||||
{
|
{
|
||||||
private IRequestFilter filter;
|
private IRequestFilter filter;
|
||||||
private ILogger logger;
|
private ILogger logger;
|
||||||
|
private string quitUrlPattern;
|
||||||
private ResourceHandler resourceHandler;
|
private ResourceHandler resourceHandler;
|
||||||
private BrowserSettings settings;
|
private BrowserSettings settings;
|
||||||
|
|
||||||
|
@ -81,11 +83,21 @@ namespace SafeExamBrowser.Browser.Handlers
|
||||||
|
|
||||||
private bool IsQuitUrl(IRequest request)
|
private bool IsQuitUrl(IRequest request)
|
||||||
{
|
{
|
||||||
var isQuitUrl = settings.QuitUrl?.Equals(request.Url, StringComparison.OrdinalIgnoreCase) == true;
|
var isQuitUrl = false;
|
||||||
|
|
||||||
if (isQuitUrl)
|
if (!string.IsNullOrWhiteSpace(settings.QuitUrl))
|
||||||
{
|
{
|
||||||
logger.Debug($"Detected quit URL '{request.Url}'.");
|
if (quitUrlPattern == default(string))
|
||||||
|
{
|
||||||
|
quitUrlPattern = Regex.Escape(settings.QuitUrl.TrimEnd('/')) + @"\/?";
|
||||||
|
}
|
||||||
|
|
||||||
|
isQuitUrl = Regex.IsMatch(request.Url, quitUrlPattern, RegexOptions.IgnoreCase);
|
||||||
|
|
||||||
|
if (isQuitUrl)
|
||||||
|
{
|
||||||
|
logger.Debug($"Detected quit URL '{request.Url}'.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return isQuitUrl;
|
return isQuitUrl;
|
||||||
|
|
|
@ -89,7 +89,7 @@ namespace SafeExamBrowser.SystemComponents
|
||||||
{
|
{
|
||||||
var process = new Process();
|
var process = new Process();
|
||||||
|
|
||||||
process.StartInfo.Arguments = string.Format("/c \"wmic useraccount where name='{0}' get sid\"", userName);
|
process.StartInfo.Arguments = $"/c \"wmic useraccount where name='{userName}' get sid\"";
|
||||||
process.StartInfo.CreateNoWindow = true;
|
process.StartInfo.CreateNoWindow = true;
|
||||||
process.StartInfo.FileName = "cmd.exe";
|
process.StartInfo.FileName = "cmd.exe";
|
||||||
process.StartInfo.RedirectStandardOutput = true;
|
process.StartInfo.RedirectStandardOutput = true;
|
||||||
|
|
Loading…
Reference in a new issue