Esempio n. 1
0
        public ActionResult ULoginLogin(string token)
        {
            var accountInfo = new UloginAccountInformationExtractor(token, Request.ServerVariables["SERVER_NAME"]).Extract();

            var account = new AccountInformation
                    {
                        NickName = accountInfo.nickname,
                        FirstName = accountInfo.first_name,
                        LastName = accountInfo.last_name,
                        Email = accountInfo.email,
                        Identity = accountInfo.identity,
                        Network = accountInfo.network,
                    };

            return login(account);
        }
Esempio n. 2
0
        private ActionResult login(AccountInformation account)
        {
            var association = geUsertAssociationWith(account);
            var userId = association.With(view => view.UserId);

            if (association == null || association.UserId == Guid.Empty)
            {
                userId = Guid.NewGuid();
                _commandBus.Publish(new CreateUser(userId, account.NickName, account.FirstName, account.LastName, account.Email, account.Network, account.Identity));
                var isUpdated = _notificationBus.WaitNotification<UserDocument>(userId);
                if (!isUpdated)
                {
                    throw new HttpException(500, "Жопа! Такого не должно быть!");
                }
            }

            UserAccoutView user = _viewRepository.Load<UserAccoutInputModel, UserAccoutView>(new UserAccoutInputModel(userId));

            _commandBus.Publish(new UpdateUserState(user.UserId, DateTime.Now, UserState.Online));
            UserManager.Loggin(user.UserId, user.Nick);

            return RedirectToAction("Index", "Meetings");
        }
Esempio n. 3
0
 private AccountAssociationView geUsertAssociationWith(AccountInformation account)
 {
     return _viewRepository.Load<AccountAssociationInputModel, AccountAssociationView>(new AccountAssociationInputModel(account.Identity));
 }