public static void CreateLocalAccount(IDocumentStore masterStore, string email, string password)
 {
     
     
     var accountRepo = new RavenUserAccountRepository(masterStore);
     var userAccountService = new UserAccountService(accountRepo)
     {
         Configuration = MembershipRebootConfig.Create()
     };
     CreateLocalAccount(masterStore, email, password, userAccountService);
 }
        public void Send(Message msg)
        {

            var accountRepo = new RavenUserAccountRepository(MasterStore);
            var userAccountService = new UserAccountService(accountRepo)
            {
                Configuration = MembershipRebootConfig.Create()
            };
            string user = msg.To;// think this is probably e-mail address...
            UserAccount account;
            account = userAccountService.GetByEmail(user);
            // who the message is to will give us org and user- query masterdb by username
            using (var session = MasterStore.OpenSession())
            {
            }
                var notify = new Notification
                {

                    //need url to put in here.
                    Body =
                        String.Format("Your temporary Illuminate passowrd is : {0} \n Please follow the instructions at {1} to change your password and login to Illuminate", password),
                    SendDate = DateTime.Now,
                    Title = string.Format("Your temporary Illuminate password"),
                    From = EmailRecipient.GetIlluminateRecipient(),
                    NotificationRecipients = new NotificationRecipient[]
                                                                              {
                                                                                  new NotificationRecipient
                                                                                      {

                                                                                          NotificationDeliveryTypes =
                                                                                          
                                                                                              NotificationDeliveryTypes
                                                                                                  .Email,
                                                                                      
                                                                                          Users = new List<SimpleUser>{OrgUser.ToSimpleUser()}

                                                                                      }
                                                                              },
                };

                using (var orgSession = OrgStore.OpenSession())
                {
                orgSession.Store(notify);
                orgSession.SaveChanges();
            }
        }
예제 #3
0
        protected override void OnApplicationStarted()
        {
            //hook into the fed auth config created event do we can do some extra steps
            FederatedAuthentication.FederationConfigurationCreated += FederatedAuthentication_FederationConfigurationCreated;
            XmlConfigurator.Configure(); //configure logging
            Logger = LogManager.GetLogger("Illuminate");
            Logger.Information("Illuminate Web Application Started");

            AreaRegistration.RegisterAllAreas();
            WebApiConfig.Register(GlobalConfiguration.Configuration);
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteTable.Routes.MapHubs();
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);

            Logger.Information("About to create master store when starting Illuminate");
            DataBase = IlluminateDatabase.Create(new DocumentStore { ConnectionStringName = "RavenServer" });
            Logger.Information("Created master store when starting Illuminate");
            Mappings.Initialise();
            BinderConfig.RegisterBinders();

            var accountRepoStore = new DocumentStore {ConnectionStringName = "RavenServer"};
            accountRepoStore.Initialize();
            var accountRepo = new RavenUserAccountRepository(accountRepoStore);
            UserAccountService = new UserAccountService(accountRepo)
            {
                Configuration = MembershipRebootConfig.Create()
            };
            RebootAuthenticationService = new SamAuthenticationService(UserAccountService);
            //in DEBUG mode attach raven profiler so we can profile all org stores if needed
#if DEBUG
            foreach (var store in DataBase.GetAllOrgStores().Where(store => store.Identifier.EndsWith("halethorpe")))
            {
                Raven.Client.MvcIntegration.RavenProfiler.InitializeFor(store);
            }
            //Raven.Client.MvcIntegration.RavenProfiler.InitializeFor(DataBase.MasterStore);
#endif
            //task manager does some stuff as background processes
            Logger.Information("about to initialize taskmanager when starting Illuminate");
            TaskManager.Initialize(new IlluminateRegistry());
            Logger.Information("Initialized taskmanager when starting Illuminate");
            
        }
예제 #4
0
        // can only log in now because it remembers one of the auto generated passwords.... remove users associated with my e-mail address.

        public static void RemoveMeFromMRDB()
        {
            var dataBase = IlluminateDatabase.Create(new DocumentStore { ConnectionStringName = "RavenServer" });
            var accountRepo = new RavenUserAccountRepository(dataBase.MasterStore);
            var userAccountService = new UserAccountService(accountRepo)
            {
                Configuration = MembershipRebootConfig.Create()
            };
            //var userAccountService = MvcApplication.UserAccountService;// this is null
            var account = userAccountService.GetByEmail("*****@*****.**");
            //userAccountService.userRepository.Remove(account); - inaccessible due to protetcion level
            userAccountService.Configuration.SecuritySettings.AllowAccountDeletion = true;
            //account.IsAccountVerified = false; - this is protected, but don't need it as conditional is or 
            userAccountService.DeleteAccount(account.Id);

        }