Browse Source

Use valid-like emails in mock auth

master
Daniel Gyulai 4 years ago
parent
commit
10e807d187
  1. 21
      CoviDok/Controllers/AuthController.cs

21
CoviDok/Controllers/AuthController.cs

@ -20,12 +20,22 @@ namespace CoviDok.Controllers
public async Task<ActionResult<AuthIdentity>> PostLogin(AuthLogin authLogin)
{
AuthIdentity authIdentity = new AuthIdentity();
if (authLogin.Email == "a" && authLogin.Password == "a")
authIdentity.FirstName = "Sajt";
authIdentity.LastName = "Osperec";
authIdentity.Id = "asdfasdfadf"; //SessionID
if (authLogin.Email == "a@domain.tld" && authLogin.Password == "a")
{
authIdentity.Role = Role.Doc;
return authIdentity;
}
if (authLogin.Email == "b@domain.tld" && authLogin.Password == "b")
{
authIdentity.Role = Role.Ast;
return authIdentity;
}
if (authLogin.Email == "c@domain.tld" && authLogin.Password == "c")
{
authIdentity.FirstName = "Sajt";
authIdentity.LastName = "Osperec";
authIdentity.Id = "asdfasdfadf";
authIdentity.Role = Api.Role.Doc;
authIdentity.Role = Role.Par;
return authIdentity;
}
return Unauthorized();
@ -36,6 +46,7 @@ namespace CoviDok.Controllers
public async Task<ActionResult<GenericResponse>> PostRegister(AuthRegistration authRegistration)
{
// System.Diagnostics.Debug.WriteLine(authRegistration.ToString());
// Validate Email
GenericResponse genericResponse = new GenericResponse();
if (authRegistration.Email == "a")
{

Loading…
Cancel
Save