public bool Login(ILogonToRepository repository, bool firstAttempt = true)
        {
            ModalBlock.Value.ShowModalBlock();
            var autentificationModel = new AutentificationDialogViewModel(firstAttempt);

            if (_dialogService.PromptUser(Resources.Login, Resources.EnterCredentials,
                                          null,
                                          autentificationModel,
                                          DialogButton.OK,
                                          DialogButton.OK, DialogButton.Cancel) == DialogButton.OK)
            {
                var authentificationDetails = new AuthentificationDetails(repository)
                {
                    User     = autentificationModel.User.Value,
                    Password = autentificationModel.Password.Value
                };

                if (authentificationDetails.Logon())
                {
                    return(true);
                }

                _logger.AddLogEntry(DateTime.Now, TraceEventType.Error, SystemLogSources.System,
                                    repository.LastException.Message, repository.LastException.StackTrace);
                return(Login(repository, false));
            }

            _logger.AddLogEntry(TraceEventType.Information, SystemLogSources.System, Resources.LoginFailed);

            return(false);
        }
Beispiel #2
0
 public AuthentificationDetails(ILogonToRepository logonToRepository)
 {
     _logonToRepository = logonToRepository;
 }