feat: support "Use Email as username" in org (#3002)

Signed-off-by: Grégoire Bélorgey <gregoire@jianda.fr>
This commit is contained in:
Grégoire
2024-06-22 10:52:11 +02:00
committed by GitHub
parent 793a7d6cda
commit cff0c7a273
27 changed files with 63 additions and 1 deletions

View File

@ -169,7 +169,11 @@ func (c *ApiController) Signup() {
username := authForm.Username username := authForm.Username
if !application.IsSignupItemVisible("Username") { if !application.IsSignupItemVisible("Username") {
username = id if organization.UseEmailAsUsername && application.IsSignupItemVisible("Email") {
username = authForm.Email
} else {
username = id
}
} }
initScore, err := organization.GetInitScore() initScore, err := organization.GetInitScore()

View File

@ -108,6 +108,7 @@ func initBuiltInOrganization() bool {
AccountItems: getBuiltInAccountItems(), AccountItems: getBuiltInAccountItems(),
EnableSoftDeletion: false, EnableSoftDeletion: false,
IsProfilePublic: false, IsProfilePublic: false,
UseEmailAsUsername: false,
} }
_, err = AddOrganization(organization) _, err = AddOrganization(organization)
if err != nil { if err != nil {

View File

@ -72,6 +72,7 @@ type Organization struct {
InitScore int `json:"initScore"` InitScore int `json:"initScore"`
EnableSoftDeletion bool `json:"enableSoftDeletion"` EnableSoftDeletion bool `json:"enableSoftDeletion"`
IsProfilePublic bool `json:"isProfilePublic"` IsProfilePublic bool `json:"isProfilePublic"`
UseEmailAsUsername bool `json:"useEmailAsUsername"`
MfaItems []*MfaItem `xorm:"varchar(300)" json:"mfaItems"` MfaItems []*MfaItem `xorm:"varchar(300)" json:"mfaItems"`
AccountItems []*AccountItem `xorm:"varchar(5000)" json:"accountItems"` AccountItems []*AccountItem `xorm:"varchar(5000)" json:"accountItems"`

View File

@ -436,6 +436,16 @@ class OrganizationEditPage extends React.Component {
}} /> }} />
</Col> </Col>
</Row> </Row>
<Row style={{marginTop: "20px"}} >
<Col style={{marginTop: "5px"}} span={(Setting.isMobile()) ? 19 : 2}>
{Setting.getLabel(i18next.t("organization:Use Email as username"), i18next.t("organization:Use Email as username - Tooltip"))} :
</Col>
<Col span={1} >
<Switch checked={this.state.organization.useEmailAsUsername} onChange={checked => {
this.updateOrganizationField("useEmailAsUsername", checked);
}} />
</Col>
</Row>
<Row style={{marginTop: "20px"}} > <Row style={{marginTop: "20px"}} >
<Col style={{marginTop: "5px"}} span={(Setting.isMobile()) ? 22 : 2}> <Col style={{marginTop: "5px"}} span={(Setting.isMobile()) ? 22 : 2}>
{Setting.getLabel(i18next.t("organization:Account items"), i18next.t("organization:Account items - Tooltip"))} : {Setting.getLabel(i18next.t("organization:Account items"), i18next.t("organization:Account items - Tooltip"))} :

View File

@ -576,6 +576,8 @@
"Soft deletion - Tooltip": "When enabled, deleting users will not completely remove them from the database. Instead, they will be marked as deleted", "Soft deletion - Tooltip": "When enabled, deleting users will not completely remove them from the database. Instead, they will be marked as deleted",
"Tags": "Tags", "Tags": "Tags",
"Tags - Tooltip": "Collection of tags available for users to choose from", "Tags - Tooltip": "Collection of tags available for users to choose from",
"Use Email as username": "Use Email as username",
"Use Email as username - Tooltip": "Use Email as username if the username field is not visible at signup",
"View rule": "View rule", "View rule": "View rule",
"Visible": "Visible", "Visible": "Visible",
"Website URL": "Website URL", "Website URL": "Website URL",

View File

@ -576,6 +576,8 @@
"Soft deletion - Tooltip": "Wenn aktiviert, werden gelöschte Benutzer nicht vollständig aus der Datenbank entfernt. Stattdessen werden sie als gelöscht markiert", "Soft deletion - Tooltip": "Wenn aktiviert, werden gelöschte Benutzer nicht vollständig aus der Datenbank entfernt. Stattdessen werden sie als gelöscht markiert",
"Tags": "Tags", "Tags": "Tags",
"Tags - Tooltip": "Sammlung von Tags, die für Benutzer zur Auswahl zur Verfügung stehen", "Tags - Tooltip": "Sammlung von Tags, die für Benutzer zur Auswahl zur Verfügung stehen",
"Use Email as username": "Use Email as username",
"Use Email as username - Tooltip": "Use Email as username if the username field is not visible at signup",
"View rule": "Ansichtsregel", "View rule": "Ansichtsregel",
"Visible": "Sichtbar", "Visible": "Sichtbar",
"Website URL": "Website-URL", "Website URL": "Website-URL",

View File

@ -576,6 +576,8 @@
"Soft deletion - Tooltip": "When enabled, deleting users will not completely remove them from the database. Instead, they will be marked as deleted", "Soft deletion - Tooltip": "When enabled, deleting users will not completely remove them from the database. Instead, they will be marked as deleted",
"Tags": "Tags", "Tags": "Tags",
"Tags - Tooltip": "Collection of tags available for users to choose from", "Tags - Tooltip": "Collection of tags available for users to choose from",
"Use Email as username": "Use Email as username",
"Use Email as username - Tooltip": "Use Email as username if the username field is not visible at signup",
"View rule": "View rule", "View rule": "View rule",
"Visible": "Visible", "Visible": "Visible",
"Website URL": "Website URL", "Website URL": "Website URL",

View File

@ -576,6 +576,8 @@
"Soft deletion - Tooltip": "Cuando se habilita, la eliminación de usuarios no los eliminará por completo de la base de datos. En su lugar, se marcarán como eliminados", "Soft deletion - Tooltip": "Cuando se habilita, la eliminación de usuarios no los eliminará por completo de la base de datos. En su lugar, se marcarán como eliminados",
"Tags": "Etiquetas", "Tags": "Etiquetas",
"Tags - Tooltip": "Colección de etiquetas disponibles para que los usuarios elijan", "Tags - Tooltip": "Colección de etiquetas disponibles para que los usuarios elijan",
"Use Email as username": "Use Email as username",
"Use Email as username - Tooltip": "Use Email as username if the username field is not visible at signup",
"View rule": "Regla de visualización", "View rule": "Regla de visualización",
"Visible": "Visible - Visible", "Visible": "Visible - Visible",
"Website URL": "URL del sitio web", "Website URL": "URL del sitio web",

View File

@ -576,6 +576,8 @@
"Soft deletion - Tooltip": "When enabled, deleting users will not completely remove them from the database. Instead, they will be marked as deleted", "Soft deletion - Tooltip": "When enabled, deleting users will not completely remove them from the database. Instead, they will be marked as deleted",
"Tags": "Tags", "Tags": "Tags",
"Tags - Tooltip": "Collection of tags available for users to choose from", "Tags - Tooltip": "Collection of tags available for users to choose from",
"Use Email as username": "Use Email as username",
"Use Email as username - Tooltip": "Use Email as username if the username field is not visible at signup",
"View rule": "View rule", "View rule": "View rule",
"Visible": "Visible", "Visible": "Visible",
"Website URL": "Website URL", "Website URL": "Website URL",

View File

@ -576,6 +576,8 @@
"Soft deletion - Tooltip": "When enabled, deleting users will not completely remove them from the database. Instead, they will be marked as deleted", "Soft deletion - Tooltip": "When enabled, deleting users will not completely remove them from the database. Instead, they will be marked as deleted",
"Tags": "Tags", "Tags": "Tags",
"Tags - Tooltip": "Collection of tags available for users to choose from", "Tags - Tooltip": "Collection of tags available for users to choose from",
"Use Email as username": "Use Email as username",
"Use Email as username - Tooltip": "Use Email as username if the username field is not visible at signup",
"View rule": "View rule", "View rule": "View rule",
"Visible": "Visible", "Visible": "Visible",
"Website URL": "Website URL", "Website URL": "Website URL",

View File

@ -576,6 +576,8 @@
"Soft deletion - Tooltip": "Lorsque c'est activée, la suppression de compte ne les retirera pas complètement de la base de données. Au lieu de cela, ils seront marqués comme supprimés", "Soft deletion - Tooltip": "Lorsque c'est activée, la suppression de compte ne les retirera pas complètement de la base de données. Au lieu de cela, ils seront marqués comme supprimés",
"Tags": "Étiquettes", "Tags": "Étiquettes",
"Tags - Tooltip": "Collection d'étiquettes disponibles pour les comptes", "Tags - Tooltip": "Collection d'étiquettes disponibles pour les comptes",
"Use Email as username": "Utiliser l'e-mail comme identifiant",
"Use Email as username - Tooltip": "Utiliser l'adresse e-mail comme identifiant pour les comptes lorsque l'identifiant ne fait pas partie des champs d'inscription",
"View rule": "Règle de visibilité", "View rule": "Règle de visibilité",
"Visible": "Visible", "Visible": "Visible",
"Website URL": "URL du site web", "Website URL": "URL du site web",

View File

@ -576,6 +576,8 @@
"Soft deletion - Tooltip": "When enabled, deleting users will not completely remove them from the database. Instead, they will be marked as deleted", "Soft deletion - Tooltip": "When enabled, deleting users will not completely remove them from the database. Instead, they will be marked as deleted",
"Tags": "Tags", "Tags": "Tags",
"Tags - Tooltip": "Collection of tags available for users to choose from", "Tags - Tooltip": "Collection of tags available for users to choose from",
"Use Email as username": "Use Email as username",
"Use Email as username - Tooltip": "Use Email as username if the username field is not visible at signup",
"View rule": "View rule", "View rule": "View rule",
"Visible": "Visible", "Visible": "Visible",
"Website URL": "Website URL", "Website URL": "Website URL",

View File

@ -576,6 +576,8 @@
"Soft deletion - Tooltip": "Ketika diaktifkan, menghapus pengguna tidak akan sepenuhnya menghapus mereka dari database. Sebaliknya, mereka akan ditandai sebagai dihapus", "Soft deletion - Tooltip": "Ketika diaktifkan, menghapus pengguna tidak akan sepenuhnya menghapus mereka dari database. Sebaliknya, mereka akan ditandai sebagai dihapus",
"Tags": "Tag-tag", "Tags": "Tag-tag",
"Tags - Tooltip": "Kumpulan tag yang tersedia bagi pengguna untuk dipilih", "Tags - Tooltip": "Kumpulan tag yang tersedia bagi pengguna untuk dipilih",
"Use Email as username": "Use Email as username",
"Use Email as username - Tooltip": "Use Email as username if the username field is not visible at signup",
"View rule": "Aturan tampilan", "View rule": "Aturan tampilan",
"Visible": "Terlihat", "Visible": "Terlihat",
"Website URL": "URL situs web", "Website URL": "URL situs web",

View File

@ -576,6 +576,8 @@
"Soft deletion - Tooltip": "When enabled, deleting users will not completely remove them from the database. Instead, they will be marked as deleted", "Soft deletion - Tooltip": "When enabled, deleting users will not completely remove them from the database. Instead, they will be marked as deleted",
"Tags": "Tags", "Tags": "Tags",
"Tags - Tooltip": "Collection of tags available for users to choose from", "Tags - Tooltip": "Collection of tags available for users to choose from",
"Use Email as username": "Use Email as username",
"Use Email as username - Tooltip": "Use Email as username if the username field is not visible at signup",
"View rule": "View rule", "View rule": "View rule",
"Visible": "Visible", "Visible": "Visible",
"Website URL": "Website URL", "Website URL": "Website URL",

View File

@ -576,6 +576,8 @@
"Soft deletion - Tooltip": "有効になっている場合、ユーザーを削除しても完全にデータベースから削除されません。代わりに、削除されたとマークされます", "Soft deletion - Tooltip": "有効になっている場合、ユーザーを削除しても完全にデータベースから削除されません。代わりに、削除されたとマークされます",
"Tags": "タグ", "Tags": "タグ",
"Tags - Tooltip": "ユーザーが選択できるタグのコレクション", "Tags - Tooltip": "ユーザーが選択できるタグのコレクション",
"Use Email as username": "Use Email as username",
"Use Email as username - Tooltip": "Use Email as username if the username field is not visible at signup",
"View rule": "ビュールール", "View rule": "ビュールール",
"Visible": "見える", "Visible": "見える",
"Website URL": "ウェブサイトのURL", "Website URL": "ウェブサイトのURL",

View File

@ -576,6 +576,8 @@
"Soft deletion - Tooltip": "When enabled, deleting users will not completely remove them from the database. Instead, they will be marked as deleted", "Soft deletion - Tooltip": "When enabled, deleting users will not completely remove them from the database. Instead, they will be marked as deleted",
"Tags": "Tags", "Tags": "Tags",
"Tags - Tooltip": "Collection of tags available for users to choose from", "Tags - Tooltip": "Collection of tags available for users to choose from",
"Use Email as username": "Use Email as username",
"Use Email as username - Tooltip": "Use Email as username if the username field is not visible at signup",
"View rule": "View rule", "View rule": "View rule",
"Visible": "Visible", "Visible": "Visible",
"Website URL": "Website URL", "Website URL": "Website URL",

View File

@ -576,6 +576,8 @@
"Soft deletion - Tooltip": "사용 가능한 경우, 사용자 삭제 시 데이터베이스에서 완전히 삭제되지 않습니다. 대신 삭제됨으로 표시됩니다", "Soft deletion - Tooltip": "사용 가능한 경우, 사용자 삭제 시 데이터베이스에서 완전히 삭제되지 않습니다. 대신 삭제됨으로 표시됩니다",
"Tags": "태그", "Tags": "태그",
"Tags - Tooltip": "사용자가 선택할 수 있는 태그 컬렉션", "Tags - Tooltip": "사용자가 선택할 수 있는 태그 컬렉션",
"Use Email as username": "Use Email as username",
"Use Email as username - Tooltip": "Use Email as username if the username field is not visible at signup",
"View rule": "보기 규칙", "View rule": "보기 규칙",
"Visible": "보이는", "Visible": "보이는",
"Website URL": "웹사이트 URL", "Website URL": "웹사이트 URL",

View File

@ -576,6 +576,8 @@
"Soft deletion - Tooltip": "When enabled, deleting users will not completely remove them from the database. Instead, they will be marked as deleted", "Soft deletion - Tooltip": "When enabled, deleting users will not completely remove them from the database. Instead, they will be marked as deleted",
"Tags": "Tags", "Tags": "Tags",
"Tags - Tooltip": "Collection of tags available for users to choose from", "Tags - Tooltip": "Collection of tags available for users to choose from",
"Use Email as username": "Use Email as username",
"Use Email as username - Tooltip": "Use Email as username if the username field is not visible at signup",
"View rule": "View rule", "View rule": "View rule",
"Visible": "Visible", "Visible": "Visible",
"Website URL": "Website URL", "Website URL": "Website URL",

View File

@ -576,6 +576,8 @@
"Soft deletion - Tooltip": "When enabled, deleting users will not completely remove them from the database. Instead, they will be marked as deleted", "Soft deletion - Tooltip": "When enabled, deleting users will not completely remove them from the database. Instead, they will be marked as deleted",
"Tags": "Tags", "Tags": "Tags",
"Tags - Tooltip": "Collection of tags available for users to choose from", "Tags - Tooltip": "Collection of tags available for users to choose from",
"Use Email as username": "Use Email as username",
"Use Email as username - Tooltip": "Use Email as username if the username field is not visible at signup",
"View rule": "View rule", "View rule": "View rule",
"Visible": "Visible", "Visible": "Visible",
"Website URL": "Website URL", "Website URL": "Website URL",

View File

@ -576,6 +576,8 @@
"Soft deletion - Tooltip": "When enabled, deleting users will not completely remove them from the database. Instead, they will be marked as deleted", "Soft deletion - Tooltip": "When enabled, deleting users will not completely remove them from the database. Instead, they will be marked as deleted",
"Tags": "Tags", "Tags": "Tags",
"Tags - Tooltip": "Collection of tags available for users to choose from", "Tags - Tooltip": "Collection of tags available for users to choose from",
"Use Email as username": "Use Email as username",
"Use Email as username - Tooltip": "Use Email as username if the username field is not visible at signup",
"View rule": "View rule", "View rule": "View rule",
"Visible": "Visible", "Visible": "Visible",
"Website URL": "Website URL", "Website URL": "Website URL",

View File

@ -576,6 +576,8 @@
"Soft deletion - Tooltip": "Quando ativada, a exclusão de usuários não os removerá completamente do banco de dados. Em vez disso, eles serão marcados como excluídos", "Soft deletion - Tooltip": "Quando ativada, a exclusão de usuários não os removerá completamente do banco de dados. Em vez disso, eles serão marcados como excluídos",
"Tags": "Tags", "Tags": "Tags",
"Tags - Tooltip": "Coleção de tags disponíveis para os usuários escolherem", "Tags - Tooltip": "Coleção de tags disponíveis para os usuários escolherem",
"Use Email as username": "Use Email as username",
"Use Email as username - Tooltip": "Use Email as username if the username field is not visible at signup",
"View rule": "Ver regra", "View rule": "Ver regra",
"Visible": "Visível", "Visible": "Visível",
"Website URL": "URL do website", "Website URL": "URL do website",

View File

@ -576,6 +576,8 @@
"Soft deletion - Tooltip": "Когда включено, удаление пользователей не полностью удаляет их из базы данных. Вместо этого они будут помечены как удаленные", "Soft deletion - Tooltip": "Когда включено, удаление пользователей не полностью удаляет их из базы данных. Вместо этого они будут помечены как удаленные",
"Tags": "Теги", "Tags": "Теги",
"Tags - Tooltip": "Коллекция тегов, доступных для выбора пользователями", "Tags - Tooltip": "Коллекция тегов, доступных для выбора пользователями",
"Use Email as username": "Use Email as username",
"Use Email as username - Tooltip": "Use Email as username if the username field is not visible at signup",
"View rule": "Правило просмотра", "View rule": "Правило просмотра",
"Visible": "Видимый", "Visible": "Видимый",
"Website URL": "Веб-адрес сайта", "Website URL": "Веб-адрес сайта",

View File

@ -576,6 +576,8 @@
"Soft deletion - Tooltip": "When enabled, deleting users will not completely remove them from the database. Instead, they will be marked as deleted", "Soft deletion - Tooltip": "When enabled, deleting users will not completely remove them from the database. Instead, they will be marked as deleted",
"Tags": "Tags", "Tags": "Tags",
"Tags - Tooltip": "Collection of tags available for users to choose from", "Tags - Tooltip": "Collection of tags available for users to choose from",
"Use Email as username": "Use Email as username",
"Use Email as username - Tooltip": "Use Email as username if the username field is not visible at signup",
"View rule": "View rule", "View rule": "View rule",
"Visible": "Visible", "Visible": "Visible",
"Website URL": "Website URL", "Website URL": "Website URL",

View File

@ -576,6 +576,8 @@
"Soft deletion - Tooltip": "When enabled, deleting users will not completely remove them from the database. Instead, they will be marked as deleted", "Soft deletion - Tooltip": "When enabled, deleting users will not completely remove them from the database. Instead, they will be marked as deleted",
"Tags": "Tags", "Tags": "Tags",
"Tags - Tooltip": "Collection of tags available for users to choose from", "Tags - Tooltip": "Collection of tags available for users to choose from",
"Use Email as username": "Use Email as username",
"Use Email as username - Tooltip": "Use Email as username if the username field is not visible at signup",
"View rule": "View rule", "View rule": "View rule",
"Visible": "Görünür", "Visible": "Görünür",
"Website URL": "Web Sitesi URL'si", "Website URL": "Web Sitesi URL'si",

View File

@ -576,6 +576,8 @@
"Soft deletion - Tooltip": "Якщо ввімкнено, видалення користувачів не призведе до їх повного видалення з бази даних. ", "Soft deletion - Tooltip": "Якщо ввімкнено, видалення користувачів не призведе до їх повного видалення з бази даних. ",
"Tags": "Теги", "Tags": "Теги",
"Tags - Tooltip": "Колекція тегів, доступна для вибору користувачами", "Tags - Tooltip": "Колекція тегів, доступна для вибору користувачами",
"Use Email as username": "Use Email as username",
"Use Email as username - Tooltip": "Use Email as username if the username field is not visible at signup",
"View rule": "Переглянути правило", "View rule": "Переглянути правило",
"Visible": "Видно", "Visible": "Видно",
"Website URL": "адреса вебсайту", "Website URL": "адреса вебсайту",

View File

@ -576,6 +576,8 @@
"Soft deletion - Tooltip": "Khi được bật, việc xóa người dùng sẽ không hoàn toàn loại bỏ họ khỏi cơ sở dữ liệu. Thay vào đó, họ sẽ được đánh dấu là đã bị xóa", "Soft deletion - Tooltip": "Khi được bật, việc xóa người dùng sẽ không hoàn toàn loại bỏ họ khỏi cơ sở dữ liệu. Thay vào đó, họ sẽ được đánh dấu là đã bị xóa",
"Tags": "Thẻ", "Tags": "Thẻ",
"Tags - Tooltip": "Bộ sưu tập các thẻ có sẵn cho người dùng lựa chọn", "Tags - Tooltip": "Bộ sưu tập các thẻ có sẵn cho người dùng lựa chọn",
"Use Email as username": "Use Email as username",
"Use Email as username - Tooltip": "Use Email as username if the username field is not visible at signup",
"View rule": "Xem quy tắc", "View rule": "Xem quy tắc",
"Visible": "Rõ ràng", "Visible": "Rõ ràng",
"Website URL": "Địa chỉ trang web", "Website URL": "Địa chỉ trang web",

View File

@ -576,6 +576,8 @@
"Soft deletion - Tooltip": "启用后,删除一个用户时不会在数据库彻底清除,只会标记为已删除状态", "Soft deletion - Tooltip": "启用后,删除一个用户时不会在数据库彻底清除,只会标记为已删除状态",
"Tags": "标签集合", "Tags": "标签集合",
"Tags - Tooltip": "可供用户选择的标签集合", "Tags - Tooltip": "可供用户选择的标签集合",
"Use Email as username": "Use Email as username",
"Use Email as username - Tooltip": "Use Email as username if the username field is not visible at signup",
"View rule": "查看规则", "View rule": "查看规则",
"Visible": "是否可见", "Visible": "是否可见",
"Website URL": "主页地址", "Website URL": "主页地址",