Пример #1
0
        public void CanSendAnInvite()
        {
            bool inviteWasSaved = false;
            var invite = new Invite {EventId = EventId, RecepientId = FriendId, SenderId = SenderId};
            _inviteRepository.Setup(x => x.Save(invite)).Callback(() => inviteWasSaved = true);
            _inviteFactory.Setup(x => x.CreateInvite(EventId, SenderId, FriendId)).Returns(invite);
            CreateInviteSender();
            _inviteSender.SetSenderId(SenderId);
            _inviteSender.SetEventIdForInvites(EventId);

            _inviteSender.SendInviteTo(FriendId);

            Assert.True(inviteWasSaved);
        }
        protected void ButonIvate_Command(object sender, System.Web.UI.WebControls.CommandEventArgs e)
        {
            var context = new ApplicationDbContext();
            var invite = new Invite();

            invite.CreatedDate = DateTime.Now;

            var status = context.Status.FirstOrDefault(x=> x.InviteStatus == "New");

            invite.InviteStatus = status;

            var invitationSenderId = User.Identity.GetUserId();
            var invitationSender = context.Users.FirstOrDefault(x => x.Id == invitationSenderId);

            invite.Sender = invitationSender;
            invite.Message = this.TextBoxMessage.Text;

            var recipient = context.Users.FirstOrDefault(u => u.UserName == this.TextBoxInvitedUser.Text);

            invite.Recipient = recipient;

            var eventId = Convert.ToInt32(this.DropDownListEvents.SelectedItem.Value);
            var selectedEvent = context.Events.FirstOrDefault(ev => ev.Id == eventId);

            invite.Event = selectedEvent;
            context.Invites.Add(invite);

            try
            {
                context.SaveChanges();

                ErrorSuccessNotifier.ShowAfterRedirect = true;
                ErrorSuccessNotifier.AddSuccessMessage(string.Format("Your invitation to {0} is sent", recipient.UserName));                              
            }
            catch (Exception ex)
            {
                ErrorSuccessNotifier.AddErrorMessage(ex);
            }

            if (ErrorSuccessNotifier.ShowAfterRedirect)
            {
                Response.RedirectPermanent("~/Account/InviteUser"); 
            }
        }
        public void CanGetCurrentInvitesToOtherGames()
        {
            var inviteRepo = new Mock<IInviteRepository>();
            var gameRepo = new Mock<IPickUpGameRepository>();

            var request = new GetCurrentGameInviteRequest
                              {
                                  ProfileId = "123"
                              };
            var invite = new Invite { EventId = "1234" };
            inviteRepo.Setup(x => x.GetInvitesToProfile(request.ProfileId)).Returns(new List<Invite> { invite });
            var gameWithoutTeams = new PickUpGame();
            gameRepo.Setup(x => x.GetPickUpGameById(invite.EventId)).Returns(gameWithoutTeams);

            var handler = new GetCurrentGameInviteHandle(inviteRepo.Object, gameRepo.Object);

            var response = handler.Handle(request);

            Assert.That(response.GamesWithoutTeams, Is.Not.Empty);
            Assert.That(response.GamesWithoutTeams[0], Is.SameAs(gameWithoutTeams));
        }
Пример #4
0
 public Task SendInviteAsync(User sender, Organization organization, Invite invite)
 {
     return(Task.Delay(0));
 }
Пример #5
0
        public void TestBuildInvite()
        {
            var invite = new Invite("*****@*****.**", "The reason.");

            invite.ShouldBe(Resource.Get("Xmpp.Muc.User.invite1.xml"));
        }
Пример #6
0
 public void Attach(Invite entity)
 {
     context.Invites.Add(entity);
     ContextStateHelper.ApplyStateChanges(context);
 }
Пример #7
0
		/// <summary> Creates a new invite to the provided channel. </summary>
		/// <param name="maxAge"> Time (in seconds) until the invite expires. Set to 0 to never expire. </param>
		/// <param name="isTemporary"> If true, a user accepting this invite will be kicked from the server after closing their client. </param>
		/// <param name="hasXkcdPass"> If true, creates a human-readable link. Not supported if maxAge is set to 0. </param>
		/// <param name="maxUses"> The max amount  of times this invite may be used. </param>
		public async Task<Invite> CreateInvite(string channelId, int maxAge, int maxUses, bool isTemporary, bool hasXkcdPass)
		{
			CheckReady();
			if (channelId == null) throw new ArgumentNullException(nameof(channelId));
			if (maxAge <= 0) throw new ArgumentOutOfRangeException(nameof(maxAge));
			if (maxUses <= 0) throw new ArgumentOutOfRangeException(nameof(maxUses));

			var response = await _api.CreateInvite(channelId, maxAge, maxUses, isTemporary, hasXkcdPass).ConfigureAwait(false);
			var invite = new Invite(this, response.Code, response.XkcdPass, response.Guild.Id);
			invite.Update(response);
			return invite;
		}
Пример #8
0
        public CommitResponse CaptureEmailInvite(int inviterMemberID, string inviteeEmail, int inviteEventID)
        {
            CommitResponse response = new CommitResponse();

            Invite invite = new Invite()
            {
                InviteType = (int)InviteTypes.EMAIL,
                InviterMemberID = inviterMemberID,
                InviteDT = DateTime.Now,
                InviteeEmailAddress = inviteeEmail,
                EventID = inviteEventID
            };

            try
            {
                LeetRaidsDB.Invites.InsertOnSubmit(invite);
                LeetRaidsDB.SubmitChanges();
            }
            catch (Exception ex)
            {
                response.success = false;
            }

            return response;


        }
Пример #9
0
 public Task SendOrganizationInviteAsync(User sender, Organization organization, Invite invite)
 {
     return(Task.CompletedTask);
 }
Пример #10
0
        /// <summary> Creates a new invite to this channel. </summary>
        /// <param name="maxAge"> Time (in seconds) until the invite expires. Set to null to never expire. </param>
        /// <param name="maxUses"> The max amount  of times this invite may be used. Set to null to have unlimited uses. </param>
        /// <param name="tempMembership"> If true, a user accepting this invite will be kicked from the server after closing their client. </param>
        /// <param name="withXkcd"> If true, creates a human-readable link. Not supported if maxAge is set to null. </param>
        public async Task<Invite> CreateInvite(int? maxAge = 1800, int? maxUses = null, bool tempMembership = false, bool withXkcd = false)
        {
            if (maxAge < 0) throw new ArgumentOutOfRangeException(nameof(maxAge));
            if (maxUses < 0) throw new ArgumentOutOfRangeException(nameof(maxUses));

            var request = new CreateInviteRequest(Id)
            {
                MaxAge = maxAge ?? 0,
                MaxUses = maxUses ?? 0,
                IsTemporary = tempMembership,
                WithXkcdPass = withXkcd
            };

            var response = await Client.ClientAPI.Send(request).ConfigureAwait(false);
            var invite = new Invite(Client, response.Code, response.XkcdPass);
            return invite;
        }
