Exemplo n.º 1
0
        public override void Init()
        {
            base.Init();
            _recaptchaService    = App.GetService <IRecaptchaService>();
            _loginLog            = App.GetService <ILoginLogService>();
            _sessionService      = App.GetService <IUserSessionService>();
            _incidentLog         = App.GetService <IIncidentLogService>();
            _notificationService = App.GetService <INotificationService>();
            // automatically create notification service if it is not found - to ease upgrading after refactoring that introduced this service (Feb 2016)
            if (_notificationService == null)
            {
                _notificationService = NotificationService.Create(App);
            }
            // Password checker
            if (_settings.PasswordChecker == null)
            {
                _settings.PasswordChecker = new PasswordStrengthChecker(App);
            }
            IEncryptionService encrService = App.GetService <IEncryptionService>();

            Util.Check(encrService != null, "Failed to get encryption service.");
            if (!string.IsNullOrWhiteSpace(_settings.EncryptionChannelName))
            {
                Util.Check(encrService.IsRegistered(_settings.EncryptionChannelName),
                           "Encryption channel '{0}' for LoginModule is not registered in EncryptedDataModule.");
            }
            //Login failed trigger
            if (_incidentLog != null && _settings.LoginFailedTriggerSettings != null)
            {
                var trigger = new LoginFailedTrigger(App, _settings.LoginFailedTriggerSettings);
                _incidentLog.AddTrigger(trigger);
            }
        }
Exemplo n.º 2
0
 public override void Init()
 {
     base.Init();
       _recaptchaService = App.GetService<IRecaptchaService>();
       _loginLog = App.GetService<ILoginLogService>();
       _sessionService = App.GetService<IUserSessionService>();
       _incidentLog = App.GetService<IIncidentLogService>();
       _notificationService = App.GetService<INotificationService>();
       // automatically create notification service if it is not found - to ease upgrading after refactoring that introduced this service (Feb 2016)
       if (_notificationService == null)
     _notificationService = NotificationService.Create(App);
       // Password checker
       if(_settings.PasswordChecker == null)
     _settings.PasswordChecker = new PasswordStrengthChecker(App);
       IEncryptionService encrService = App.GetService<IEncryptionService>();
       Util.Check(encrService != null, "Failed to get encryption service."); //never happens, module requires EncryptedDataModule
       if (!string.IsNullOrWhiteSpace(_settings.EncryptionChannelName))
     Util.Check(encrService.IsRegistered(_settings.EncryptionChannelName),
       "Encryption channel '{0}' for LoginModule is not registered in EncryptedDataModule.");
       //Login failed trigger
       if(_incidentLog != null && _settings.LoginFailedTriggerSettings != null) {
     var trigger = new LoginFailedTrigger(App, _settings.LoginFailedTriggerSettings);
     _incidentLog.AddTrigger(trigger);
       }
 }