Skip to content

Commit

Permalink
Fix en Home. Configuración completa del usuario.
Browse files Browse the repository at this point in the history
  • Loading branch information
mamorese committed Sep 1, 2019
1 parent c62cf0a commit 598af1d
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 5 deletions.
19 changes: 18 additions & 1 deletion Msn.InteropDemo.Web/Areas/Identity/Pages/Account/Login.cshtml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,15 @@ namespace Msn.InteropDemo.Web.Areas.Identity.Pages.Account
[AllowAnonymous]
public class LoginModel : PageModel
{
private readonly UserManager<Entities.Identity.SystemUser> _userManager;
private readonly SignInManager<Entities.Identity.SystemUser> _signInManager;
private readonly ILogger<LoginModel> _logger;

public LoginModel(SignInManager<Entities.Identity.SystemUser> signInManager, ILogger<LoginModel> logger)
public LoginModel(UserManager<Entities.Identity.SystemUser> userManager,
SignInManager<Entities.Identity.SystemUser> signInManager,
ILogger<LoginModel> logger)
{
_userManager = userManager;
_signInManager = signInManager;
_logger = logger;
}
Expand Down Expand Up @@ -77,9 +81,22 @@ public async Task<IActionResult> OnPostAsync(string returnUrl = null)
var result = await _signInManager.PasswordSignInAsync(Input.UserName, Input.Password, Input.RememberMe, lockoutOnFailure: false);
if (result.Succeeded)
{
var sysUser = _userManager.FindByNameAsync(Input.UserName).Result;
if (sysUser != null)
{
if (string.IsNullOrWhiteSpace(sysUser.Email) || !sysUser.CUIT.HasValue)
{
return RedirectToPage("Manage/Index", new { mustCongifAccount = true });
}
}

_logger.LogInformation("User logged in.");
return LocalRedirect(returnUrl);
}




//if (result.RequiresTwoFactor)
//{
// return RedirectToPage("./LoginWith2fa", new { ReturnUrl = returnUrl, RememberMe = Input.RememberMe });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,14 @@
}

<h4>@ViewData["Title"]</h4>

@if ((bool)ViewData["MustCongifAccount"])
{
<partial name="_MustConfigAccount" />
}

<partial name="_StatusMessage" for="StatusMessage" />

<div class="row">
<div class="col-md-6">
<form id="profile-form" method="post">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,10 @@ public class InputModel
public string CUIT { get; set; }
}

public async Task<IActionResult> OnGetAsync()
public async Task<IActionResult> OnGetAsync(bool mustCongifAccount = false)
{
ViewData.Add("MustCongifAccount", mustCongifAccount);

var user = await _userManager.GetUserAsync(User);
if (user == null)
{
Expand Down Expand Up @@ -120,7 +122,7 @@ public async Task<IActionResult> OnPostAsync()
await _userManager.UpdateAsync(user);
await _signInManager.RefreshSignInAsync(user);
StatusMessage = "Su cuenta ha sido actualizada.";
return RedirectToPage();
return RedirectToPage(new { mustCongifAccount = false });
}

public async Task<IActionResult> OnPostSendVerificationEmailAsync()
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@

<div class="alert alert-info alert-dismissible" role="alert">
<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>
Por favor, finalize la configuración de su cuenta ingresando su <b>Casilla de Correo</b> y su <b>CUIT</b>.
</div>
3 changes: 1 addition & 2 deletions Msn.InteropDemo.Web/Views/Home/Index.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@
ViewData["Title"] = "Inicio";
}


<div class="jumbotron">
<div class="container">
<h1 class="display-4">Open-RSD</h1>
<p>Este es un proyecto educativo, que demuestra cómo un sistema se conecta con la Red de Salud Digital, parte de la <a href="https://www.argentina.gob.ar/salud/digital" target="_blank">Estrategia de Salud Digital de la República Argentina.</a></p>
<p>Open-RSD contiene las funcionalidades básicas de un Índice Maestro de Pacientes y un
<p>Open-RSD contiene las funcionalidades básicas de un Índice Maestro de Pacientes y una Historia clínica electrónica.</p>
<p>Puede descargar el código fuente del GitHub de la DNSIS <a href="https://github.com/SALUD-AR/Open-RSD" target="_blank">Open-RSD</a></p>
<p><a class="btn btn-primary btn-lg" asp-action="BuscarPaciente" asp-controller="Pacientes" asp-area="Seguimiento">Ingresar &raquo;</a></p>
</div>
Expand Down

0 comments on commit 598af1d

Please sign in to comment.