Пример #11
0
 public Invite Update(Invite model)
 {
     return(_baseRepository.Update(model));
 }
Пример #12
0
 public void Add(Invite invite)
 {
     _context.Add(invite);
 }
Пример #13
0
 public void Delete(Invite invite)
 {
     _context.Remove(invite);
 }
Пример #14
0
        private static void direct_menu()
        {
            var tp_to_user = btn_utils.create_btn(false, ButtonType.Default, "Teleport", "Tps you to user selected", Color.white, Color.red, -3, 3, main_menu_utils.transform,
                                                  new Action(() =>
            {
                var SelectedPlayer = utils.get_quick_menu().get_selected_player();
                VRCPlayer.field_Internal_Static_VRCPlayer_0.transform.position = SelectedPlayer.transform.position;
            }),
                                                  new Action(() =>
            {
            }));

            var direct_favplus = btn_utils.create_btn(false, ButtonType.Default, "Add to Fav+", "Adds the persons avatar to Fav+ silently", Color.white, Color.red, -2, 3, main_menu_utils.transform,
                                                      new Action(() =>
            {
                favplus.save_direct_to_favplus();
            }),
                                                      new Action(() =>
            {
            }));

            var pubavatar_show = btn_utils.create_btn(false, ButtonType.Default, "Show public avatars", "Attempts to show all public avatars made by the selected user", Color.white, Color.red, -1, 3, main_menu_utils.transform,
                                                      new Action(() =>
            {
                if (Time.time > last_apicall)
                {
                    last_apicall     = Time.time + 60;
                    var found_player = utils.get_quick_menu().get_selected_player();
                    if (found_player == null)
                    {
                        return;
                    }
                    if (found_player.get_api() == null)
                    {
                        return;
                    }
                    pubavatar.update_public_user_list(found_player.get_api().id);
                    MelonModLogger.Log("pub users for usr: "******"Function is still on cooldown!", "Please wait " + Math.Floor(sec_left) + " seconds before trying again!");
                }
            }),
                                                      new Action(() =>
            {
            }));

            var dynbones_toggle = btn_utils.create_btn(false, ButtonType.Default, "Add dynamic bones", "Attempt to add all dynamic bones by the user", Color.white, Color.red, 0, 3, main_menu_utils.transform,
                                                       new Action(() =>
            {
                var found_player = utils.get_quick_menu().get_selected_player();
                if (found_player == null)
                {
                    return;
                }
                if (found_player.get_api() == null)
                {
                    return;
                }
                dynbones.remove(found_player.field_Internal_VRCPlayer_0.prop_ApiAvatar_0.id);
                dynbones.tracker(found_player.field_Internal_VRCPlayer_0.prop_ApiAvatar_0.id, found_player.field_Internal_VRCPlayer_0.gameObject, found_player.field_Internal_VRCPlayer_0.prop_VRCPlayerApi_0.displayName);

                dynbones.remove(VRCPlayer.field_Internal_Static_VRCPlayer_0.prop_ApiAvatar_0.id);
                dynbones.tracker(VRCPlayer.field_Internal_Static_VRCPlayer_0.prop_ApiAvatar_0.id, VRCPlayer.field_Internal_Static_VRCPlayer_0.gameObject, VRCPlayer.field_Internal_Static_VRCPlayer_0.prop_VRCPlayerApi_0.displayName);
            }),
                                                       new Action(() =>
            {
            }));

            // new row 2
            var send_message_to_user = btn_utils.create_btn(false, ButtonType.Default, "Send message", "Sends a custom invite message to select user", Color.white, Color.red, -3, 2, main_menu_utils.transform,
                                                            new Action(() =>
            {
                if (Time.time > last_msg_apicall)
                {
                    last_msg_apicall = Time.time + 30;
                    var found_player = utils.get_quick_menu().get_selected_player();
                    if (found_player == null || found_player.field_Private_APIUser_0 == null)
                    {
                        return;
                    }

                    in_input_shit = true;
                    menu.input_text("Enter the text to send", "A message to send to the target", new Action <string>((a) =>
                    {
                        in_input_shit = false;

                        VRCWebSocketsManager.field_Private_Static_VRCWebSocketsManager_0.field_Private_Api_0.PostOffice.Send(Invite.Create(found_player.field_Private_APIUser_0.id, "", new Location("", new Transmtn.DTO.Instance("", found_player.field_Private_APIUser_0.id, "", "", "", false)), a));
                    }));
                }
                else
                {
                    in_input_shit = false;

                    var sec_left = last_msg_apicall - Time.time;
                    error_type_poput("Function is still on cooldown!", "Please wait " + Math.Floor(sec_left) + " seconds before trying again!");
                }
            }),
                                                            new Action(() =>
            {
            }));

            // add to the real menu toggle for the sub utils menu
            var utils_menu_toggle = btn_utils.create_btn(false, ButtonType.Default, "User-options", "Shows user options from useful_mod", Color.white, Color.green, 0, 0, utils.get_quick_menu().transform.Find("UserInteractMenu"),
                                                         new Action(() =>
            {
                var o = utils.get_quick_menu().transform.Find("UserInteractMenu");
                o.gameObject.SetActive(false);
                main_menu_utils.SetActive(true);
                utils_menu_active = true;
            }),
                                                         new Action(() =>
            {
            }), 1);
        }
