public async Task <CurrentUserProfileEditDto> GetCurrentUserProfileForEdit() { var user = await GetCurrentUserAsync(); var userProfileEditDto = ObjectMapper.Map <CurrentUserProfileEditDto>(user); userProfileEditDto.QrCodeSetupImageUrl = user.GoogleAuthenticatorKey != null ? _googleTwoFactorAuthenticateService.GenerateSetupCode("tmss", user.EmailAddress, user.GoogleAuthenticatorKey, 300, 300).QrCodeSetupImageUrl : ""; userProfileEditDto.IsGoogleAuthenticatorEnabled = user.GoogleAuthenticatorKey != null; if (Clock.SupportsMultipleTimezone) { userProfileEditDto.Timezone = await SettingManager.GetSettingValueAsync(TimingSettingNames.TimeZone); var defaultTimeZoneId = await _timeZoneService.GetDefaultTimezoneAsync(SettingScopes.User, AbpSession.TenantId); if (userProfileEditDto.Timezone == defaultTimeZoneId) { userProfileEditDto.Timezone = string.Empty; } } return(userProfileEditDto); }
public async Task <UpdateGoogleAuthenticatorKeyOutput> UpdateGoogleAuthenticatorKey() { var user = await GetCurrentUserAsync(); user.GoogleAuthenticatorKey = Guid.NewGuid().ToString().Replace("-", "").Substring(0, 10); CheckErrors(await UserManager.UpdateAsync(user)); return(new UpdateGoogleAuthenticatorKeyOutput { QrCodeSetupImageUrl = _googleTwoFactorAuthenticateService.GenerateSetupCode(GoogleAuthenticatorConst.Issuer, user.UserName, user.GoogleAuthenticatorKey, 300, 300).QrCodeSetupImageUrl }); }