/// <summary> /// Return how we want to display the user's name in the UI. Currently set to Username, could be changed to First/Last, etc, /// </summary> /// <param name="FormsAuthService"></param> /// <returns></returns> public static string GetUserFriendlyName(IFormsAuthenticationService FormsAuthService) { return HttpContext.Current.Cache.GetOrStore<string>( GetUserSignInKey(FormsAuthService, UserFriendlyNameKey), () => { if (FormsAuthService.IsAuthenticated()) { var userRepository = new UserRepository(MvcApplication.SessionFactory.OpenSession()); var user = userRepository.GetUser(FormsAuthService.GetCurrentUserName()); if (user != null) { return user.Username; } else { return ""; } } else { return ""; } } ); }
public HomeController(ISession session, IFormsAuthenticationService FormsAuthService) { _session = session; _userRepository = new UserRepository(_session); this.FormsAuthService = FormsAuthService; }
public SessionController(ISession session, IFormsAuthenticationService FormsAuthService, IMembershipService MembershipService) { _session = session; _userRepository = new UserRepository(_session); _log = new UserActivity(_session); this.FormsAuthService = FormsAuthService; this.MembershipService = MembershipService; }
public UserMembershipProvider() { _session = MvcApplication.SessionFactory.OpenSession(); _userRepository = new UserRepository(_session); }