protected virtual void UpdateAccountViewModel(TUser account, TAccountViewModel model) { model.Account = account; model.AccountName = account.Username; var currentUser = GetCurrentUser(); model.CanManage = ActionsRequiringPermissions.ManageAccount.CheckPermissions( currentUser, account) == PermissionsCheckResult.Allowed; model.IsCertificatesUIEnabled = ContentObjectService.CertificatesConfiguration?.IsUIEnabledForUser(currentUser) ?? false; model.WasMultiFactorAuthenticated = User.WasMultiFactorAuthenticated(); model.CuratedFeeds = CuratedFeedService .GetFeedsForManager(account.Key) .Select(f => f.Name) .ToList(); model.HasPassword = account.Credentials.Any(c => c.IsPassword()); model.CurrentEmailAddress = account.UnconfirmedEmailAddress ?? account.EmailAddress; model.HasConfirmedEmailAddress = !string.IsNullOrEmpty(account.EmailAddress); model.HasUnconfirmedEmailAddress = !string.IsNullOrEmpty(account.UnconfirmedEmailAddress); model.ChangeEmail = new ChangeEmailViewModel(); model.ChangeNotifications = model.ChangeNotifications ?? new ChangeNotificationsViewModel(); model.ChangeNotifications.EmailAllowed = account.EmailAllowed; model.ChangeNotifications.NotifyPackagePushed = account.NotifyPackagePushed; }
private ActionResult AccountView(AccountViewModel model) { // Load Credential info var user = GetCurrentUser(); var curatedFeeds = CuratedFeedService.GetFeedsForManager(user.Key); var creds = user.Credentials.Select(c => AuthService.DescribeCredential(c)).ToList(); model.Credentials = creds; model.CuratedFeeds = curatedFeeds.Select(f => f.Name); return(View("Account", model)); }
public virtual ActionResult Account() { var user = UserService.FindByUsername(CurrentUser.Identity.Name); var curatedFeeds = CuratedFeedService.GetFeedsForManager(user.Key); return(View( new AccountViewModel { ApiKey = user.ApiKey.ToString(), CuratedFeeds = curatedFeeds.Select(cf => cf.Name) })); }
public virtual ActionResult Account() { var user = UserService.FindByUsername(Identity.Name); var curatedFeeds = CuratedFeedService.GetFeedsForManager(user.Key); var apiCredential = user .Credentials .FirstOrDefault(c => c.Type == CredentialTypes.ApiKeyV1); return(View( new AccountViewModel { ApiKey = apiCredential == null ? user.ApiKey.ToString() : apiCredential.Value, IsConfirmed = user.Confirmed, CuratedFeeds = curatedFeeds.Select(cf => cf.Name) })); }
protected virtual void UpdateAccountViewModel(TUser account, TAccountViewModel model) { model.Account = account; model.AccountName = account.Username; model.CanManage = ActionsRequiringPermissions.ManageAccount.CheckPermissions( GetCurrentUser(), account) == PermissionsCheckResult.Allowed; model.CuratedFeeds = CuratedFeedService .GetFeedsForManager(account.Key) .Select(f => f.Name) .ToList(); model.HasPassword = account.Credentials.Any(c => c.Type.StartsWith(CredentialTypes.Password.Prefix)); model.CurrentEmailAddress = account.UnconfirmedEmailAddress ?? account.EmailAddress; model.HasConfirmedEmailAddress = !string.IsNullOrEmpty(account.EmailAddress); model.HasUnconfirmedEmailAddress = !string.IsNullOrEmpty(account.UnconfirmedEmailAddress); model.ChangeEmail = new ChangeEmailViewModel(); model.ChangeNotifications = model.ChangeNotifications ?? new ChangeNotificationsViewModel(); model.ChangeNotifications.EmailAllowed = account.EmailAllowed; model.ChangeNotifications.NotifyPackagePushed = account.NotifyPackagePushed; }