Пример #15
0
        internal async Task <IActionResult> AddUser(RemotelyUser currentUser)
        {
            if (!currentUser.IsAdministrator)
            {
                return(Unauthorized());
            }

            if (ModelState.IsValid)
            {
                if (!_dataService.DoesUserExist(Input.UserEmail))
                {
                    var result = await _dataService.CreateUser(Input.UserEmail, Input.IsAdmin, currentUser.OrganizationID);

                    if (result)
                    {
                        var user = _dataService.GetUserByName(Input.UserEmail);

                        await _userManager.ConfirmEmailAsync(user, await _userManager.GenerateEmailConfirmationTokenAsync(user));

                        StatusMessage = "User account created.";
                        return(RedirectToPage());
                    }
                    else
                    {
                        ModelState.AddModelError("CreateUser", "Failed to create user account.");
                        return(Page());
                    }
                }
                else
                {
                    var invite = new Invite()
                    {
                        InvitedUser = Input.UserEmail,
                        IsAdmin     = Input.IsAdmin
                    };
                    var newInvite = _dataService.AddInvite(currentUser.OrganizationID, invite);

                    var inviteURL   = $"{Request.Scheme}://{Request.Host}/Invite?id={newInvite.ID}";
                    var emailResult = await _emailSender.SendEmailAsync(invite.InvitedUser, "Invitation to Organization in Remotely",
                                                                        $@"<img src='{Request.Scheme}://{Request.Host}/images/Remotely_Logo.png'/>
                            <br><br>
                            Hello!
                            <br><br>
                            You've been invited to join an organization in Remotely.
                            <br><br>
                            You can join the organization by <a href='{HtmlEncoder.Default.Encode(inviteURL)}'>clicking here</a>.",
                                                                        currentUser.OrganizationID);

                    if (emailResult)
                    {
                        StatusMessage = "Invitation sent.";
                    }
                    else
                    {
                        StatusMessage = "Error sending invititation email.";
                    }

                    return(RedirectToPage());
                }
            }
            return(Page());
        }
Пример #16
0
        public ActionResult Create(CreateVM model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }


            PartifyDbContext context = new PartifyDbContext();
            Party            P       = context.Parties // get the party object from db
                                       .Where(p => p.Id == model.PartyId)
                                       .FirstOrDefault();
            User Sender   = (User)Session["loggedUser"]; // get the sender obj from session
            User Receiver = context.Users                // get the receiver object from db
                            .Where(u => u.Username == model.ReceiverUsername)
                            .FirstOrDefault();

            if (Receiver == null || P == null) // if receiver username or party id wrong/invalid
            {
                ModelState.AddModelError(string.Empty, "Wrong username or party");
                return(View(model));
            }

            if (Receiver.Id == Sender.Id) // if user tries to invite themselves
            {
                ModelState.AddModelError(string.Empty, "You cannot invite yourself");
                return(View(model));
            }

            if (P.OwnerId == Receiver.Id) // hosts cannot be invited to their parties
            {
                ModelState.AddModelError(string.Empty, "You cannot invite the host");
                return(View(model));
            }

            bool IsThisTheOwner = false;

            if (P.OwnerId == Sender.Id)
            {
                IsThisTheOwner = true;
            }
            else // if the sender of the invite is not the party owner
            {
                object isSenderInvited = context.Invites // check db if the sender is at least invited
                                         .Where(i => (i.Sender.Id == P.OwnerId) &&
                                                (i.Receiver.Id == Sender.Id))
                                         .FirstOrDefault();
                if (isSenderInvited == null) // if not
                {
                    ModelState.AddModelError(string.Empty, "You are unauthorised to invite people to this party");
                    return(View(model)); // return
                }
            }

            Invite inv = new Invite();

            inv.Sender = context.Users
                         .Where(u => u.Id == Sender.Id)
                         .FirstOrDefault();
            inv.Receiver = Receiver;
            inv.Party    = P;

            Invite check = context.Invites.SingleOrDefault(dbInvite => (dbInvite.Party.Id == inv.Party.Id) &&
                                                           (dbInvite.Receiver.Id == inv.Receiver.Id) &&
                                                           (dbInvite.Sender.Id == inv.Sender.Id)
                                                           );

            if (check == null)
            {
                context.Invites.Add(inv);
                context.SaveChanges();
            }

            if (IsThisTheOwner)
            {
                return(RedirectToAction("Index", "Parties"));
            }

            return(RedirectToAction("Index", "Invites"));
        }
Пример #17
0
    public void AddDefaultStyle()
    {
        Banner bnr0 = new Banner();
        bnr0.State = LiveSupport.BLL.WebSiteManager.WebSite_Default;
        bnr0.Online = "online0.jpg";
        bnr0.Offline = "offline0.jpg";
        Banner bnr1 = new Banner();
        bnr1.State = LiveSupport.BLL.WebSiteManager.WebSite_Default;
        bnr1.Online = "online1.jpg";
        bnr1.Offline = "offline1.jpg";
        bannerlist.Clear();
        bannerlist.Add(bnr0);
        bannerlist.Add(bnr1);

        Invite ivt0 = new Invite();
        ivt0.State = LiveSupport.BLL.WebSiteManager.WebSite_Default;
        ivt0.Bgimg = "invite_bg0.gif";
        ivt0.Okimg = "btn_ok0.jpg";
        ivt0.Noimg = "btn_no0.jpg";
        Invite ivt1 = new Invite();
        ivt1.State = LiveSupport.BLL.WebSiteManager.WebSite_Default;
        ivt1.Bgimg = "invite_bg1.gif";
        ivt1.Okimg = "btn_ok1.jpg";
        ivt1.Noimg = "btn_no1.jpg";
        Invite ivt2 = new Invite();
        ivt2.State = LiveSupport.BLL.WebSiteManager.WebSite_Default;
        ivt2.Bgimg = "invite_bg2.gif";
        ivt2.Okimg = "btn_ok2.jpg";
        ivt2.Noimg = "btn_no2.jpg";
        invitelist.Clear();
        invitelist.Add(ivt0);
        invitelist.Add(ivt1);
        invitelist.Add(ivt2);
        ChatPage cpe = new ChatPage();
        cpe.State = LiveSupport.BLL.WebSiteManager.WebSite_Default;
        cpe.ChatPageBGImg = "chat_bg0.gif";
        cpe.ChatPageRightImg = "right_column_0.jpg";
        cpe.LeavePageTopImg = "topmove1.gif";
        chatpagelist.Clear();
        chatpagelist.Add(cpe);
    }
