public async Task <IActionResult> Login(PageModel <LoginModel> pageModel)
        {
            try
            {
                //log in with ldap
                try
                {
                    var ldapUser = authService.Login(pageModel.DataModel.Account, pageModel.DataModel.Password);
                    if (ldapUser == null)
                    {
                        throw new MemberAccessException(Text.Account_or_password_is_incorrect);
                    }

                    UserModel userModel = new UserModel(ldapUser);

                    var user = await userLogic.GetAsync(pageModel.DataModel.Account, configuration["MediaFolderPath"]);

                    if (user == null)
                    {
                        userModel = await userLogic.AddAsync
                                    (
                            userModel,
                            configuration["MediaFolderPath"],
                            configuration["PrefixPhotoProfileName"]
                                    );
                    }
                    else
                    {
                        if (user.Status != StatusOptions.Actived)
                        {
                            throw new UnauthorizedAccessException(Text.This_account_has_been_disabled);
                        }
                        //le role et le status reste ce qui a été défini dans biblio
                        userModel.Id     = user.Id;
                        userModel.Status = user.Status;
                        userModel.Role   = user.Role;
                        userModel        = await userLogic.SetAsync
                                           (
                            userModel,
                            configuration["MediaFolderPath"],
                            configuration["PrefixPhotoProfileName"],
                            true
                                           );
                    }

                    ProfileModel profileModel = new ProfileModel
                                                (
                        userModel
                                                );

                    userLogic.SignIn
                    (
                        profileModel,
                        Request.HttpContext
                    );
                }
                catch (LdapException ex)
                {
                    if (ex.ResultCode == 49)
                    {
                        throw new MemberAccessException(Text.Account_or_password_is_incorrect);
                    }
                    throw ex;
                }
                catch (UnauthorizedAccessException ex)
                {
                    throw ex;
                }
                catch (Exception ex)
                {
                    loggerFactory.CreateLogger(ex.GetType()).LogError($"{ex}\n\n");
                    var profileModel = await userLogic.LoginAsync
                                       (
                        pageModel.DataModel,
                        Request.HttpContext,
                        configuration["MediaFolderPath"]
                                       );
                }
                if (!string.IsNullOrEmpty(pageModel.ReturnUrl))
                {
                    return(Redirect(pageModel.ReturnUrl));
                }
                return(RedirectToAction("Index", "Home"));
            }
            catch (MemberAccessException ex)
            {
                TempData["MessageType"] = MessageOptions.Warning;
                TempData["Message"]     = ex.Message;
            }
            catch (UnauthorizedAccessException ex)
            {
                TempData["MessageType"] = MessageOptions.Warning;
                TempData["Message"]     = ex.Message;
            }
            catch (Exception ex)
            {
                loggerFactory.CreateLogger(ex.GetType()).LogError($"{ex}\n\n");
                TempData["MessageType"] = MessageOptions.Warning;
                TempData["Message"]     = Text.An_error_occured;
            }
            return(View(pageModel));
        }