public override async Task <LoginUserResult> Login(LoginUserCommand command)
        {
            var citizenId = command.AsCitizenId();
            var user      = await users.Query()
                            .Where(u => u.TCKimlikNo == citizenId)
                            .FirstOrDefaultAsync();

            if (user == null)
            {
                // Bakalim hemonline'da var mi?
                var cid         = command.ExternalUserId;
                var mobilePhone = user.CepTelefonu;
                return(new LoginUserResult {
                    Status = LoginUserResult.LoginStatus.UserNotFound, MobilePhones = new string[] { mobilePhone }
                });
            }

            // Bu provider icin external id tckimlik string halidir.
            if (command.IsPhoneValid)
            {
                // Bu provider icin external id hemonline login nameidir'sidir.
                return(await PrepareOneTimePassword(AuthenticationProviderType.Person, user.CepTelefonu, user.TCKimlikNo.ToString()));
            }
            else
            {
                return new LoginUserResult
                       {
                           Message      = "Bilgiler doğru. Cep telefonu gerekiyor.",
                           Status       = LoginUserResult.LoginStatus.PhoneNumberRequired,
                           MobilePhones = new string[] { user.CepTelefonu }
                       }
            };
        }
        public override async Task <LoginUserResult> Login(LoginUserCommand command)
        {
            var citizenId = command.AsCitizenId();
            var user      = await _users.Query()
                            .Where(u => u.CitizenId == citizenId)
                            .FirstOrDefaultAsync();


            if (command.IsPhoneValid)
            {
                return(await PrepareOneTimePassword(AuthenticationProviderType.Person, user.MobilePhones, user.CitizenId.ToString()));
            }

            return(new LoginUserResult
            {
                Message = Messages.TrueButCellPhone,

                Status = LoginUserResult.LoginStatus.PhoneNumberRequired,
                MobilePhones = new string[] { user.MobilePhones }
            });
        }