Пример #18
0
 private void UpdateAssignedInvitations(Guest guest, IEnumerable<string> invitationSelections)
 {
     if (invitationSelections == null && guest.Invitations == null)
     {
         return;
     }
     List<Invite> oldInvites = new List<Invite>();
     List<Invite> newInvites = new List<Invite>();
     if (guest.Invitations != null)
     {
         oldInvites = guest.Invitations.ToList();
         // HACK: remove all invites, then add new ones.
         oldInvites.ForEach(axe => db.Invites.Remove(axe));
     }
     Dictionary<string, string> selections = invitationSelections.ToDictionary(i => i.Split(':')[0], i => i.Split(':')[1]);
     foreach (var ev in db.Events)
     {
         // We have added an invite for the guest.
         if (!selections.ContainsKey(ev.Id.ToString())) continue;
         int maxInvites = 1;
         int.TryParse(selections[ev.Id.ToString()], out maxInvites);
         var invite = new Invite
         {
             GuestId = guest.Id,
             EventId = ev.Id,
             IsAttending = false,
             HasResponded = false,
             PeopleInvited = maxInvites,
             PeopleAttending = 0
         };
         newInvites.Add(invite);
     }
     newInvites.ForEach(ni => db.Invites.Add(ni));
 }
Пример #19
0
        public ActionResult SendInvite(MeetingIndexViewModel model, string[] invitedProfile)
        {
            if (!ModelState.IsValid)
            {
                Session["error"] = "Fill out all fields";
                return(RedirectToAction("Index", "Calendar"));
            }

            var      ctx              = new BlogDbContext();
            DateTime combineDateTime  = model.Date.Value.Add(model.Time.Value);
            DateTime combineDateTime2 = model.Date2.Value.Add(model.Time2.Value);

            var meeting = new Meeting
            {
                Name      = model.MeetingName,
                ProfileId = User.Identity.GetUserId(),
            };

            ctx.Meetings.Add(meeting);
            ctx.SaveChanges();

            var meetingDateOptions = new MeetingDateOptions
            {
                Date = combineDateTime
            };
            var meetingDateOptions2 = new MeetingDateOptions
            {
                Date = combineDateTime2
            };

            ctx.MeetingOptions.Add(meetingDateOptions);
            ctx.MeetingOptions.Add(meetingDateOptions2);
            ctx.SaveChanges();

            foreach (var person in invitedProfile)
            {
                var invite = new Invite
                {
                    MeetingName = model.MeetingName,
                    Accepted    = false,
                    ProfileID   = person,
                    MeetingID   = meeting.MeetingID
                };
                ctx.Invites.Add(invite);
                ctx.SaveChanges();

                var relationInvite = new MeetingDateOptionsToInvite
                {
                    InviteID            = invite.InviteID,
                    MeetingDateOptionID = meetingDateOptions.OptionID
                };
                var relationInvite2 = new MeetingDateOptionsToInvite
                {
                    InviteID            = invite.InviteID,
                    MeetingDateOptionID = meetingDateOptions2.OptionID
                };
                ctx.MeetingDateOptionsToInvite.Add(relationInvite);
                ctx.MeetingDateOptionsToInvite.Add(relationInvite2);

                ctx.SaveChanges();
            }

            TempData["accepted"] = "You've now sent invites for your new meeting";
            return(RedirectToAction("Index", "Calendar"));
        }
Пример #20
0
        public static void Handle(MapleClient c, PacketReader pr)
        {
            byte           func = pr.ReadByte();
            MapleCharacter chr  = c.Account.Character;

            switch (func)
            {
            case 0x00:    //okay so i have no idea why these 4 functions exist
            case 0x01:    //add equip item?
            case 0x02:    //add stackable item to trade?
            case 0x03:    //partner add equip item?
            {
                if (chr.Trade != null)
                {
                    HandleAddItem(pr, chr);
                }
                break;
            }

            case 0x04:
            case 0x05:    //add meso
            case 0x06:
            case 0x07:
                long mesos = pr.ReadLong();
                if (mesos > 0)
                {
                    if (chr.Trade != null && chr.Trade.Type == MapleTrade.TradeType.Trade)
                    {
                        chr.Trade.AddMesos(chr, mesos);
                    }
                }
                break;

            case 0x10:    //Create
                if (chr.Trade == null)
                {
                    if (!chr.DisableActions(ActionState.Trading))
                    {
                        return;
                    }
                    byte creationType = pr.ReadByte();
                    switch (creationType)
                    {
                    case 4:
                        MapleTrade t = MapleTrade.CreateTrade(MapleTrade.TradeType.Trade, chr);
                        chr.Trade = t;
                        break;

                    case 5:
                    case 6:        //create shop
                        break;

                    case 1:
                    case 2:        //minigame
                        break;
                    }
                }
                break;

            case 0x15:    //invite
            {
                int            ID        = pr.ReadInt();
                MapleCharacter inviteChr = Program.GetClientByCharacterId(ID).Account.Character;
                if (inviteChr.Trade == null && chr.Trade != null && chr.Trade.Type == MapleTrade.TradeType.Trade && chr.Trade.IsOwner(chr))
                {
                    if (chr.Trade.Partners.Count == 0)
                    {
                        chr.Trade.Invite(inviteChr, chr);        //i should check to make sure that i can invite them. i'll figure it out later.
                        chr.Trade.Partners.Add(inviteChr);       //this way the trade can't invite two people.
                    }
                }
            }
            break;

            case 0x13:    //invite accept
            {
                if (chr.Trade == null)
                {
                    uint   tradeID = pr.ReadUInt();
                    Invite invite  = null;
                    if (chr.Invites.TryGetValue(InviteType.Trade, out invite))
                    {
                        if (invite.SenderId == tradeID)
                        {
                            MapleTrade t = null;
                            if (MapleTrade.TradeIDs.TryGetValue(tradeID, out t))
                            {
                                chr.Trade = t;
                                c.SendPacket(t.GenerateTradeStart(chr, true));
                                t.Owner.Client.SendPacket(t.GenerateTradePartnerAdd(chr, 1));
                            }
                            else
                            {
                                chr.Client.SendPacket(t.GenerateRoomClosedMessage());
                            }
                        }
                    }
                }
            }
            break;

            case 0x16:    //invite deny
                if (chr.Trade == null)
                {
                    uint   tradeID = pr.ReadUInt();  //there's one byte after this. in testing it was 03
                    Invite invite  = null;
                    if (chr.Invites.TryGetValue(InviteType.Trade, out invite))
                    {
                        if (invite.SenderId == tradeID)
                        {
                            MapleTrade t = null;
                            if (MapleTrade.TradeIDs.TryGetValue(tradeID, out t))
                            {
                                t.Owner.Client.SendPacket(t.GenerateTradeDeny(chr));
                                t.Partners.Clear();
                            }
                            else
                            {
                            }
                            chr.Invites.Remove(InviteType.Trade);
                        }
                    }
                }
                break;

            case 0x1C:    //cancel trade.
                if (chr.Trade != null && chr.Trade.Type == MapleTrade.TradeType.Trade)
                {
                    chr.Trade.Close(false, false);
                }
                break;

            case 0x08:
            case 0x09:
            case 0x0A:    //Trade accept
            case 0x0B:
                if (chr.Trade != null && chr.Trade.Type == MapleTrade.TradeType.Trade && chr.Trade.Partners.Count == 1)
                {
                    chr.Trade.AcceptTrade(chr);
                }
                break;

            case 0x18:
                pr.ReadInt();    //timestamp
                string text = pr.ReadMapleString();
                if (chr.Trade != null && chr.Trade.Type == MapleTrade.TradeType.Trade && chr.Trade.Partners.Count == 1)
                {
                    chr.Trade.Chat(chr, text);
                }
                break;
            }
        }
