Commit 466cec23 authored by Geo Perez's avatar Geo Perez

Debug Provider

parent e9c72cf8
namespace Unosquare.PassCore.Web.Helpers
{
using Unosquare.PassCore.Web.Models;
internal class DebugPasswordChangeProvider : IPasswordChangeProvider
{
public ApiErrorItem PerformPasswordChange(ChangePasswordModel model)
{
switch (model.Username)
{
case "pass":
return null;
case "error":
return new ApiErrorItem { ErrorType = ApiErrorType.GeneralFailure, ErrorCode = ApiErrorCode.Generic, Message = "Error" };
case "notfound":
return new ApiErrorItem { ErrorType = ApiErrorType.GeneralFailure, ErrorCode = ApiErrorCode.UserNotFound, Message = "Invalid Username or Password" };
}
}
}
}
......@@ -68,7 +68,11 @@ namespace Unosquare.PassCore.Web
services.Configure<AppSettings>(Configuration.GetSection(nameof(AppSettings)));
services.AddApplicationInsightsTelemetry(Configuration);
services.AddMvc();
#if DEBUG
services.AddSingleton<IPasswordChangeProvider, DebugPasswordChangeProvider>();
#else
services.AddSingleton<IPasswordChangeProvider, PasswordChangeProvider>();
#endif
}
/// <summary>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment