public ResetUserPasswordCommandHandler(
     CofoundryDbContext dbContext,
     IMailService mailService,
     IDomainRepository domainRepository,
     IUserMailTemplateBuilderContextFactory userMailTemplateBuilderContextFactory,
     IUserMailTemplateBuilderFactory userMailTemplateBuilderFactory,
     IPermissionValidationService permissionValidationService,
     UserCommandPermissionsHelper userCommandPermissionsHelper,
     IUserAreaDefinitionRepository userAreaDefinitionRepository,
     IPasswordCryptographyService passwordCryptographyService,
     IPasswordGenerationService passwordGenerationService,
     IUserSecurityStampUpdateHelper userSecurityStampUpdateHelper,
     IUserContextCache userContextCache,
     IUserSummaryMapper userSummaryMapper,
     IMessageAggregator messageAggregator
     )
 {
     _dbContext        = dbContext;
     _mailService      = mailService;
     _domainRepository = domainRepository;
     _userMailTemplateBuilderContextFactory = userMailTemplateBuilderContextFactory;
     _userMailTemplateBuilderFactory        = userMailTemplateBuilderFactory;
     _permissionValidationService           = permissionValidationService;
     _userCommandPermissionsHelper          = userCommandPermissionsHelper;
     _userAreaDefinitionRepository          = userAreaDefinitionRepository;
     _passwordCryptographyService           = passwordCryptographyService;
     _passwordGenerationService             = passwordGenerationService;
     _userSecurityStampUpdateHelper         = userSecurityStampUpdateHelper;
     _userContextCache  = userContextCache;
     _userSummaryMapper = userSummaryMapper;
     _messageAggregator = messageAggregator;
 }
 public AddUserWithTemporaryPasswordCommandHandler(
     CofoundryDbContext dbContext,
     ICommandExecutor commandExecutor,
     IPasswordGenerationService passwordGenerationService,
     IMailService mailService,
     IQueryExecutor queryExecutor,
     IUserMailTemplateBuilderContextFactory userMailTemplateBuilderContextFactory,
     IUserMailTemplateBuilderFactory userMailTemplateBuilderFactory,
     IUserAreaDefinitionRepository userAreaDefinitionRepository,
     ITransactionScopeManager transactionScopeFactory,
     IUserDataFormatter userDataFormatter,
     IPasswordPolicyService passwordPolicyService
     )
 {
     _dbContext                             = dbContext;
     _commandExecutor                       = commandExecutor;
     _passwordGenerationService             = passwordGenerationService;
     _mailService                           = mailService;
     _queryExecutor                         = queryExecutor;
     _userMailTemplateBuilderContextFactory = userMailTemplateBuilderContextFactory;
     _userMailTemplateBuilderFactory        = userMailTemplateBuilderFactory;
     _userAreaDefinitionRepository          = userAreaDefinitionRepository;
     _transactionScopeFactory               = transactionScopeFactory;
     _userDataFormatter                     = userDataFormatter;
     _passwordPolicyService                 = passwordPolicyService;
 }
Пример #3
0
 public AccountController(ISessionManagementService sessionManagementService, ITutorRepository tutorRepository, IUserRepository userRepository, IPasswordGenerationService passwordGenerationService)
 {
     _sessionManagementService  = sessionManagementService;
     _tutorRepository           = tutorRepository;
     _userRepository            = userRepository;
     _passwordGenerationService = passwordGenerationService;
 }
Пример #4
0
 public ImportDataRepository(IPasswordGenerationService passwordGenerationService, IParentRepository parentRepository, IStudentRepository studentRepository, IEnrollRepository enrollRepository, IAcademicYearRepository academicYearRepository, IUserRepository userRepository)
 {
     _passwordGenerationService = passwordGenerationService;
     _parentRepository = parentRepository;
     _studentRepository = studentRepository;
     _enrollRepository = enrollRepository;
     _academicYearRepository = academicYearRepository;
     _userRepository = userRepository;
 }
Пример #5
0
 public ImportDataRepository(IPasswordGenerationService passwordGenerationService, IParentRepository parentRepository, IStudentRepository studentRepository, IEnrollRepository enrollRepository, IAcademicYearRepository academicYearRepository, IUserRepository userRepository)
 {
     _passwordGenerationService = passwordGenerationService;
     _parentRepository          = parentRepository;
     _studentRepository         = studentRepository;
     _enrollRepository          = enrollRepository;
     _academicYearRepository    = academicYearRepository;
     _userRepository            = userRepository;
 }
Пример #6
0
 public UserController(IUserRepository userRepository, IPasswordGenerationService passwordGenerationService,
                       IRoleRepository roleRepository, IEducationLevelRepository educationLevelRepository)
 {
     _userRepository            = userRepository;
     _passwordGenerationService = passwordGenerationService;
     _roleRepository            = roleRepository;
     _educationLevelRepository  = educationLevelRepository;
     _viewMessageLogic          = new ViewMessageLogic(this);
 }
Пример #7
0
 public GeneratorPageViewModel()
 {
     _passwordGenerationService = ServiceContainer.Resolve <IPasswordGenerationService>(
         "passwordGenerationService");
     _platformUtilsService = ServiceContainer.Resolve <IPlatformUtilsService>("platformUtilsService");
     PageTitle             = AppResources.PasswordGenerator;
     TypeOptions           = new List <string> {
         AppResources.Password, AppResources.Passphrase
     };
 }
        public GeneratorHistoryPageViewModel()
        {
            _platformUtilsService      = ServiceContainer.Resolve <IPlatformUtilsService>("platformUtilsService");
            _passwordGenerationService = ServiceContainer.Resolve <IPasswordGenerationService>(
                "passwordGenerationService");

            PageTitle   = AppResources.PasswordHistory;
            History     = new ExtendedObservableCollection <GeneratedPasswordHistory>();
            CopyCommand = new Command <GeneratedPasswordHistory>(CopyAsync);
        }
            public SliderViewCell(
                ToolsPasswordGeneratorPage page,
                IPasswordGenerationService passwordGenerationService,
                ISettings settings)
            {
                _page = page;
                _passwordGenerationService = passwordGenerationService;
                _settings = settings;

                var label = new Label
                {
                    FontSize          = Device.GetNamedSize(NamedSize.Medium, typeof(Label)),
                    Text              = AppResources.Length,
                    HorizontalOptions = LayoutOptions.Start,
                    VerticalOptions   = LayoutOptions.CenterAndExpand
                };

                LengthSlider = new Slider(5, 64, _settings.GetValueOrDefault(Constants.PasswordGeneratorLength, 10))
                {
                    HorizontalOptions = LayoutOptions.FillAndExpand,
                    VerticalOptions   = LayoutOptions.CenterAndExpand,
                    MaximumTrackColor = Color.LightGray,
                    MinimumTrackColor = Color.LightGray,
                };

                Value = new Label
                {
                    FontSize          = Device.GetNamedSize(NamedSize.Medium, typeof(Label)),
                    HorizontalOptions = LayoutOptions.End,
                    VerticalOptions   = LayoutOptions.CenterAndExpand,
                    Style             = (Style)Application.Current.Resources["text-muted"],
                    FontFamily        = Helpers.OnPlatform(iOS: "Menlo-Regular", Android: "monospace", Windows: "Courier"),
                };

                Value.SetBinding(Label.TextProperty, nameof(PasswordGeneratorPageModel.Length));

                var stackLayout = new StackLayout
                {
                    Orientation = StackOrientation.Horizontal,
                    Spacing     = 15,
                    Children    = { label, LengthSlider, Value },
                    Padding     = Helpers.OnPlatform(
                        iOS: new Thickness(15, 8),
                        Android: new Thickness(16, 10),
                        Windows: new Thickness(15, 8))
                };

                stackLayout.AdjustPaddingForDevice();
                if (Device.RuntimePlatform == Device.Android)
                {
                    label.TextColor = Color.Black;
                }

                View = stackLayout;
            }
Пример #10
0
        public ToolsPasswordGeneratorPage(Action <string> passwordValueAction = null)
        {
            _userDialogs = Resolver.Resolve <IUserDialogs>();
            _passwordGenerationService = Resolver.Resolve <IPasswordGenerationService>();
            _settings               = Resolver.Resolve <ISettings>();
            _clipboardService       = Resolver.Resolve <IClipboardService>();
            _googleAnalyticsService = Resolver.Resolve <IGoogleAnalyticsService>();
            _passwordValueAction    = passwordValueAction;

            Init();
        }
Пример #11
0
            public SliderViewCell(
                ToolsPasswordGeneratorPage page,
                IPasswordGenerationService passwordGenerationService,
                ISettings settings)
            {
                _page = page;
                _passwordGenerationService = passwordGenerationService;
                _settings = settings;

                var label = new Label
                {
                    FontSize          = Device.GetNamedSize(NamedSize.Medium, typeof(Label)),
                    Text              = "Length",
                    HorizontalOptions = LayoutOptions.Start,
                    VerticalOptions   = LayoutOptions.CenterAndExpand
                };

                LengthSlider = new Slider(5, 64, _settings.GetValueOrDefault(Constants.PasswordGeneratorLength, 10))
                {
                    HorizontalOptions = LayoutOptions.FillAndExpand,
                    VerticalOptions   = LayoutOptions.CenterAndExpand
                };

                Value = new Label
                {
                    FontSize          = Device.GetNamedSize(NamedSize.Medium, typeof(Label)),
                    HorizontalOptions = LayoutOptions.End,
                    VerticalOptions   = LayoutOptions.CenterAndExpand,
                    Style             = (Style)Application.Current.Resources["text-muted"]
                };

                Value.SetBinding <PasswordGeneratorPageModel>(Label.TextProperty, m => m.Length);

                LengthSlider.ValueChanged += Slider_ValueChanged;

                var stackLayout = new StackLayout
                {
                    Orientation = StackOrientation.Horizontal,
                    Spacing     = 15,
                    Children    = { label, LengthSlider, Value },
                    Padding     = Device.OnPlatform(
                        iOS: new Thickness(15, 8),
                        Android: new Thickness(16, 10),
                        WinPhone: new Thickness(15, 8))
                };

                stackLayout.AdjustPaddingForDevice();
                if (Device.OS == TargetPlatform.Android)
                {
                    label.TextColor = Color.Black;
                }

                View = stackLayout;
            }
Пример #12
0
 public AdministrativeController(IContactInformationRepository contactInformationRepository, IUserRepository userRepository,
                                 IRoleRepository roleRepository, IPasswordGenerationService passwordGenerationService, IPeopleWithUserRepository peopleWithUserRepository, IEducationLevelRepository educationLevelRepository)
 {
     _contactInformationRepository = contactInformationRepository;
     _userRepository            = userRepository;
     _passwordGenerationService = passwordGenerationService;
     _peopleWithUserRepository  = peopleWithUserRepository;
     _educationLevelRepository  = educationLevelRepository;
     _roleRepository            = roleRepository;
     _viewMessageLogic          = new ViewMessageLogic(this);
 }
Пример #13
0
 public DataImportService(IPasswordGenerationService passwordGenerationService, ITutorRepository tutorRepository,
                          IStudentRepository studentRepository, IUserRepository userRepository,
                          IRoleRepository roleRepository, IAcademicGradeRepository academicGradeRepository)
 {
     _passwordGenerationService = passwordGenerationService;
     _tutorRepository           = tutorRepository;
     _studentRepository         = studentRepository;
     _userRepository            = userRepository;
     _roleRepository            = roleRepository;
     _academicGradeRepository   = academicGradeRepository;
 }
Пример #14
0
        public ToolsPasswordGeneratorPage(Action <string> passwordValueAction = null, bool fromAutofill = false)
        {
            _passwordGenerationService = Resolver.Resolve <IPasswordGenerationService>();
            _settings               = Resolver.Resolve <ISettings>();
            _deviceActionService    = Resolver.Resolve <IDeviceActionService>();
            _googleAnalyticsService = Resolver.Resolve <IGoogleAnalyticsService>();
            _passwordValueAction    = passwordValueAction;
            _fromAutofill           = fromAutofill;

            Init();
        }
Пример #15
0
 public TeacherController(ITeacherRepository teacherRepository, IContactInformationRepository contactInformationRepository,
                          IUserRepository userRepository, IRoleRepository roleRepository, IPasswordGenerationService passwordGenerationService, IPeopleWithUserRepository peopleWithUserRepository)
 {
     _teacherRepository            = teacherRepository;
     _contactInformationRepository = contactInformationRepository;
     _userRepository            = userRepository;
     _passwordGenerationService = passwordGenerationService;
     _peopleWithUserRepository  = peopleWithUserRepository;
     _roleRepository            = roleRepository;
     _viewMessageLogic          = new ViewMessageLogic(this);
 }
Пример #16
0
 public AddCofoundryUserCommandHandler(
     ICommandExecutor commandExecutor,
     IPasswordCryptographyService passwordCryptographyService,
     IPasswordGenerationService passwordGenerationService,
     IMailService mailService
     )
 {
     _commandExecutor             = commandExecutor;
     _passwordCryptographyService = passwordCryptographyService;
     _passwordGenerationService   = passwordGenerationService;
     _mailService = mailService;
 }
Пример #17
0
 /// <summary>
 /// Initializes the ViewModel with the specified clipboard access.
 /// </summary>
 public PasswordGenViewModel(IPasswordGenerationService passwordService, ISensitiveClipboardService clipboardService)
 {
     ClipboardCopyCommand = new ActionCommand(
         async() =>
     {
         clipboardService.CopyCredential(
             await passwordService.Generate(GetCurrentRecipe()),
             ClipboardOperationType.Password
             );
     }
         );
 }
Пример #18
0
 protected BaseChangePasswordViewModel()
 {
     _platformUtilsService      = ServiceContainer.Resolve <IPlatformUtilsService>("platformUtilsService");
     _stateService              = ServiceContainer.Resolve <IStateService>("stateService");
     _policyService             = ServiceContainer.Resolve <IPolicyService>("policyService");
     _passwordGenerationService =
         ServiceContainer.Resolve <IPasswordGenerationService>("passwordGenerationService");
     _i18nService         = ServiceContainer.Resolve <II18nService>("i18nService");
     _cryptoService       = ServiceContainer.Resolve <ICryptoService>("cryptoService");
     _deviceActionService = ServiceContainer.Resolve <IDeviceActionService>("deviceActionService");
     _apiService          = ServiceContainer.Resolve <IApiService>("apiService");
     _syncService         = ServiceContainer.Resolve <ISyncService>("syncService");
 }