Пример #21
0
 public bool TryGetInvite(string invite, out Invite result)
 {
     return _invites.TryGetValue(invite, out result);
 }
Пример #22
0
        public async Task <ActionResult <Invite> > PostInvite([FromBody] Invite invite, [FromHeader(Name = "Authorization")] string inputToken)
        {
            if (tokenCheck.TokenChecking(inputToken))
            {
                if (invite != null)
                {
                    if (permissionCheck.IsAllowed(inputToken, "root"))
                    {
                        try
                        {
                            //create query string
                            var    builder = new UriBuilder(config.SignUpURL);
                            var    query   = HttpUtility.ParseQueryString(builder.Query);
                            string token   = BCrypt.Net.BCrypt.HashPassword(invite.Email + DateTimeOffset.UtcNow.ToString(), config.Salt.Value);
                            query.Add("token", token);
                            builder.Query = query.ToString();
                            string url = builder.ToString();//link to the signup
                            invite.Token = token;
                            //send to sns
                            var data = new
                            {
                                invite.Email,
                                Subject = "Notification",
                                Text    = $"This is your invitation link: {url}"
                            };
                            var client         = httpClientFactory.CreateClient();
                            var requestMessage = new HttpRequestMessage(HttpMethod.Post, config.SNS.Url);
                            requestMessage.Headers.Add("Accept", "*/*");
                            requestMessage.Content = new StringContent(JsonConvert.SerializeObject(data), System.Text.Encoding.UTF8, "application/json");
                            //requestMessage.Headers.Add("Bearer", token);
                            var response       = client.SendAsync(requestMessage).Result;
                            var responseString = response.Content.ReadAsStringAsync().Result;
                            var responseStatus = response.StatusCode;
                            //var outputDictionary = JsonConvert.DeserializeObject<Dictionary<string, string>>(responseString);
                            //return outputDictionary.Values.First();

                            //create invite
                            if (responseStatus == HttpStatusCode.OK)
                            {
                                _context.Invites.Add(invite);
                                await _context.SaveChangesAsync();

                                _context.Entry(invite).State = EntityState.Detached;

                                return(await _context.Invites
                                       .Include(x => x.Company)
                                       .Where(x => x.Id == invite.Id)
                                       .FirstAsync());

                                //create user and disable token
                            }
                        }
                        catch (Exception e)
                        {
                            throw e;
                        }
                    }
                }
            }
            throw new ArgumentNullException();
        }
Пример #23
0
        /// <summary>
        /// 注册
        /// </summary>
        public Common.Account Register(string name, string phoneNumber, string password, string inviteCode, ref string message)
        {
            //获取用户信息,请确定web.config中的连接字符串正确
            using (SysEntities db = new SysEntities())
            {
                bool invites = Convert.ToBoolean(System.Configuration.ConfigurationManager.AppSettings["InviteCodeEnabled"]);

                if (!invites)
                {
                    password = EncryptAndDecrypte.EncryptString(password);
                    var dataAccount = (from p in db.Account
                                       where p.PhoneNumber == phoneNumber ||
                                       p.Name == name
                                       select p).FirstOrDefault();
                    if (dataAccount == null)
                    {
                        Invite invite = new Invite()
                        {
                            Id    = Common.Result.GetNewId(),
                            Code  = GetByRndNum(5),
                            State = StateEnums.QY
                            ,
                            CreateTime   = DateTime.Now,
                            CreatePerson = name
                        };
                        db.Invite.Add(invite);
                        Invite invite2 = new Invite()
                        {
                            Id    = Common.Result.GetNewId(),
                            Code  = GetByRndNum(5),
                            State = StateEnums.QY
                            ,
                            CreateTime   = DateTime.Now,
                            CreatePerson = name
                        };
                        db.Invite.Add(invite2);
                        var account = new DAL.Account()
                        {
                            Id          = Common.Result.GetNewId(),
                            State       = StateEnums.QY,
                            PhoneNumber = phoneNumber,
                            Name        = name,
                            Password    = password

                            ,
                            CreateTime   = DateTime.Now,
                            CreatePerson = phoneNumber
                        };
                        db.Account.Add(account);
                        Resume resume = new Resume()
                        {
                            Id                   = Common.Result.GetNewId(),
                            AccountId            = account.Id,
                            CreateTime           = DateTime.Now,
                            CreatePerson         = name,
                            Name                 = "默认",
                            Remark               = "注册账号自动创建",
                            Sort                 = 0,
                            State                = StateEnums.QY,
                            CompletionPercentage = 0
                        };
                        db.Resume.Add(resume);

                        SysNotice notice = new SysNotice();
                        notice.Id           = Result.GetNewId();
                        notice.CreatePerson = name;
                        notice.CreateTime   = DateTime.Now;
                        notice.AccountId    = account.Id;
                        notice.Message      = "您的邀请码为:" + invite.Code + ",另一个为:" + invite2.Code;
                        db.SysNotice.Add(notice);

                        db.SaveChanges();

                        Common.Account accountCommon = new Common.Account();
                        accountCommon.ResumeId = resume.Id;
                        accountCommon.Name     = name;
                        accountCommon.Id       = account.Id;
                        return(accountCommon);
                    }
                    else
                    {
                        if (phoneNumber == dataAccount.PhoneNumber)
                        {
                            message = "手机号码已经存在";
                        }
                        else if (name == dataAccount.Name)
                        {
                            message = "绰号已经存在";
                        }
                    }
                }
                else
                {
                    var data = (from p in db.Invite
                                where p.Code == inviteCode &&
                                p.State == StateEnums.QY
                                select p).FirstOrDefault();
                    if (data != null)
                    {
                        password = EncryptAndDecrypte.EncryptString(password);
                        var dataAccount = (from p in db.Account
                                           where p.PhoneNumber == phoneNumber ||
                                           p.Name == name
                                           select p).FirstOrDefault();
                        if (dataAccount == null)
                        {
                            data.State        = StateEnums.JY;
                            data.UpdatePerson = name;
                            data.UpdateTime   = DateTime.Now;
                            Invite invite = new Invite()
                            {
                                Id    = Common.Result.GetNewId(),
                                Code  = GetByRndNum(5),
                                State = StateEnums.QY
                                ,
                                CreateTime   = DateTime.Now,
                                CreatePerson = name
                            };
                            db.Invite.Add(invite);
                            Invite invite2 = new Invite()
                            {
                                Id    = Common.Result.GetNewId(),
                                Code  = GetByRndNum(5),
                                State = StateEnums.QY
                                ,
                                CreateTime   = DateTime.Now,
                                CreatePerson = name
                            };
                            db.Invite.Add(invite2);
                            var account = new DAL.Account()
                            {
                                Id          = Common.Result.GetNewId(),
                                State       = StateEnums.QY,
                                PhoneNumber = phoneNumber,
                                Name        = name,
                                Password    = password

                                ,
                                CreateTime   = DateTime.Now,
                                CreatePerson = phoneNumber
                            };
                            db.Account.Add(account);
                            Resume resume = new Resume()
                            {
                                Id                   = Common.Result.GetNewId(),
                                AccountId            = account.Id,
                                CreateTime           = DateTime.Now,
                                CreatePerson         = name,
                                Name                 = "默认",
                                Remark               = "注册账号自动创建",
                                Sort                 = 0,
                                State                = StateEnums.QY,
                                CompletionPercentage = 0
                            };
                            db.Resume.Add(resume);

                            SysNotice notice = new SysNotice();
                            notice.Id           = Result.GetNewId();
                            notice.CreatePerson = name;
                            notice.CreateTime   = DateTime.Now;
                            notice.AccountId    = account.Id;
                            notice.Message      = "您的邀请码为:" + invite.Code + ",另一个为:" + invite2.Code;
                            db.SysNotice.Add(notice);

                            db.SaveChanges();

                            Common.Account accountCommon = new Common.Account();
                            accountCommon.ResumeId = resume.Id;
                            accountCommon.Name     = name;
                            accountCommon.Id       = account.Id;
                            return(accountCommon);
                        }
                        else
                        {
                            if (phoneNumber == dataAccount.PhoneNumber)
                            {
                                message = "手机号码已经存在";
                            }
                            else if (name == dataAccount.Name)
                            {
                                message = "绰号已经存在";
                            }
                        }
                    }
                    else
                    {
                        message = "邀请码不正确";
                    }
                }
            }
            return(null);
        }
