public async Task <User> CreateUser(int portalId, NewUserModel user) { User dbUser = await GetUserByEmail(user.EmailAddress); if (dbUser != null) { throw new Exception("This user already exists."); } string salt = Helpers.CreateUniqueString(64); User newUser = new User { PortalId = portalId, FirstName = user.FirstName.Trim(), LastName = user.LastName.Trim(), EmailAddress = user.EmailAddress.Trim(), PasswordHash = user.NewPassword.Encrypt(salt), Salt = salt, CreatedDate = DateTimeOffset.Now, UpdatedDate = DateTimeOffset.Now, IsActive = true, IsDeleted = false, }; await Context.Users.AddAsync(newUser); await Context.SaveChangesAsync(); return(newUser); }
public ActionResult AddUser(NewUserModel model) { //NewUserModel tempModel = Serializer.FromJson<NewUserModel>(jsonstr); var result = new StandardJsonResult <string>(); result.Try(() => { if (!ModelState.IsValid) { throw new KnownException(ModelState.GetFirstError()); } if (model.Password == null || model.Password.Equals("")) { throw new KnownException("密码为空!"); } //UserDto model = tempModel; model.Closed = model.Closed; model.RegistDate = DateTime.Now; model.UpdateTime = DateTime.Now; string uid = _userManageService.CreateUser(model); var roles = model.Roles; processUserRoles(uid, roles); result.Value = !uid.Equals("0") + ""; }); return(result); }
public ActionResult Registration(NewUserModel userModel) { var status = false; var message = ""; if (ModelState.IsValid) { if (IsLoginExist(userModel.Login)) { ModelState.AddModelError("loginExist", "Пользователь с таким логином уже зарегистрирован"); return(View(userModel)); } if (IsEmailExist(userModel.Email)) { ModelState.AddModelError("emailExist", "Такой email уже зарегистрирован"); return(View(userModel)); } _userService.Create(userModel); FormsAuthentication.SetAuthCookie(userModel.Login, true); message = "Регистрация завершена успешно!"; status = true; } else { message = "Ошибка!"; } ViewBag.Message = message; ViewBag.Status = status; return(View(userModel)); }
// POST: api/Login public HttpResponseMessage Xamarin_reg(NewUserModel input)/*(string firstname, string lastname, string phonenumber, string email, string username, string password)*/ { try { var sama = entities.Employees.Any(u => u.UserName == input.username); if (sama == true) { return(Request.CreateResponse(HttpStatusCode.Unauthorized, "Username is in use. Please try to make up another one." + sama.ToString())); } else { Employee employee = new Employee(); employee.FirstName = input.firstname; employee.LastName = input.lastname; employee.PhoneNumber = input.phonenumber; employee.EmailAddress = input.email; employee.UserName = input.username; employee.Password = input.password; entities.Employees.Add(employee); entities.SaveChanges(); return(Request.CreateResponse(HttpStatusCode.Accepted, "Successfully Created")); } } finally { entities.Dispose(); } }
public async Task <IActionResult> Create([FromBody] NewUserModel user) { try { if (user == null) { return(BadRequest("invalid request payload")); } if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var userAccount = await userService.GetUser(user.Email);; if (userAccount != null) { return(BadRequest("User already exist")); } var result = await userService.CreateUserAsync(new User { Email = user.Email, UserName = string.IsNullOrEmpty(user.UserName) ? user.Email : user.UserName }); return(result == null?StatusCode(204, "") : StatusCode((int)HttpStatusCode.OK, result)); } catch (Exception exception) { return(StatusCode((int)HttpStatusCode.InternalServerError, exception)); } }
public ActionResult <dynamic> EmployeeRegister(NewUserModel model) { // Validate Request if (String.IsNullOrEmpty(model.Username) || String.IsNullOrEmpty(model.Password)) { return(BadRequest(new { Message = "Username or password missing." })); } if (userDAL.GetUser(model.Username) != null) { return(BadRequest(new { Message = "User already exists" })); } // Create the user var hashProvider = new HashProvider(); var hashedPassword = hashProvider.HashPassword(model.Password); var user = new User { Password = hashedPassword.Password, Salt = hashedPassword.Salt, Username = model.Username, Role = "employee" }; userDAL.CreateUser(user); return(Ok()); }
public async Task <ActionResult> UpdatePassword(NewUserModel updatedData) { var secret = Environment.GetEnvironmentVariable("SECRET_HASH"); var existingUser = this.db.Users.FirstOrDefault(f => f.Email == updatedData.Email); if (updatedData.SecretHash == secret) { existingUser.Email = updatedData.Email; existingUser.HashedPassword = ""; existingUser.SecretHash = ""; var hashed = new PasswordHasher <User>().HashPassword(existingUser, updatedData.Password); existingUser.HashedPassword = hashed; await this.db.SaveChangesAsync(); var rv = this.authService.CreateToken(existingUser); return(Ok(rv)); } else if (existingUser != null) { return(BadRequest(new { Message = "user already exists" })); } else { return(BadRequest()); } }
public async Task <ActionResult> SignUpUser(NewUserModel userData) { var existingUserEmail = await this.db.Users.FirstOrDefaultAsync(f => f.Email.ToLower() == userData.Email.ToLower()); if (existingUserEmail != null) { return(BadRequest(new { Message = "email address is already exists" })); } var user = new User { Id = 0, Email = userData.Email.ToLower(), FullName = userData.FullName, HashedPassword = "" }; var hashed = new PasswordHasher <User>().HashPassword(user, userData.Password); user.HashedPassword = hashed; this.db.Users.Add(user); await this.db.SaveChangesAsync(); var rv = new AuthService().CreateToken(user); return(Ok(rv)); }
public ActionResult Register(NewUserModel model) { UserModel userModel = null; if (ModelState.IsValid) { userModel = userService.GetUsers().FirstOrDefault(user => user.Login == model.Login); if (userModel == null) { userService.AddUser(model); userModel = userService.GetUsers().FirstOrDefault(u => u.Login == model.Login); if (userModel != null) { FormsAuthentication.SetAuthCookie(model.Login, true); return(Redirect("/User/Index")); } } else { ModelState.AddModelError("Such an user exists", "User with such a login already exists"); } } return(View(model)); }
public async Task <ActionResult> SignUpUser(NewUserModel userData) { var existingUser = await this._context.Users.FirstOrDefaultAsync(f => f.Username == userData.Username); if (existingUser != null) { return(BadRequest(new { Message = "user already exists" })); } var user = new User { State = userData.State, Username = userData.Username, HashedPassword = "" }; // hash the password var hashed = new PasswordHasher <User>().HashPassword(user, userData.Password); user.HashedPassword = hashed; this._context.Users.Add(user); await this._context.SaveChangesAsync(); var rv = new AuthService(this.configuration).CreateToken(user); return(Ok(rv)); }
public async Task <IActionResult> Register(NewUserModel model) { if (ModelState.IsValid) { EmoteLogUser user = new EmoteLogUser { UserName = model.UserName, FirstName = model.FirstName, LastName = model.LastName, Email = model.Email, CreatedAccount = DateTime.Now }; IdentityResult result = await _userManager.CreateAsync(user, model.Password); if (result.Succeeded) { return(RedirectToAction("Login")); } else { foreach (IdentityError error in result.Errors) { ModelState.AddModelError("", error.Description); } } } return(View(model)); }
public ActionResult NewUser(NewUserModel model) { if (ModelState.IsValid) { int count = dc.NewUsers.Where((c) => c.UserID == model.UserID).Count(); if (count > 0) { ViewBag.msg = "User Already Exists"; } else { MembershipCreateStatus status; Membership.CreateUser(model.UserID, model.Password, model.UserID, "a", "b", true, out status); if (status == MembershipCreateStatus.Success) { Roles.AddUserToRole(model.UserID, "Users"); dc.NewUsers.Add(model); dc.SaveChanges(); ViewBag.msg = "UserAdded" + status; } } } else { ViewBag.msg = "Invalid Model"; } return(View()); }
public async Task <IActionResult> CreateUser(NewUserModel model) { if (string.IsNullOrEmpty(model.Username)) { return(new JsonResult(new { success = false, message = "Username is required" })); } if (string.IsNullOrEmpty(model.Password)) { return(new JsonResult(new { success = false, message = "Password is required" })); } var identityUser = new ApplicationUser(model.Username) { Id = Guid.NewGuid().ToString(), UserName = model.Username, AccountStatus = model.AccountStatus, AccountType = model.AccountType, Email = model.RecoveryEmail, EmailConfirmed = model.RecoveryVerified, PGPPublicKey = model.PGPPublicKey }; var result = await _userManager.CreateAsync(identityUser, model.Password); if (result.Succeeded) { return(new JsonResult(new { success = true, data = identityUser.Id })); } return(new JsonResult(new { success = false, message = "Unable to create user.", identityErrors = result.Errors })); }
public int CreateUser(NewUserModel model) { int userid = 0; try { string strSQL = @" insert into useraccount(username,password,stationid) values(@username,@password,@stationid) SELECT SCOPE_IDENTITY() "; SqlParameter[] parms = new SqlParameter[] { new SqlParameter("@username", SqlDbType.NVarChar, 50), new SqlParameter("@password", SqlDbType.NVarChar, 1024), new SqlParameter("@stationid", SqlDbType.Int), }; parms[0].Value = model.UserName; parms[1].Value = model.Password; parms[2].Value = model.StationID; using (var rdr = SqlHelper.ExecuteReader(SqlHelper.SQLConnectString, CommandType.Text, strSQL, parms)) { if (rdr.Read()) { userid = Convert.ToInt32(rdr[0]); } } } catch (Exception ex) { throw; } return(userid); }
static public ICollection <DeviceEntity> ToDeviceEntity(this NewUserModel newUser) { if (newUser.Devices == null) { return(new List <DeviceEntity>()); } return(newUser?.Devices.Select(d => new DeviceEntity { DeviceName = d.Name, Username = newUser.Username, HaveLightModule = d.HasLight, HaveTempModule = d.HasTemp, HaveHumidityModule = d.HasHumi, HavePHModule = d.HasPH, LightModule = d.HasLight ? new LightModuleEntity { Auto = false, State = false, } : null, TempModule = d.HasTemp ? new TemperatureModuleEntity { Value = 99, UpperAlertOption = false, LowerAlertOption = false, } : null, HumiModule = d.HasHumi ? new HumiModuleEntity { Auto = false, Value = 99, } : null, }).ToList()); }
public ActionResult ValidateRegistration(NewUserModel newuser) { var datauser = (new UserHelper()).GetUserByEmail(newuser.Identity.Email); if (datauser != null) { ViewData["msg"] = $"{newuser.Identity.Email} exists in our database. Please choose a different email"; return(View("Register")); } if (newuser.Secondary != newuser.Identity.Password) { ViewData["msg"] = "Passwords do not match."; return(View("Register")); } var gooduser = new User() { AccountBalance = 500000, Identity = new Identity() { Name = new Name() { First = newuser.Identity.Name.First, Last = newuser.Identity.Name.Last, }, Email = newuser.Identity.Email, Password = newuser.Identity.Password } }; (new UserHelper()).SetUser(gooduser); return(RedirectToAction("Login")); }
public async Task <IActionResult> Register(NewUserModel model, string returnUrl) { object routeValues = null; if (!returnUrl.IsEmptyOrNull()) { routeValues = new { returnUrl = returnUrl } } ; if (ModelState.IsValid) { var response = await user.Register(model); switch (response.StatusCode) { case HttpStatusCode.Conflict: ModelState.AddModelError("All", await response.Content.ReadAsStringAsync()); return(View(model)); case HttpStatusCode.OK: default: return(RedirectToAction("Login", routeValues)); } } else { if (!returnUrl.IsEmptyOrNull()) { ViewData.Add("ReturnUrl", returnUrl); } return(View(model)); } }
public IActionResult Add(NewUserModel model) { if (db == null) { return(View("Error", NO_DB_ERROR)); } if (ModelState.IsValid) { User user = db.GetUser(model.Name); if (user == null) { db.AddUser(new User { Name = model.Name, Email = model.Email, Password = model.Password }); return(RedirectToAction("List")); } ModelState.AddModelError("", "User already exists"); } return(View(model)); }
public async Task <ActionResult> SignUpUser(NewUserModel userData) { var existingUser = await this.db.Users.FirstOrDefaultAsync(f => f.Email.ToLower() == userData.Email.ToLower()); var secret = Environment.GetEnvironmentVariable("SECRET_HASH"); if (userData.SecretHash == secret) { var user = new User { Email = userData.Email, HashedPassword = "", SecretHash = "" }; var hashed = new PasswordHasher <User>().HashPassword(user, userData.Password); user.HashedPassword = hashed; this.db.Users.Add(user); await this.db.SaveChangesAsync(); var rv = this.authService.CreateToken(user); return(Ok(rv)); } else if (existingUser != null) { return(BadRequest(new { Message = "user already exists" })); } else { return(BadRequest()); } }
public async Task <ActionResult> SignUpUser(NewUserModel userData) { var existingUser = await this.db.Users.FirstOrDefaultAsync(f => f.Username == userData.Username); if (existingUser != null) { return(BadRequest(new { Message = "user already exists" })); } var user = new User { Email = userData.Email, FullName = userData.FullName, Username = userData.Username, HashedPassword = "" }; // hash the password var hashed = new PasswordHasher <User>().HashPassword(user, userData.Password); user.HashedPassword = hashed; this.db.Users.Add(user); await this.db.SaveChangesAsync(); return(Ok(user)); }
public IActionResult SignUp([FromBody] NewUserModel newUser) { ProviderBase prof; try { if (newUser == null || !ModelState.IsValid) { return(BadRequest(LoginErrorCode.MissingUserCredentials.ToString())); } if (userRepo.All.Any()) { IEnumerable <ProviderBase> providers; providers = userRepo.All.Where(x => x.email.Equals(newUser.email)); if (providers.Any()) { return(BadRequest(LoginErrorCode.EmailAlreadyInUse.ToString())); } } switch (newUser.role) { case Role.Coordo: prof = new Coordinator(newUser.name, newUser.email, newUser.password, userRepo.NextProfileID()); break; case Role.Urgence: prof = new Urgence(newUser.name, newUser.email, newUser.password, userRepo.NextProfileID()); break; case Role.AIC: prof = new AIC(newUser.name, newUser.email, newUser.password, userRepo.NextProfileID()); break; case Role.Infirmirary: prof = new Infirmirary(newUser.name, newUser.email, newUser.password, userRepo.NextProfileID()); break; case Role.Pediatre: prof = new Resident(newUser.name, newUser.email, newUser.password, userRepo.NextProfileID()); break; default: return(BadRequest(LoginErrorCode.RoleNotValid.ToString())); } userRepo.Insert(prof); } catch (Exception) { return(BadRequest(LoginErrorCode.CouldNotCreateUser.ToString())); } return(Ok(prof)); }
public async Task <IActionResult> Post([FromBody] NewUserModel model) { var salt = StringHelpers.GetRandomString(); var user = new User { Name = model.Name, Email = model.Email, Salt = !string.IsNullOrEmpty(model.Password) ? salt : null, LocationId = model.LocationId, Password = !string.IsNullOrEmpty(model.Password) ? StringHelpers.ToSha1(model.Password, salt) : null, UserType = (short)model.UserType }; try { await this.userService.InsertAsync(user); return(this.Created("GetUserById", user.Id)); } catch (DoctorHouseException ex) { return(this.BadRequest(ex)); } }
public async Task <NewUserModel> EditWithRole([FromBody] NewUserModel model) { var user = await userManager.FindByNameAsync(model.UserName); user.FirstName = model.FirstName; user.Surname = model.Surname; user.Email = model.Email; user.TimeZone = model.TimeZone; user.Language = model.UserLanguage.ToString(); userService.DeleteUserFromRole(user.Id); userService.AddUserRole(user, model.Role); userService.UpdateUser(user); return(new NewUserModel { Id = user.Id, UserName = user.UserName, FirstName = user.FirstName, Surname = user.Surname, Email = user.Email, Role = model.Role, TimeZone = user.TimeZone, UserLanguage = (UserLanguage)Enum.Parse(typeof(UserLanguage), user.Language), }); }
public async Task <IActionResult> Register(NewUserModel model) { if (ModelState.IsValid) { var user = new UserEntity { FullName = model.FullName, UserName = model.Email, Email = model.Email }; var result = await _userManager.CreateAsync(user, model.Password); if (result.Succeeded) { var token = await _userManager.GenerateEmailConfirmationTokenAsync(user); var confirmationLink = Url.Action("ConfirmEmail", "Account", new { userId = user.Id, token }, Request.Scheme); SendEmailCustom(confirmationLink, model.Email, "Congrats! You have successfully confirmed your email! Please follow the confirmation link : "); return(View("RegisterConfirmation")); } foreach (var error in result.Errors) { ModelState.AddModelError("", error.Description); } } return(View(model)); }
protected async Task <UserModel> InsertUserAsync(string email = null, bool authenticate = false) { var model = new NewUserModel { Name = "name", Email = email ?? this.GetRandomEmail(), Password = "******", LocationId = 1 }; var response = await this.PostAsync <BaseModel>("/api/v1/users", model); var user = new UserModel { Id = response.Content.Id, Name = model.Name, Email = model.Email, Location = new LocationModel { Id = model.LocationId } }; if (authenticate) { await this.AuthenticateClient(model.Email); } return(user); }
public IHttpActionResult Patch(NewUserModel user) { try { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } string saltedPassword = String.Empty; string salt = String.Empty; Utility.SaltPassword(user.Password, out salt, out saltedPassword); var id = _usersService.InsertAsync(new UsersModel { UserName = user.UserName, PasswordHash = saltedPassword, Salt = salt, EmailConfirmed = false, PhoneNumberConfirmed = false, LockoutEnabled = false, AccessFailedCount = 0, }).Result; return(Ok(id)); } catch (Exception ex) { //Log error return(InternalServerError(ex)); } }
public async Task <ActionResult> NewUser() { var model = new NewUserModel(); var Baseurl = GetURL(); using (var client = new HttpClient()) { client.BaseAddress = new Uri(Baseurl); client.DefaultRequestHeaders.Clear(); client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); var apiURL = "/api/Values/GetFacilities"; HttpResponseMessage Res = await client.GetAsync(apiURL); if (Res.IsSuccessStatusCode) { var result = await Res.Content.ReadAsStringAsync(); var response = new ResponseHelper(); var output = response.fixListResult(result); model.Facilities = JsonConvert.DeserializeObject <List <Facility> >(output); } } return(Json(new { LocationModal = RenderRazorViewToString("PartialViews/User_Management/_newUserModal", model) }, JsonRequestBehavior.AllowGet )); }
public ActionResult NewUser() { NewUserModel user = new NewUserModel(); user.Date_Created = DateTime.Now; return(View(user)); }
public async Task <IActionResult> NewUser([FromBody] NewUserModel model) { if (!this.IsTokenValid(_tokenService.GetTemporaryToken(this.GetCurrentUserId()))) { throw new UnauthorizedAccessException(); } if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var newUserCommand = _mapper.Map <NewUserCommand>(model); newUserCommand.CurrentUserId = UserId; if (model.NgoId == null || model.NgoId <= 0) { newUserCommand.NgoId = NgoId; } else { newUserCommand.NgoId = (int)model.NgoId; } var newId = await _mediator.Send(newUserCommand); return(Ok(newId)); }
public async Task <ActionResult> CreateUser(NewUserModel model) { if (!ModelState.IsValid) { return(View("New", model)); } var foundUser = UserService.GetUser(model.Username, model.EmailAddress); if (foundUser != null) { ModelState.AddModelError("Username", "A user with this username or email address is already registered."); return(View("New", model)); } if (model.Password != model.PasswordConfirmation) { ModelState.AddModelError("Password", "Passwords did not match."); return(View("New", model)); } AuthenticatedUser user; try { user = await AuthService.Register(model.Username, model.EmailAddress, model.FullName, CredentialBuilder.CreatePbkdf2Password(model.Password)); } catch (EntityException ex) { ModelState.AddModelError("Register", ex.Message); return(View("New", model)); } return(SafeRedirect(Url.AdminUsers())); }
public ActionResult _NewUser() { var model = new NewUserModel() { UserNames = new List<string> { "noco6077", "noco5960", "noco5234", "noco5960", "noco2134", "noco4321", "noco5432", "noco9124", "noco6123", } }; return PartialView("_newUser", model); }
public ActionResult Create(NewUserModel newUser) { if ( ModelState.IsValid ) { UserModel user = new UserModel() { Login = newUser.Login, Password = newUser.Password.HashMD5(), Email = newUser.Email, ActivationCode = (new Random().Next( 1000 )).ToString().HashMD5(), DateOfBirth = null, About = null, NotifyComment = true, NotifyPhoto = true, NotifySubscription = true }; Uri requestUrl = Url.RequestContext.HttpContext.Request.Url; string activationLink = string.Format( "{0}://{1}{2}", requestUrl.Scheme, requestUrl.Authority, Url.Action( "Activate", "User", new { user = Url.Encode( user.Login ), token = user.ActivationCode } ) ); try { Helpers.SendEmail( user.Email, "PastExplorer account activation", string.Format( "Hello, click <a href=\"{0}\">here</a> to activate your PastExplorer account.", activationLink ) ); } catch ( Exception ) { ViewBag.ErrorMessage = "Failed to send activation e-mail message. Please try again later."; return View( newUser ); } UserRepository users = new UserRepository(); users.Create( user ); return View( "Created", user ); } return View( newUser ); }
public ActionResult NewUser() { User user = new User(); NewUserModel model = new NewUserModel { UserId = user.UserId, ExternalId = user.ExternalId, ExternalProviderUri = user.ExternalProviderUri, DisplayName = user.DisplayName, FirstName = user.FirstName, LastName = user.LastName, Description = user.Description, Email = user.Email, TimeZone = user.TimeZone, WebSite = user.WebSite, IsActive = user.IsActive, LastLogin = user.LastLogin, LastIp = user.LastIp, AdminTheme = user.AdminTheme, AdminCulture = user.AdminCulture, CreatedDate = user.CreatedDate, UpdatedDate = user.UpdatedDate, Roles = user.Roles, AllRoles = userService.GetRolesBySite(Context.ManagedSite), TimeZones = new SelectList(TimeZoneUtil.GetTimeZones(), "Key", "Value", user.TimeZone), AdminThemes = new SelectList(GetAdminThemesList(), user.AdminTheme), Cultures = new SelectList(Globalization.GetOrderedCultures(), "Name", "DisplayName", user.AdminCulture) }; return View("NewUser", model); }
public ActionResult Create(NewUserModel userModel, int[] roleIds) { User user = new User(); try { if (ModelState.IsValid) { TryUpdateModel(userModel, new[] { "DisplayName", "Email", "Password", "PasswordConfirmation", "IsActive", "TimeZone", "AdminCulture" }); // server validation string invalidMessage = string.Empty; // Unique Email if (userService.CountOtherUsersBySiteAndEmail(Context.ManagedSite, userModel.Email, user) > 0) { invalidMessage = "Message_UserEmailIsNotUnique"; } // Unique DisplayName Validation if (userService.CountOtherUsersBySiteAndDisplayName(Context.ManagedSite, userModel.DisplayName, user) > 0) { invalidMessage = "Message_UserDisplayNameIsNotUnique"; } if (invalidMessage.Length == 0) { user.Password = user.HashPassword(userModel.Password); user.PasswordConfirmation = user.HashPassword(userModel.PasswordConfirmation); user.Roles.Clear(); if (roleIds != null && roleIds.Length > 0) { IList<Role> roles = userService.GetRolesByIds(roleIds); foreach (Role role in roles) { user.Roles.Add(role); } } user.Site = Context.ManagedSite; user.CreatedDate = DateTime.UtcNow; ServiceResult result = userService.SaveUser(user); if (result.State == ServiceResult.ServiceState.Success) { // Show the confirmation message MessageModel message = new MessageModel { Text = string.Format(GlobalResource("Message_UserCreated"), userModel.DisplayName), Icon = MessageModel.MessageIcon.Info, }; RegisterMessage(message, true); return RedirectToAction("Index"); } else { MessageModel message = new MessageModel { Text = GlobalResource(result.Message), Icon = MessageModel.MessageIcon.Alert, }; RegisterMessage(message); } } else { MessageModel message = new MessageModel { Text = GlobalResource(invalidMessage), Icon = MessageModel.MessageIcon.Alert, CssClass = "margin-topbottom" }; RegisterMessage(message); } } } catch (Exception ex) { log.Error("UsersController.Update", ex); MessageModel message = new MessageModel { Text = GlobalResource("Message_GenericError"), Icon = MessageModel.MessageIcon.Alert, }; RegisterMessage(message); } userModel.Roles = user.Roles; userModel.AllRoles = userService.GetRolesBySite(Context.ManagedSite); userModel.TimeZones = new SelectList(TimeZoneUtil.GetTimeZones(), "Key", "Value", user.TimeZone); userModel.AdminThemes = new SelectList(GetAdminThemesList(), user.AdminTheme); userModel.Cultures = new SelectList(Globalization.GetOrderedCultures(), "Name", "DisplayName", user.AdminCulture); return View("NewUser", userModel); }