Пример #19
0
        public LoginSsoPageViewModel()
        {
            _deviceActionService       = ServiceContainer.Resolve <IDeviceActionService>("deviceActionService");
            _authService               = ServiceContainer.Resolve <IAuthService>("authService");
            _syncService               = ServiceContainer.Resolve <ISyncService>("syncService");
            _apiService                = ServiceContainer.Resolve <IApiService>("apiService");
            _passwordGenerationService =
                ServiceContainer.Resolve <IPasswordGenerationService>("passwordGenerationService");
            _cryptoFunctionService = ServiceContainer.Resolve <ICryptoFunctionService>("cryptoFunctionService");
            _platformUtilsService  = ServiceContainer.Resolve <IPlatformUtilsService>("platformUtilsService");
            _stateService          = ServiceContainer.Resolve <IStateService>("stateService");

            PageTitle    = AppResources.Bitwarden;
            LogInCommand = new Command(async() => await LogInAsync());
        }
Пример #20
0
        public SetPasswordPageViewModel()
        {
            _deviceActionService       = ServiceContainer.Resolve <IDeviceActionService>("deviceActionService");
            _apiService                = ServiceContainer.Resolve <IApiService>("apiService");
            _cryptoService             = ServiceContainer.Resolve <ICryptoService>("cryptoService");
            _platformUtilsService      = ServiceContainer.Resolve <IPlatformUtilsService>("platformUtilsService");
            _stateService              = ServiceContainer.Resolve <IStateService>("stateService");
            _policyService             = ServiceContainer.Resolve <IPolicyService>("policyService");
            _passwordGenerationService =
                ServiceContainer.Resolve <IPasswordGenerationService>("passwordGenerationService");
            _i18nService = ServiceContainer.Resolve <II18nService>("i18nService");

            PageTitle                    = AppResources.SetMasterPassword;
            TogglePasswordCommand        = new Command(TogglePassword);
            ToggleConfirmPasswordCommand = new Command(ToggleConfirmPassword);
            SubmitCommand                = new Command(async() => await SubmitAsync());
        }
Пример #21
0
 public AddUserCommandHandler(
     CofoundryDbContext dbContext,
     IQueryExecutor queryExecutor,
     IPasswordCryptographyService passwordCryptographyService,
     IPasswordGenerationService passwordGenerationService,
     IMailService mailService,
     UserCommandPermissionsHelper userCommandPermissionsHelper,
     IPermissionValidationService permissionValidationService,
     IUserAreaRepository userAreaRepository
     )
 {
     _dbContext     = dbContext;
     _queryExecutor = queryExecutor;
     _passwordCryptographyService = passwordCryptographyService;
     _mailService = mailService;
     _userCommandPermissionsHelper = userCommandPermissionsHelper;
     _permissionValidationService  = permissionValidationService;
     _userAreaRepository           = userAreaRepository;
     _passwordGenerationService    = passwordGenerationService;
 }
Пример #22
0
        protected override void Seed(MhotivoContext context)
        {
            if (context.Users.Any())
            {
                return;
            }
            _passwordGenerationService = new PreloadedPasswordsGenerationService(context);
            _areaRepository            = new EducationLevelRepository(context);
            _gradeRepository           = new GradeRepository(context);
            _courseRepository          = new CourseRepository(context, _areaRepository);
            _pensumRepository          = new PensumRepository(context);
            _academicYearRepository    = new AcademicYearRepository(context);
            var admin = new User
            {
                DisplayName = "Administrador",
                Email       = "*****@*****.**",
                Password    = "******",
                IsActive    = true,
                Role        = Roles.Administrador
            };

            admin.EncryptPassword();
            context.Users.AddOrUpdate(admin);
            context.SaveChanges();
            context.NotificationTypes.AddOrUpdate(new NotificationType {
                Id = 1, Description = "General"
            });
            context.NotificationTypes.AddOrUpdate(new NotificationType {
                Id = 2, Description = "Nivel De Educacion"
            });
            context.NotificationTypes.AddOrUpdate(new NotificationType {
                Id = 3, Description = "Grado"
            });
            context.NotificationTypes.AddOrUpdate(new NotificationType {
                Id = 4, Description = "Personal"
            });
            context.SaveChanges();
            DebuggingSeeder(context);
            context.SaveChanges();
        }
