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();
            }
        }
Beispiel #2
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);

        }