Exemplo n.º 1
0
        private static void RegisterAccount()
        {
            Console.Clear();
            Console.WriteLine("-=Регистрация аккаунта=-");
            Console.Write("Введите логин: ");
            var userName = Console.ReadLine();

            Console.Write("Введите пароль: ");
            var password = Console.ReadLine();

            Console.Write("Подтвердите пароль: ");
            var confirmPassword = Console.ReadLine();

            var serverInfoUrl = ApiHelper.GetApiServerUri(_serverInfo, userName, _serverPort);

            var authApi = new AuthApiClient(new PasswordOAuthContext()
            {
                BaseUri = serverInfoUrl
            });

            try
            {
                var result = authApi.Register(new RegisterAccountModel()
                {
                    Login           = userName,
                    Password        = password,
                    ConfirmPassword = confirmPassword
                }).Result;
            }
            catch (AggregateException loginException)
            {
                ErrorCode = GameRunner.HandleClientException(loginException.InnerException as IClientException <ErrorData>);
            }
        }
Exemplo n.º 2
0
        public Task <Tuple <PerformanceCounter, object> > RegisterAccount(string login)
        {
            var serverUri = GetApiServerUri(_serviceUriList, login);
            var authApi   = new AuthApiClient(new PasswordOAuthContext()
            {
                BaseUri = serverUri
            });

            return(DoPerformanceMeasureAction(async() => await authApi.Register(new EntityFX.Gdcame.Application.WebApi.Models.RegisterAccountModel()
            {
                Login = login,
                Password = DefaultPassword,
                ConfirmPassword = DefaultPassword
            }), serverUri.ToString()));
        }
Exemplo n.º 3
0
        private async static Task <object> Register(PasswordOAuthContext token, int index)
        {
            var authApi = new AuthApiClient(new PasswordOAuthContext()
            {
                BaseUri = new Uri("http://localhost:9001")
            });


            return(await authApi.Register(new RegisterAccountModel()
            {
                Login = "******" + index,
                Password = "******",
                ConfirmPassword = "******"
            }));
        }