Пример #23
0
 private void ResolveServices()
 {
     _apiService                = ServiceContainer.Resolve <IApiService>("apiService");
     _userService               = ServiceContainer.Resolve <IUserService>("userService");
     _broadcasterService        = ServiceContainer.Resolve <IBroadcasterService>("broadcasterService");
     _messagingService          = ServiceContainer.Resolve <IMessagingService>("messagingService");
     _stateService              = ServiceContainer.Resolve <IStateService>("stateService");
     _lockService               = ServiceContainer.Resolve <ILockService>("lockService");
     _syncService               = ServiceContainer.Resolve <ISyncService>("syncService");
     _tokenService              = ServiceContainer.Resolve <ITokenService>("tokenService");
     _cryptoService             = ServiceContainer.Resolve <ICryptoService>("cryptoService");
     _cipherService             = ServiceContainer.Resolve <ICipherService>("cipherService");
     _folderService             = ServiceContainer.Resolve <IFolderService>("folderService");
     _settingsService           = ServiceContainer.Resolve <ISettingsService>("settingsService");
     _collectionService         = ServiceContainer.Resolve <ICollectionService>("collectionService");
     _searchService             = ServiceContainer.Resolve <ISearchService>("searchService");
     _authService               = ServiceContainer.Resolve <IAuthService>("authService");
     _platformUtilsService      = ServiceContainer.Resolve <IPlatformUtilsService>("platformUtilsService");
     _storageService            = ServiceContainer.Resolve <IStorageService>("storageService");
     _secureStorageService      = ServiceContainer.Resolve <IStorageService>("secureStorageService");
     _passwordGenerationService = ServiceContainer.Resolve <IPasswordGenerationService>(
         "passwordGenerationService");
 }
        public override void ViewDidLoad()
        {
            _passwordGenerationService = Resolver.Resolve <IPasswordGenerationService>();
            _settings = Resolver.Resolve <ISettings>();
            _googleAnalyticsService = Resolver.Resolve <IGoogleAnalyticsService>();

            NavItem.Title         = AppResources.PasswordGenerator;
            CancelBarButton.Title = AppResources.Cancel;
            SelectBarButton.Title = AppResources.Select;
            View.BackgroundColor  = new UIColor(red: 0.94f, green: 0.94f, blue: 0.96f, alpha: 1.0f);

            var descriptor = UIFontDescriptor.PreferredBody;

            PasswordLabel.Font                      = UIFont.FromName("Courier", descriptor.PointSize * 1.3f);
            PasswordLabel.LineBreakMode             = UILineBreakMode.TailTruncation;
            PasswordLabel.Lines                     = 1;
            PasswordLabel.AdjustsFontSizeToFitWidth = false;

            var controller = ChildViewControllers.LastOrDefault();

            if (controller != null)
            {
                OptionsTableViewController = controller as UITableViewController;
            }

            if (OptionsTableViewController != null)
            {
                OptionsTableViewController.TableView.RowHeight          = UITableView.AutomaticDimension;
                OptionsTableViewController.TableView.EstimatedRowHeight = 70;
                OptionsTableViewController.TableView.Source             = new TableSource(this);
                OptionsTableViewController.TableView.AllowsSelection    = true;
                OptionsTableViewController.View.BackgroundColor         = new UIColor(red: 0.94f, green: 0.94f, blue: 0.96f, alpha: 1.0f);
            }

            UppercaseCell.Switch.On = _settings.GetValueOrDefault(Constants.PasswordGeneratorUppercase, true);
            LowercaseCell.Switch.On = _settings.GetValueOrDefault(Constants.PasswordGeneratorLowercase, true);
            SpecialCell.Switch.On   = _settings.GetValueOrDefault(Constants.PasswordGeneratorSpecial, true);
            NumbersCell.Switch.On   = _settings.GetValueOrDefault(Constants.PasswordGeneratorNumbers, true);
            MinNumbersCell.Value    = _settings.GetValueOrDefault(Constants.PasswordGeneratorMinNumbers, 1);
            MinSpecialCell.Value    = _settings.GetValueOrDefault(Constants.PasswordGeneratorMinSpecial, 1);
            LengthCell.Value        = _settings.GetValueOrDefault(Constants.PasswordGeneratorLength, 10);

            UppercaseCell.ValueChanged  += Options_ValueChanged;
            LowercaseCell.ValueChanged  += Options_ValueChanged;
            NumbersCell.ValueChanged    += Options_ValueChanged;
            SpecialCell.ValueChanged    += Options_ValueChanged;
            MinNumbersCell.ValueChanged += Options_ValueChanged;
            MinSpecialCell.ValueChanged += Options_ValueChanged;
            LengthCell.ValueChanged     += Options_ValueChanged;

            // Adjust based on context password options
            if (Context.PasswordOptions != null)
            {
                if (Context.PasswordOptions.RequireDigits)
                {
                    NumbersCell.Switch.On      = true;
                    NumbersCell.Switch.Enabled = false;

                    if (MinNumbersCell.Value < 1)
                    {
                        MinNumbersCell.Value = 1;
                    }

                    MinNumbersCell.Stepper.MinimumValue = 1;
                }

                if (Context.PasswordOptions.RequireSymbols)
                {
                    SpecialCell.Switch.On      = true;
                    SpecialCell.Switch.Enabled = false;

                    if (MinSpecialCell.Value < 1)
                    {
                        MinSpecialCell.Value = 1;
                    }

                    MinSpecialCell.Stepper.MinimumValue = 1;
                }

                if (Context.PasswordOptions.MinLength < Context.PasswordOptions.MaxLength)
                {
                    if (Context.PasswordOptions.MinLength > 0 && Context.PasswordOptions.MinLength > LengthCell.Slider.MinValue)
                    {
                        if (LengthCell.Value < Context.PasswordOptions.MinLength)
                        {
                            LengthCell.Slider.Value = Context.PasswordOptions.MinLength;
                        }

                        LengthCell.Slider.MinValue = Context.PasswordOptions.MinLength;
                    }

                    if (Context.PasswordOptions.MaxLength > 5 && Context.PasswordOptions.MaxLength < LengthCell.Slider.MaxValue)
                    {
                        if (LengthCell.Value > Context.PasswordOptions.MaxLength)
                        {
                            LengthCell.Slider.Value = Context.PasswordOptions.MaxLength;
                        }

                        LengthCell.Slider.MaxValue = Context.PasswordOptions.MaxLength;
                    }
                }
            }

            GeneratePassword();
            _googleAnalyticsService.TrackExtensionEvent("GeneratedPassword");
            base.ViewDidLoad();
        }
