public SignInViewModel(IUnityContainer container) : base(container) { _nonAuthenticationApi = Container.Resolve <INonAuthenticationApi>(); ConfigureFile = Container.Resolve <IConfigureFile>(); SignInCommand = new RelayCommand <PasswordBox>(SignInCommandExecute, passwordBox => CanSignIn(Email, passwordBox.Password)); EventAggregator.GetEvent <SignUpSuccessEvent>().Subscribe(signUpArgs => _signUpArgs = signUpArgs); }
public async Task <SignInApiResponse> SignUp(SignUpArgs args) { var response = new SignInApiResponse { Lang = Language }; if (args == null) { response.Error = "json parameters are empty"; return(response); } if (string.IsNullOrWhiteSpace(args.Email)) { response.Error = BshkaraRes.Api_Auth_EmailIsEmpty; return(response); } if (!args.Email.IsValidEmail()) { response.Error = BshkaraRes.Api_Auth_EmailIsNotValid; return(response); } if (string.IsNullOrWhiteSpace(args.Password)) { response.Error = BshkaraRes.Api_Auth_PasswordIsEmpty; return(response); } if (string.IsNullOrWhiteSpace(args.ConfirmedPassword)) { response.Error = BshkaraRes.Api_Auth_ConfirmatedPasswordEmpty; return(response); } if (args.Password != args.ConfirmedPassword) { response.Error = BshkaraRes.Api_Auth_PasswordNotEqualsConfirmatedPassword; return(response); } var user = new UserEntity { UserName = args.UserName, Email = args.Email }; var result = await UserManager.CreateAsync(user, args.Password); if (result.Succeeded) { return(await SignInAsync(new SignInArgs { Email = user.Email, Password = args.Password })); } response.Error = BshkaraRes.Api_Auth_CantCreateUser; return(response); }
public async Task <SignInApiResponse> AuthSignUp(SignUpArgs args) { return(await TryInvoceAsync <SignInApiResponse>(async() => { var httpClient = GetHttpClientWidthAuthenticationHeader(); var content = new StringContent(JsonConvert.SerializeObject(args), Encoding.UTF8, "application/json"); return await httpClient.PostAsync("auth/signup", content); })); }
public async Task <string> SignUp([FromBody] SignUpArgs args) { return(await this.AccountUseCase.SignUpAsync(args)); }
public async Task <SignInApiResponse> SignUpAsync(SignUpArgs args) { return(await _apiClient.AuthSignUp(args)); }