What I want to do is basically Login and show the user the information related to something like a Dashboard.
for example, when you start a session in stackoverflow, it shows you the questions you have asked ... the same thing I want to do in my project
I'm working on ASP.NET with mvc 5
this is the User Model
public class Usuario
{
[Key]
public int Id { get; set; }
public Guid UsuarioGUID { get; set; }
[Required(ErrorMessage = "The field {0} is required")]
[MaxLength(35, ErrorMessage = "The maximun length for field {0} is {1} characters")]
[Display(Name = "Nombre Completo")]
public string Nombre { get; set; }
[Display(Name = "Imagen")]
[DataType(DataType.ImageUrl)]
public string Foto { get; set; }
[Display(Name = "Email")]
[StringLength(35)]
[Index("Usuario_Email_Index", IsUnique = true, Order = 1)]
public string Email { get; set; }
[Display(Name = "Puntos")]
public int Puntos { get; set; }
[Display(Name = "Tipo Usuario")]
public int TipoUsuarioId { get; set; }
[Display(Name = "Status")]
public int StatusId { get; set; }
public virtual ICollection<Mensaje> Mensajes{ get; set; }
}
this is the Message model
public class MensajeProveedor
{
[Key]
public int Id { get; set; }
[Display(Name ="Usuario")]
public int UsuarioId { get; set; }
[Required(ErrorMessage = "The field {0} is required")]
[MaxLength(280, ErrorMessage = "The maximun length for field {0} is {1} characters")]
[Display(Name = "Texto")]
public string Texto { get; set; }
[DataType(DataType.DateTime)]
[Display(Name = "Fecha Envio")]
public DateTime FechaEnvio { get; set; }
[DataType(DataType.DateTime)]
[Display(Name = "Fecha Lectura")]
public DateTime ? FechaLectura { get; set; }
[Display(Name = "Status")]
public int StatusId { get; set; }
public virtual Usuario Usuario { get; set; }
}
use external login authentication, that is, google authentication
[HttpPost]
[AllowAnonymous]
[ValidateAntiForgeryToken]
public async Task<ActionResult> ExternalLoginConfirmation(ExternalLoginConfirmationViewModel model, string returnUrl)
{
if (User.Identity.IsAuthenticated)
{
return RedirectToAction("Index", "Manage");
}
if (ModelState.IsValid)
{
// Obtener datos del usuario del proveedor de inicio de sesión externo
var info = await AuthenticationManager.GetExternalLoginInfoAsync();
if (info == null)
{
return View("ExternalLoginFailure");
}
var user = new ApplicationUser { UserName = model.Email, Email = model.Email };
var result = await UserManager.CreateAsync(user);
if (result.Succeeded)
{
result = await UserManager.AddLoginAsync(user.Id, info.Login);
if (result.Succeeded)
{
await SignInManager.SignInAsync(user, isPersistent: false, rememberBrowser: false);
return RedirectToLocal(returnUrl);
}
}
AddErrors(result);
}
ViewBag.ReturnUrl = returnUrl;
return View(model);
}