Пример #25
0
        public App(AppOptions appOptions)
        {
            _appOptions                = appOptions ?? new AppOptions();
            _userService               = ServiceContainer.Resolve <IUserService>("userService");
            _broadcasterService        = ServiceContainer.Resolve <IBroadcasterService>("broadcasterService");
            _messagingService          = ServiceContainer.Resolve <IMessagingService>("messagingService");
            _stateService              = ServiceContainer.Resolve <IStateService>("stateService");
            _lockService               = ServiceContainer.Resolve <ILockService>("lockService");
            _syncService               = ServiceContainer.Resolve <ISyncService>("syncService");
            _tokenService              = ServiceContainer.Resolve <ITokenService>("tokenService");
            _cryptoService             = ServiceContainer.Resolve <ICryptoService>("cryptoService");
            _cipherService             = ServiceContainer.Resolve <ICipherService>("cipherService");
            _folderService             = ServiceContainer.Resolve <IFolderService>("folderService");
            _settingsService           = ServiceContainer.Resolve <ISettingsService>("settingsService");
            _collectionService         = ServiceContainer.Resolve <ICollectionService>("collectionService");
            _searchService             = ServiceContainer.Resolve <ISearchService>("searchService");
            _authService               = ServiceContainer.Resolve <IAuthService>("authService");
            _platformUtilsService      = ServiceContainer.Resolve <IPlatformUtilsService>("platformUtilsService");
            _storageService            = ServiceContainer.Resolve <IStorageService>("storageService");
            _secureStorageService      = ServiceContainer.Resolve <IStorageService>("secureStorageService");
            _passwordGenerationService = ServiceContainer.Resolve <IPasswordGenerationService>(
                "passwordGenerationService");
            _i18nService         = ServiceContainer.Resolve <II18nService>("i18nService") as MobileI18nService;
            _deviceActionService = ServiceContainer.Resolve <IDeviceActionService>("deviceActionService");

            Bootstrap();
            _broadcasterService.Subscribe(nameof(App), async(message) =>
            {
                if (message.Command == "showDialog")
                {
                    var details     = message.Data as DialogDetails;
                    var confirmed   = true;
                    var confirmText = string.IsNullOrWhiteSpace(details.ConfirmText) ?
                                      AppResources.Ok : details.ConfirmText;
                    Device.BeginInvokeOnMainThread(async() =>
                    {
                        if (!string.IsNullOrWhiteSpace(details.CancelText))
                        {
                            confirmed = await Current.MainPage.DisplayAlert(details.Title, details.Text, confirmText,
                                                                            details.CancelText);
                        }
                        else
                        {
                            await Current.MainPage.DisplayAlert(details.Title, details.Text, confirmText);
                        }
                        _messagingService.Send("showDialogResolve", new Tuple <int, bool>(details.DialogId, confirmed));
                    });
                }
                else if (message.Command == "locked")
                {
                    await LockedAsync(!(message.Data as bool?).GetValueOrDefault());
                }
                else if (message.Command == "lockVault")
                {
                    await _lockService.LockAsync(true);
                }
                else if (message.Command == "logout")
                {
                    if (Migration.MigrationHelpers.Migrating)
                    {
                        return;
                    }
                    Device.BeginInvokeOnMainThread(async() => await LogOutAsync(false));
                }
                else if (message.Command == "loggedOut")
                {
                    // Clean up old migrated key if they ever log out.
                    await _secureStorageService.RemoveAsync("oldKey");
                }
                else if (message.Command == "resumed")
                {
                    if (Device.RuntimePlatform == Device.iOS)
                    {
                        ResumedAsync();
                    }
                }
                else if (message.Command == "slept")
                {
                    if (Device.RuntimePlatform == Device.iOS)
                    {
                        await SleptAsync();
                    }
                }
                else if (message.Command == "migrated")
                {
                    await Task.Delay(1000);
                    await SetMainPageAsync();
                }
                else if (message.Command == "popAllAndGoToTabGenerator" ||
                         message.Command == "popAllAndGoToTabMyVault")
                {
                    Device.BeginInvokeOnMainThread(async() =>
                    {
                        if (Current.MainPage is TabsPage tabsPage)
                        {
                            while (tabsPage.Navigation.ModalStack.Count > 0)
                            {
                                await tabsPage.Navigation.PopModalAsync(false);
                            }
                            if (message.Command == "popAllAndGoToTabMyVault")
                            {
                                _appOptions.MyVaultTile = false;
                                tabsPage.ResetToVaultPage();
                            }
                            else
                            {
                                _appOptions.GeneratorTile = false;
                                tabsPage.ResetToGeneratorPage();
                            }
                        }
                    });
                }
            });
        }