Пример #24
0
        public async Task <IActionResult> SendInvite(RemotelyUser currentUser)
        {
            if (!currentUser.IsAdministrator)
            {
                return(RedirectToPage("Index"));
            }

            if (ModelState.IsValid)
            {
                if (!DataService.DoesUserExist(Input.UserEmail))
                {
                    var user = new RemotelyUser
                    {
                        UserName        = Input.UserEmail,
                        Email           = Input.UserEmail,
                        OrganizationID  = currentUser.OrganizationID,
                        Organization    = currentUser.Organization,
                        IsAdministrator = Input.IsAdmin
                    };
                    var result = await UserManager.CreateAsync(user);

                    if (result.Succeeded)
                    {
                        user = await UserManager.FindByEmailAsync(Input.UserEmail);

                        await UserManager.ConfirmEmailAsync(user, await UserManager.GenerateEmailConfirmationTokenAsync(user));

                        StatusMessage = "User account created.";
                        return(RedirectToPage());
                    }
                    else
                    {
                        ModelState.AddModelError("CreateUser", "Failed to create user account.");
                        return(Page());
                    }
                }
                else
                {
                    var invite = new Invite()
                    {
                        InvitedUser = Input.UserEmail,
                        IsAdmin     = Input.IsAdmin
                    };
                    var newInvite = DataService.AddInvite(currentUser.OrganizationID, invite);

                    var inviteURL = $"{Request.Scheme}://{Request.Host}/Invite?id={newInvite.ID}";
                    await EmailSender.SendEmailAsync(invite.InvitedUser, "Invitation to Organization in Remotely",
                                                     $@"<img src='https://remotely.one/media/Remotely_Logo.png'/>
                            <br><br>
                            Hello!
                            <br><br>
                            You've been invited to join an organization in Remotely.
                            <br><br>
                            You can join the organization by <a href='{HtmlEncoder.Default.Encode(inviteURL)}'>clicking here</a>.");

                    StatusMessage = "Invitation sent.";

                    return(RedirectToPage());
                }
            }
            return(Page());
        }
Пример #25
0
 public InviteCreateProjectItemViewModel(CreateProjectViewModel createProfileViewModel, Invite invite)
 {
     this.Invite = invite;
     this.CreateProfileViewModel = createProfileViewModel;
 }
 Invite IInviteRepository.Add(Invite invite)
 {
     context.Invites.Add(invite);
     context.SaveChanges();
     return(invite);
 }
Пример #27
0
 public bool TryGetInvite(string invite, out Invite result)
 {
     return(_invites.TryGetValue(invite, out result));
 }
Пример #28
0
        public IHttpActionResult RemoveUser(string id, string email)
        {
            if (String.IsNullOrEmpty(id) || !CanAccessOrganization(id))
            {
                return(BadRequest());
            }

            Organization organization = _repository.GetById(id);

            if (organization == null)
            {
                return(BadRequest());
            }

            User user = _userRepository.GetByEmailAddress(email);

            if (user == null || !user.OrganizationIds.Contains(id))
            {
                Invite invite = organization.Invites.FirstOrDefault(i => String.Equals(i.EmailAddress, email, StringComparison.OrdinalIgnoreCase));
                if (invite == null)
                {
                    return(Ok());
                }

                organization.Invites.Remove(invite);
                _repository.Save(organization);
            }
            else
            {
                if (!user.OrganizationIds.Contains(organization.Id))
                {
                    return(BadRequest());
                }

                if (_userRepository.GetByOrganizationId(organization.Id).Count() == 1)
                {
                    return(BadRequest("An organization must contain at least one user."));
                }

                List <Project> projects = _projectRepository.GetByOrganizationId(organization.Id).Where(p => p.NotificationSettings.ContainsKey(user.Id)).ToList();
                if (projects.Count > 0)
                {
                    foreach (Project project in projects)
                    {
                        project.NotificationSettings.Remove(user.Id);
                    }

                    _projectRepository.Save(projects);
                }

                user.OrganizationIds.Remove(organization.Id);
                _userRepository.Save(user);
                _messagePublisher.Publish(new UserMembershipChanged {
                    ChangeType     = ChangeType.Removed,
                    UserId         = user.Id,
                    OrganizationId = organization.Id
                });
            }

            return(Ok());
        }
Пример #29
0
        public async Task CanSignupWhenAccountCreationEnabledWithValidTokenAsync()
        {
            _authOptions.Value.EnableAccountCreation = true;

            var orgs = await _organizationRepository.GetAllAsync();

            var          organization = orgs.Documents.First();
            const string email        = "*****@*****.**";
            const string name         = "Test";
            const string password     = "******";

            var invite = new Invite {
                Token        = StringExtensions.GetNewToken(),
                EmailAddress = email.ToLowerInvariant(),
                DateAdded    = SystemClock.UtcNow
            };

            organization.Invites.Clear();
            organization.Invites.Add(invite);
            await _organizationRepository.SaveAsync(organization, o => o.ImmediateConsistency());

            Assert.NotNull(organization.GetInvite(invite.Token));

            var result = await SendRequestAsAsync <TokenResult>(r => r
                                                                .Post()
                                                                .AppendPath("auth/signup")
                                                                .Content(new SignupModel {
                Email = email,
                InviteToken = invite.Token,
                Name = name,
                Password = password
            })
                                                                .StatusCodeShouldBeOk()
                                                                );

            Assert.NotNull(result);
            Assert.False(String.IsNullOrEmpty(result.Token));

            await RefreshDataAsync();

            var user = await _userRepository.GetByEmailAddressAsync(email);

            Assert.NotNull(user);
            Assert.Equal("Test", user.FullName);
            Assert.NotEmpty(user.OrganizationIds);
            Assert.True(user.IsEmailAddressVerified);
            Assert.Equal(password.ToSaltedHash(user.Salt), user.Password);
            Assert.Contains(organization.Id, user.OrganizationIds);

            organization = await _organizationRepository.GetByIdAsync(organization.Id);

            Assert.Empty(organization.Invites);

            var token = await _tokenRepository.GetByIdAsync(result.Token);

            Assert.NotNull(token);
            Assert.Equal(user.Id, token.UserId);
            Assert.Equal(TokenType.Access, token.Type);

            var mailQueue = GetService <IQueue <MailMessage> >() as InMemoryQueue <MailMessage>;

            Assert.Equal(0, (await mailQueue.GetQueueStatsAsync()).Enqueued);
        }
        public async Task <IActionResult> SendInvite([FromBody] Invite invite)
        {
            if (!DataService.GetUserByName(User.Identity.Name).IsAdministrator)
            {
                return(Unauthorized());
            }
            if (!ModelState.IsValid)
            {
                return(BadRequest());
            }

            var newUserMessage = "";

            if (!DataService.DoesUserExist(invite.InvitedUser))
            {
                var user = new RemotelyUser {
                    UserName = invite.InvitedUser, Email = invite.InvitedUser
                };
                var result = await UserManager.CreateAsync(user);

                if (result.Succeeded)
                {
                    user = await UserManager.FindByEmailAsync(invite.InvitedUser);

                    await UserManager.ConfirmEmailAsync(user, await UserManager.GenerateEmailConfirmationTokenAsync(user));

                    var code = await UserManager.GeneratePasswordResetTokenAsync(user);

                    code = WebEncoders.Base64UrlEncode(Encoding.UTF8.GetBytes(code));
                    var callbackUrl = Url.Page(
                        "/Account/ResetPassword",
                        pageHandler: null,
                        values: new { area = "Identity", code },
                        protocol: Request.Scheme);

                    invite.ResetUrl = callbackUrl;

                    newUserMessage = $@"<br><br>Since you don't have an account yet, one has been created for you.
                                    You will need to set a password first before attempting to join the organization.<br><br>
                                    Set your password by <a href='{HtmlEncoder.Default.Encode(callbackUrl)}'>clicking here</a>.  Your username/email
                                    is <strong>{invite.InvitedUser}</strong>.";
                }
                else
                {
                    return(BadRequest("There was an issue creating the new account."));
                }
            }

            var newInvite = DataService.AddInvite(User.Identity.Name, invite);

            var inviteURL = $"{Request.Scheme}://{Request.Host}/Invite?id={newInvite.ID}";
            await EmailSender.SendEmailAsync(invite.InvitedUser, "Invitation to Organization in Remotely",
                                             $@"<img src='https://remotely.lucency.co/images/Remotely_Logo.png'/>
                            <br><br>
                            Hello!
                            <br><br>
                            You've been invited by {User.Identity.Name} to join an organization in Remotely.
                            {newUserMessage}
                            <br><br>
                            You can join the organization by <a href='{HtmlEncoder.Default.Encode(inviteURL)}'>clicking here</a>.");

            return(Ok(newInvite));
        }
Пример #31
0
		/// <summary> Gets more info about the provided invite code. </summary>
		/// <remarks> Supported formats: inviteCode, xkcdCode, https://discord.gg/inviteCode, https://discord.gg/xkcdCode </remarks>
		public async Task<Invite> GetInvite(string inviteIdOrXkcd)
		{
			CheckReady();
			if (inviteIdOrXkcd == null) throw new ArgumentNullException(nameof(inviteIdOrXkcd));
			
			var response = await _api.GetInvite(inviteIdOrXkcd).ConfigureAwait(false);
			var invite = new Invite(this, response.Code, response.XkcdPass, response.Guild.Id);
            invite.Update(response);
			return invite;
		}
Пример #32
0
 private void SelectSuggestedContact(Invite contact)
 {
     CancelAllSearch();
     EmailInvite = contact.InviteeEmail;
 }
Пример #33
0
        public Task SendOrganizationInviteAsync(User sender, Organization organization, Invite invite)
        {
            const string template = "organization-invited";
            string       subject  = $"{sender.FullName} invited you to join the organization \"{organization.Name}\" on Exceptionless";
            var          data     = new Dictionary <string, object> {
                { "Subject", subject },
                { "BaseUrl", Settings.Current.BaseURL },
                { "InviteToken", invite.Token }
            };

            return(QueueMessageAsync(new MailMessage {
                To = invite.EmailAddress,
                Subject = subject,
                Body = RenderTemplate(template, data)
            }, template));
        }
Пример #34
0
 public static bool send_message(string msg, string id)
 {
     if (VRCWebSocketsManager.field_Private_Static_VRCWebSocketsManager_0 == null || VRCWebSocketsManager.field_Private_Static_VRCWebSocketsManager_0.field_Private_Api_0 == null)
     {
         return(false);
     }
     VRCWebSocketsManager.field_Private_Static_VRCWebSocketsManager_0.field_Private_Api_0.PostOffice.Send(Invite.Create(id, "", new Location("", new Transmtn.DTO.Instance("", id, "", "", "", false)), msg));
     return(true);
 }
Пример #35
0
 public void Save(Invite invite)
 {
     throw new System.NotImplementedException();
 }
Пример #36
0
 public async Task <Invite> InsertAsync(Invite entity, CancellationToken cancellationToken = default)
 {
     return(await _baseRepository.InsertAsync(entity, cancellationToken));
 }
Пример #37
0
 public static Task AcceptInvite(this DiscordClient client, Invite invite)
 {
     if (invite == null) throw new ArgumentNullException(nameof(invite));
     return invite.Accept();
 }
Пример #38
0
 public Invite Remove(Invite entity)
 {
     return(_baseRepository.Remove(entity));
 }
Пример #39
0
        public ActionResult ConfirmAddUser(int id, int uid)
        {
            string name = "";
            using (var db = new RazomContext())
            {
                Users user = db.Users.Find(uid);

                name = user.FirstName + " " + user.SecondName;
                ViewBag.Name = name;
                ViewBag.id = id;
                Invite inv = new Invite();
                inv.TravelID = id;
                inv.UserID = uid;
                db.Invite.Add(inv);
                db.SaveChanges();
            }
            return View();
        }
Пример #40
0
 /// <summary>
 /// Notifies the invited user of the invite.
 /// </summary>
 /// <param name="invite"></param>
 public void SendGameInvite(Invite invite)
 {
     //TODO: Send messages to the clients... somehow.
 }
Пример #41
0
		/// <summary> Accepts the provided invite. </summary>
		public Task AcceptInvite(Invite invite)
		{
			CheckReady();
			if (invite == null) throw new ArgumentNullException(nameof(invite));

			return _api.AcceptInvite(invite.Id);
		}
Пример #42
0
        public void SetIdBasedOnSenderReceiverAndPartyId()
        {
            var invite = new Invite(SenderId, ReceiverId, PartyId);

            Assert.AreEqual($"{SenderId}:{ReceiverId}:{PartyId}", invite.Id);
        }
Пример #43
0
 internal Invite Clone()
 {
     var result = new Invite();
     _cloner(this, result);
     return result;
 }
Пример #44
0
        public void SetMetadataToEmptyDictIfNotGiven()
        {
            var invite = new Invite(SenderId, ReceiverId, PartyId);

            CollectionAssert.IsEmpty(invite.Metadata);
        }
Пример #45
0
 /// <summary> Gets all active (non-expired) invites to this server. </summary>
 public async Task<IEnumerable<Invite>> GetInvites()
 {
     var response = await Client.ClientAPI.Send(new GetInvitesRequest(Id)).ConfigureAwait(false);
     return response.Select(x =>
     {
         var invite = new Invite(Client, x.Code, x.XkcdPass);
         invite.Update(x);
         return invite;
     });
 }
Пример #46
0
        public async Task <InviteResult> SendAsync(ApplicationUser user, string email, ActionContext context)
        {
            // validation
            if (user == null || email == null || context == null)
            {
                throw new ArgumentNullException();
            }

            if (user.InvitesClaimed >= user.InvitesAwarded)
            {
                return(InviteResult.NoInvites);
            }

            var invites = this.database.Invites.Where(e => e.User.Id == user.Id);

            foreach (var i in invites)
            {
                if (i.Expires > DateTime.UtcNow)
                {
                    this.database.Remove(i);
                }

                await this.database.SaveChangesAsync();
            }

            if (invites.Count() >= 25)
            {
                return(InviteResult.LimitReached);
            }

            if (!this.emailValidator.IsValidEmail(email))
            {
                return(InviteResult.InvalidEmail);
            }

            if (this.emailValidator.IsBannedEmailDomain(email))
            {
                return(InviteResult.BannedEmailDomain);
            }

            if (await this.userManager.FindByEmailAsync(email) != null)
            {
                return(InviteResult.EmailInUse);
            }

            // generate random salt & token
            byte[] saltBytes  = new byte[16];
            byte[] tokenBytes = new byte[32];
            using (var rng = RandomNumberGenerator.Create())
            {
                rng.GetBytes(saltBytes);
                rng.GetBytes(tokenBytes);
            }

            // encode and combine them to create the invite code
            var salt       = WebEncoders.Base64UrlEncode(saltBytes);
            var token      = WebEncoders.Base64UrlEncode(tokenBytes);
            var inviteCode = salt + "." + token;

            // hash the token
            var hash = await Task.Run(() =>
            {
                return(KeyDerivation.Pbkdf2(
                           password: token,
                           salt: WebEncoders.Base64UrlDecode(salt),
                           prf: KeyDerivationPrf.HMACSHA256,
                           iterationCount: 10000,
                           numBytesRequested: 256 / 8));
            });

            // create the invite
            var invite = new Invite
            {
                TokenHash = hash,
                Email     = email,
                Expires   = DateTime.UtcNow.AddDays(3),
                User      = user
            };

            this.database.Invites.Add(invite);
            await this.database.SaveChangesAsync();

            // send invite to specified email address
            var callbackUrl = new UrlHelper(context).Action(
                "Register",
                "Account",
                new { inviteCode = inviteCode },
                protocol: context.HttpContext.Request.Scheme);
            string subject = $"{user.UserName} has invited you to TUBES.";
            string message = $@"
                <h1>{subject}</h1>
                <p>Click the following link to create an account.</p>
                <p><a href='{callbackUrl}'>{callbackUrl}</a></p>"
                             .TrimMultiline();

            await this.emailSender.SendEmailAsync(email, subject, message);

            return(InviteResult.Success);
        }