private UsersModification getMod() { if (AppTools.User != null) { return(UsersTableRetrieval.GetRowMatchingId(AppTools.User.UserId).ToModification()); } var mod = UsersModification.CreateForInsert(); mod.ProfilePictureUrl = ""; mod.ShortBio = ""; return(mod); }
void FormsAuthCapableUserManagementProvider.InsertOrUpdateUser( int?userId, string email, int roleId, Instant?lastRequestTime, int salt, byte[] saltedPassword, bool mustChangePassword) { if (userId.HasValue) { var userMod = UsersModification.CreateForUpdate(new UsersTableEqualityConditions.UserId(userId.Value)); userMod.EmailAddress = email; userMod.Salt = salt; userMod.SaltedPassword = saltedPassword; userMod.Execute(); } else { UsersModification.InsertRow(MainSequence.GetNextValue(), "", email, "", email, salt, saltedPassword); } }
private FlowComponent getFormItemStack(UsersModification mod, DataValue <string> password) { var stack = FormItemList.CreateStack(); if (AppTools.User != null) { stack.AddItem(mod.GetProfilePictureUrlUrlControlFormItem(true, label: "URL of profile picture".ToComponents())); } stack.AddItem(mod.GetUsernameTextControlFormItem(false, label: "Username".ToComponents(), value: AppTools.User == null ? "" : null)); if (AppTools.User != null) { stack.AddItem( mod.GetShortBioTextControlFormItem(true, label: "Short bio about you".ToComponents(), controlSetup: TextControlSetup.Create(numberOfRows: 8))); } stack.AddItem(mod.GetEmailAddressEmailAddressControlFormItem(false, label: "Email".ToComponents(), value: AppTools.User == null ? "" : null)); if (AppTools.User == null) { stack.AddItems(password.GetPasswordModificationFormItems()); } else { var changePasswordChecked = new DataValue <bool>(); stack.AddItem( changePasswordChecked.ToFlowCheckbox( "Change password".ToComponents(), setup: FlowCheckboxSetup.Create( nestedContentGetter: () => FormState.ExecuteWithValidationPredicate( () => changePasswordChecked.Value, () => FormItemList.CreateGrid(1, items: password.GetPasswordModificationFormItems()).ToCollection())), value: false) .ToFormItem()); } return(stack); }