Пример #26
0
 public LoginSystemUserQueryHandler(IBugLogDbContext context, IPasswordGenerationService passwordService, IJwtGeneratorService jwtService)
 {
     _context         = context;
     _passwordService = passwordService;
     _jwtService      = jwtService;
 }
Пример #27
0
 public RegisterSystemUserCommandHandler(IBugLogDbContext context, IPasswordGenerationService passwordService)
 {
     _context         = context;
     _passwordService = passwordService;
 }
Пример #28
0
        public async override void ViewDidLoad()
        {
            _passwordGenerationService = ServiceContainer.Resolve <IPasswordGenerationService>(
                "passwordGenerationService");

            BaseNavItem.Title         = AppResources.PasswordGenerator;
            BaseCancelButton.Title    = AppResources.Cancel;
            BaseSelectBarButton.Title = AppResources.Select;

            var descriptor = UIFontDescriptor.PreferredBody;

            BasePasswordLabel.Font                      = UIFont.FromName("Menlo-Regular", descriptor.PointSize * 1.3f);
            BasePasswordLabel.LineBreakMode             = UILineBreakMode.TailTruncation;
            BasePasswordLabel.Lines                     = 0;
            BasePasswordLabel.AdjustsFontSizeToFitWidth = false;
            BasePasswordLabel.TextColor                 = ThemeHelpers.TextColor;

            var controller = ChildViewControllers.LastOrDefault();

            if (controller != null)
            {
                OptionsTableViewController = controller as UITableViewController;
            }

            if (OptionsTableViewController != null)
            {
                OptionsTableViewController.TableView.RowHeight          = UITableView.AutomaticDimension;
                OptionsTableViewController.TableView.EstimatedRowHeight = 70;
                OptionsTableViewController.TableView.Source             = new TableSource(this);
                OptionsTableViewController.TableView.AllowsSelection    = true;
                OptionsTableViewController.View.BackgroundColor         = ThemeHelpers.BackgroundColor;
                OptionsTableViewController.TableView.SeparatorColor     = ThemeHelpers.SeparatorColor;
            }

            TypePickerCell.Items         = TypeOptions;
            TypePickerCell.ValueChanged += Type_ValueChanged;
            SetPassType();

            var(options, enforcedPolicyOptions) = await _passwordGenerationService.GetOptionsAsync();

            UppercaseCell.Switch.On = options.Uppercase.GetValueOrDefault();
            LowercaseCell.Switch.On = options.Lowercase.GetValueOrDefault(true);
            SpecialCell.Switch.On   = options.Special.GetValueOrDefault();
            NumbersCell.Switch.On   = options.Number.GetValueOrDefault();
            MinNumbersCell.Value    = options.MinNumber.GetValueOrDefault(1);
            MinSpecialCell.Value    = options.MinSpecial.GetValueOrDefault(1);
            LengthCell.Value        = options.Length.GetValueOrDefault(14);
            AmbiguousCell.Switch.On = options.Ambiguous.GetValueOrDefault();

            NumWordsCell.Value = options.NumWords.GetValueOrDefault(3);
            WordSeparatorCell.TextField.Text = options.WordSeparator ?? "";
            CapitalizeCell.Switch.On         = options.Capitalize.GetValueOrDefault();
            IncludeNumberCell.Switch.On      = options.IncludeNumber.GetValueOrDefault();

            UppercaseCell.ValueChanged  += Options_ValueChanged;
            LowercaseCell.ValueChanged  += Options_ValueChanged;
            NumbersCell.ValueChanged    += Options_ValueChanged;
            SpecialCell.ValueChanged    += Options_ValueChanged;
            MinNumbersCell.ValueChanged += Options_ValueChanged;
            MinSpecialCell.ValueChanged += Options_ValueChanged;
            LengthCell.ValueChanged     += Options_ValueChanged;
            AmbiguousCell.ValueChanged  += Options_ValueChanged;

            NumWordsCell.ValueChanged      += Options_ValueChanged;
            WordSeparatorCell.ValueChanged += Options_ValueChanged;
            CapitalizeCell.ValueChanged    += Options_ValueChanged;
            IncludeNumberCell.ValueChanged += Options_ValueChanged;

            // Adjust based on context password options
            if (PasswordOptions != null)
            {
                if (PasswordOptions.RequireDigits)
                {
                    NumbersCell.Switch.On      = true;
                    NumbersCell.Switch.Enabled = false;

                    if (MinNumbersCell.Value < 1)
                    {
                        MinNumbersCell.Value = 1;
                    }

                    MinNumbersCell.Stepper.MinimumValue = 1;
                }

                if (PasswordOptions.RequireSymbols)
                {
                    SpecialCell.Switch.On      = true;
                    SpecialCell.Switch.Enabled = false;

                    if (MinSpecialCell.Value < 1)
                    {
                        MinSpecialCell.Value = 1;
                    }

                    MinSpecialCell.Stepper.MinimumValue = 1;
                }

                if (PasswordOptions.MinLength < PasswordOptions.MaxLength)
                {
                    if (PasswordOptions.MinLength > 0 && PasswordOptions.MinLength > LengthCell.Slider.MinValue)
                    {
                        if (LengthCell.Value < PasswordOptions.MinLength)
                        {
                            LengthCell.Slider.Value = PasswordOptions.MinLength;
                        }

                        LengthCell.Slider.MinValue = PasswordOptions.MinLength;
                    }

                    if (PasswordOptions.MaxLength > 5 && PasswordOptions.MaxLength < LengthCell.Slider.MaxValue)
                    {
                        if (LengthCell.Value > PasswordOptions.MaxLength)
                        {
                            LengthCell.Slider.Value = PasswordOptions.MaxLength;
                        }

                        LengthCell.Slider.MaxValue = PasswordOptions.MaxLength;
                    }
                }
            }

            var task = GeneratePasswordAsync();

            base.ViewDidLoad();
        }
