コード例 #1
0
ファイル: UsersController.cs プロジェクト: csu-xiao-an/FinAPP
        public async Task <IActionResult> CreateUser(RegistrationViewModel registrationModel)
        {
            var fullPath = DefaultUserImagePath();

            var image = registrationModel.Avatar;

            if (string.IsNullOrEmpty(image))
            {
                registrationModel.Avatar = ImageConvertor.GetImageFromPath(fullPath);
            }
            else
            {
                registrationModel.Avatar = await Downloader.GetImageAsBase64Url(image);
            }

            var newUser = await _userService.CreateUserAsync(registrationModel);

            if (newUser == null)
            {
                throw new ValidationException(HttpStatusCode.Forbidden, _localizer["UserAlreadyExists"].Value);
            }

            var confirmEmailDto = new ConfirmEmailDTO
            {
                UserEmail   = newUser.Email,
                CallbackUrl = registrationModel.CallbackUrlForEmailConfirm
            };
            await _emailConfirmationService.SendConfirmEmailLinkAsync(confirmEmailDto);

            return(Ok());
        }
コード例 #2
0
        public async Task <IActionResult> SendConfirmEmailLinkAsync(ConfirmEmailDTO confirmEmailDto)
        {
            await _emailConfirmationService.SendConfirmEmailLinkAsync(confirmEmailDto);

            return(Ok());
        }