コード例 #1
0
        public async Task <RegisterOutput> Register(RegisterInput input)
        {
            if (UseCaptchaOnRegistration())
            {
                await RecaptchaValidator.ValidateAsync(input.CaptchaResponse);
            }

            var user = await _userRegistrationManager.RegisterAsync(
                input.Name,
                input.Surname,
                input.EmailAddress,
                input.UserName,
                input.Password,
                input.TaxId,
                input.ServiceType,
                input.Npi,
                input.Specialty,
                input.PrimaryContact,
                input.Address,
                input.City,
                input.State,
                input.Zip,
                false,
                AppUrlService.CreateEmailActivationUrlFormat(AbpSession.TenantId)
                );

            var isEmailConfirmationRequiredForLogin = await SettingManager.GetSettingValueAsync <bool>(AbpZeroSettingNames.UserManagement.IsEmailConfirmationRequiredForLogin);

            return(new RegisterOutput
            {
                CanLogin = user.IsActive && (user.IsEmailConfirmed || !isEmailConfirmationRequiredForLogin)
            });
        }
コード例 #2
0
        public async Task <RegisterOutput> RegisterMember(RegisterMemberInput input)
        {
            var getPersonals = (from x in _personalsRepo.GetAll()
                                join y in _personalsMemberRepo.GetAll()
                                on x.psCode equals y.psCode
                                join z in _trEmailRepo.GetAll()
                                on x.psCode equals z.psCode
                                where y.memberCode == input.membercode
                                select new { x.name, z.email, y.memberCode }).FirstOrDefault();

            var user = await _userRegistrationManager.RegisterMemberAsync(
                getPersonals.name,
                getPersonals.name,
                getPersonals.email,
                input.membercode,
                input.password,
                true,
                AppUrlService.CreateEmailActivationUrlFormat(AbpSession.TenantId)
                );

            //var isEmailConfirmationRequiredForLogin = await SettingManager.GetSettingValueAsync<bool>(AbpZeroSettingNames.UserManagement.IsEmailConfirmationRequiredForLogin);

            return(new RegisterOutput
            {
                CanLogin = user.IsActive && (user.IsEmailConfirmed)
            });
        }
コード例 #3
0
        public async Task SendEmailActivationLink(SendEmailActivationLinkInput input)
        {
            var user = await GetUserByChecking(input.EmailAddress);

            user.SetNewEmailConfirmationCode();
            await _userEmailer.SendEmailActivationLinkAsync(
                user,
                AppUrlService.CreateEmailActivationUrlFormat(AbpSession.TenantId)
                );
        }
コード例 #4
0
 public async Task CreateTenant(CreateTenantInput input)
 {
     await TenantManager.CreateWithAdminUserAsync(input.TenancyName,
                                                  input.Name,
                                                  input.AdminPassword,
                                                  input.AdminEmailAddress,
                                                  input.ConnectionString,
                                                  input.IsActive,
                                                  input.EditionId,
                                                  input.ShouldChangePasswordOnNextLogin,
                                                  input.SendActivationEmail,
                                                  input.SubscriptionEndDateUtc?.ToUniversalTime(),
                                                  input.IsInTrialPeriod,
                                                  AppUrlService.CreateEmailActivationUrlFormat(input.TenancyName)
                                                  );
 }
コード例 #5
0
        public async Task <RegisterOutput> Register(RegisterInput input)
        {
            try
            {
                if (UseCaptchaOnRegistration())
                {
                    await RecaptchaValidator.ValidateAsync(input.CaptchaResponse);
                }

                var user = await _userRegistrationManager.RegisterAsync(
                    input.Name,
                    input.Surname,
                    input.EmailAddress,
                    input.UserName,
                    input.Password,
                    false,
                    AppUrlService.CreateEmailActivationUrlFormat(AbpSession.TenantId),
                    input.ExperienceLevel
                    );

                var isEmailConfirmationRequiredForLogin = await SettingManager.GetSettingValueAsync <bool>(AbpZeroSettingNames.UserManagement.IsEmailConfirmationRequiredForLogin);

                return(new RegisterOutput
                {
                    CanLogin = user.IsActive && (user.IsEmailConfirmed || !isEmailConfirmationRequiredForLogin)
                });
            }
            catch (UserFriendlyException e)
            {
                return(new RegisterOutput
                {
                    CanLogin = false,
                    Message = e.Message
                });
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                throw;
            }
        }
コード例 #6
0
ファイル: AccountAppService.cs プロジェクト: addy11/MyPorject
        public async Task <RegisterOutput> Register(RegisterInput input)
        {
            string code = _cacheManager.GetCache("chageCode").GetOrDefault <string, string>(input.PhoneNumber);

            if (input.VerificationCode == code)
            {
                if (UseCaptchaOnRegistration())
                {
                    await RecaptchaValidator.ValidateAsync(input.CaptchaResponse);
                }

                var user = await _userRegistrationManager.RegisterAsync(
                    input.Name,
                    input.Surname,
                    input.EmailAddress,
                    input.UserName,
                    input.Password,
                    false,
                    AppUrlService.CreateEmailActivationUrlFormat(AbpSession.TenantId)
                    );

                var isEmailConfirmationRequiredForLogin = await SettingManager.GetSettingValueAsync <bool>(AbpZeroSettingNames.UserManagement.IsEmailConfirmationRequiredForLogin);

                return(new RegisterOutput
                {
                    CanLogin = user.IsActive && (user.IsEmailConfirmed || !isEmailConfirmationRequiredForLogin)
                });
            }
            else
            {
                return(new RegisterOutput
                {
                    CanLogin = false,
                    ErroMsg = "验证码错误"
                });
            }
        }