Пример #29
0
        public App(AppOptions appOptions)
        {
            _appOptions                = appOptions ?? new AppOptions();
            _userService               = ServiceContainer.Resolve <IUserService>("userService");
            _broadcasterService        = ServiceContainer.Resolve <IBroadcasterService>("broadcasterService");
            _messagingService          = ServiceContainer.Resolve <IMessagingService>("messagingService");
            _stateService              = ServiceContainer.Resolve <IStateService>("stateService");
            _lockService               = ServiceContainer.Resolve <ILockService>("lockService");
            _syncService               = ServiceContainer.Resolve <ISyncService>("syncService");
            _tokenService              = ServiceContainer.Resolve <ITokenService>("tokenService");
            _cryptoService             = ServiceContainer.Resolve <ICryptoService>("cryptoService");
            _cipherService             = ServiceContainer.Resolve <ICipherService>("cipherService");
            _folderService             = ServiceContainer.Resolve <IFolderService>("folderService");
            _settingsService           = ServiceContainer.Resolve <ISettingsService>("settingsService");
            _collectionService         = ServiceContainer.Resolve <ICollectionService>("collectionService");
            _searchService             = ServiceContainer.Resolve <ISearchService>("searchService");
            _authService               = ServiceContainer.Resolve <IAuthService>("authService");
            _platformUtilsService      = ServiceContainer.Resolve <IPlatformUtilsService>("platformUtilsService");
            _storageService            = ServiceContainer.Resolve <IStorageService>("storageService");
            _passwordGenerationService = ServiceContainer.Resolve <IPasswordGenerationService>(
                "passwordGenerationService");
            _i18nService         = ServiceContainer.Resolve <II18nService>("i18nService") as MobileI18nService;
            _deviceActionService = ServiceContainer.Resolve <IDeviceActionService>("deviceActionService");

            InitializeComponent();
            SetCulture();
            ThemeManager.SetThemeStyle("light");
            MainPage = new HomePage();
            var mainPageTask = SetMainPageAsync();

            ServiceContainer.Resolve <MobilePlatformUtilsService>("platformUtilsService").Init();
            _broadcasterService.Subscribe(nameof(App), async(message) =>
            {
                if (message.Command == "showDialog")
                {
                    var details     = message.Data as DialogDetails;
                    var confirmed   = true;
                    var confirmText = string.IsNullOrWhiteSpace(details.ConfirmText) ?
                                      AppResources.Ok : details.ConfirmText;
                    if (!string.IsNullOrWhiteSpace(details.CancelText))
                    {
                        confirmed = await MainPage.DisplayAlert(details.Title, details.Text, confirmText,
                                                                details.CancelText);
                    }
                    else
                    {
                        await MainPage.DisplayAlert(details.Title, details.Text, confirmText);
                    }
                    _messagingService.Send("showDialogResolve", new Tuple <int, bool>(details.DialogId, confirmed));
                }
                else if (message.Command == "locked")
                {
                    await _stateService.PurgeAsync();
                    MainPage = new NavigationPage(new LockPage());
                }
                else if (message.Command == "lockVault")
                {
                    await _lockService.LockAsync(true);
                }
                else if (message.Command == "logout")
                {
                    await LogOutAsync(false);
                }
                else if (message.Command == "loggedOut")
                {
                    // TODO
                }
                else if (message.Command == "unlocked" || message.Command == "loggedIn")
                {
                    // TODO
                }
            });
        }
Пример #30
0
 public LoginUserQueryHandler(ISmartRecruitingDbContext context, IJwtTokenGenerationService jwtService, IPasswordGenerationService passwordService)
 {
     _context         = context;
     _jwtService      = jwtService;
     _passwordService = passwordService;
 }
 public CreateUserCommandHandler(IMapper mapper, ISmartRecruitingDbContext context, IPasswordGenerationService passwordService)
 {
     _context         = context;
     _mapper          = mapper;
     _passwordService = passwordService;
 }