diff options
Diffstat (limited to 'templates/admin/user')
-rw-r--r-- | templates/admin/user/edit.tmpl | 235 | ||||
-rw-r--r-- | templates/admin/user/list.tmpl | 119 | ||||
-rw-r--r-- | templates/admin/user/new.tmpl | 90 | ||||
-rw-r--r-- | templates/admin/user/view.tmpl | 48 | ||||
-rw-r--r-- | templates/admin/user/view_details.tmpl | 74 | ||||
-rw-r--r-- | templates/admin/user/view_emails.tmpl | 19 |
6 files changed, 585 insertions, 0 deletions
diff --git a/templates/admin/user/edit.tmpl b/templates/admin/user/edit.tmpl new file mode 100644 index 00000000..8203a2a0 --- /dev/null +++ b/templates/admin/user/edit.tmpl @@ -0,0 +1,235 @@ +{{template "admin/layout_head" (dict "ctxData" . "pageClass" "admin edit user")}} + <div class="admin-setting-content"> + <h4 class="ui top attached header"> + {{ctx.Locale.Tr "admin.users.edit_account"}} + </h4> + <div class="ui attached segment"> + <form class="ui form" action="./edit" method="post"> + {{template "base/disable_form_autofill"}} + {{.CsrfTokenHtml}} + <div class="field {{if .Err_UserName}}error{{end}}"> + <label for="user_name">{{ctx.Locale.Tr "username"}}</label> + <input id="user_name" name="user_name" value="{{.User.Name}}" autofocus {{if not .User.IsLocal}}disabled{{end}} maxlength="40"> + </div> + <!-- Types and name --> + <div class="inline required field {{if .Err_LoginType}}error{{end}}"> + <label>{{ctx.Locale.Tr "admin.users.auth_source"}}</label> + <div class="ui selection type dropdown"> + <input type="hidden" id="login_type" name="login_type" value="{{.LoginSource.Type.Int}}-{{.LoginSource.ID}}" required> + <div class="text">{{ctx.Locale.Tr "admin.users.local"}}</div> + {{svg "octicon-triangle-down" 14 "dropdown icon"}} + <div class="menu"> + <div class="item" data-value="0-0">{{ctx.Locale.Tr "admin.users.local"}}</div> + {{range .Sources}} + <div class="item" data-value="{{.Type.Int}}-{{.ID}}">{{.Name}}</div> + {{end}} + </div> + </div> + </div> + + <div class="inline field {{if .Err_Visibility}}error{{end}}"> + <span class="inline required field"><label for="visibility">{{ctx.Locale.Tr "settings.visibility"}}</label></span> + <div class="ui selection type dropdown"> + {{if .User.Visibility.IsPublic}}<input type="hidden" id="visibility" name="visibility" value="0">{{end}} + {{if .User.Visibility.IsLimited}}<input type="hidden" id="visibility" name="visibility" value="1">{{end}} + {{if .User.Visibility.IsPrivate}}<input type="hidden" id="visibility" name="visibility" value="2">{{end}} + <div class="text"> + {{if .User.Visibility.IsPublic}}{{ctx.Locale.Tr "settings.visibility.public"}}{{end}} + {{if .User.Visibility.IsLimited}}{{ctx.Locale.Tr "settings.visibility.limited"}}{{end}} + {{if .User.Visibility.IsPrivate}}{{ctx.Locale.Tr "settings.visibility.private"}}{{end}} + </div> + {{svg "octicon-triangle-down" 14 "dropdown icon"}} + <div class="menu"> + {{range $mode := .AllowedUserVisibilityModes}} + {{if $mode.IsPublic}} + <div class="item" data-tooltip-content="{{ctx.Locale.Tr "settings.visibility.public_tooltip"}}" data-value="0">{{ctx.Locale.Tr "settings.visibility.public"}}</div> + {{else if $mode.IsLimited}} + <div class="item" data-tooltip-content="{{ctx.Locale.Tr "settings.visibility.limited_tooltip"}}" data-value="1">{{ctx.Locale.Tr "settings.visibility.limited"}}</div> + {{else if $mode.IsPrivate}} + <div class="item" data-tooltip-content="{{ctx.Locale.Tr "settings.visibility.private_tooltip"}}" data-value="2">{{ctx.Locale.Tr "settings.visibility.private"}}</div> + {{end}} + {{end}} + </div> + </div> + </div> + + <div class="required non-local field {{if .Err_LoginName}}error{{end}} {{if eq .User.LoginSource 0}}tw-hidden{{end}}"> + <label for="login_name">{{ctx.Locale.Tr "admin.users.auth_login_name"}}</label> + <input id="login_name" name="login_name" value="{{.User.LoginName}}" autofocus> + </div> + <div class="field {{if .Err_FullName}}error{{end}}"> + <label for="full_name">{{ctx.Locale.Tr "settings.full_name"}}</label> + <input id="full_name" name="full_name" value="{{.User.FullName}}" maxlength="100"> + </div> + <div class="field"> + <label for="pronouns">{{ctx.Locale.Tr "settings.pronouns"}}</label> + <input id="pronouns" name="pronouns" value="{{.User.Pronouns}}" maxlength="50"> + </div> + <div class="required field {{if .Err_Email}}error{{end}}"> + <label for="email">{{ctx.Locale.Tr "email"}}</label> + <input id="email" name="email" type="email" value="{{.User.Email}}" autofocus required> + </div> + <div class="local field {{if .Err_Password}}error{{end}} {{if not (or (.User.IsLocal) (.User.IsOAuth2))}}tw-hidden{{end}}"> + <label for="password">{{ctx.Locale.Tr "password"}}</label> + <input id="password" name="password" type="password" autocomplete="new-password"> + <p class="help">{{ctx.Locale.Tr "admin.users.password_helper"}}</p> + </div> + + <div class="field {{if .Err_Language}}error{{end}}"> + <label for="language">{{ctx.Locale.Tr "settings.language"}}</label> + <div class="ui selection dropdown"> + <input name="language" type="hidden" value="{{.User.Language}}"> + {{svg "octicon-triangle-down" 14 "dropdown icon"}} + <div class="text">{{range .AllLangs}}{{if eq $.User.Language .Lang}}{{.Name}}{{end}}{{end}}</div> + <div class="menu"> + {{range .AllLangs}} + <div class="item{{if eq $.User.Language .Lang}} active selected{{end}}" data-value="{{.Lang}}">{{.Name}}</div> + {{end}} + </div> + </div> + </div> + + <div class="field {{if .Err_Website}}error{{end}}"> + <label for="website">{{ctx.Locale.Tr "settings.website"}}</label> + <input id="website" name="website" type="url" value="{{.User.Website}}" placeholder="http://mydomain.com or https://mydomain.com" maxlength="255"> + </div> + <div class="field {{if .Err_Location}}error{{end}}"> + <label for="location">{{ctx.Locale.Tr "settings.location"}}</label> + <input id="location" name="location" value="{{.User.Location}}" maxlength="50"> + </div> + + <div class="divider"></div> + + <div class="inline field {{if .Err_MaxRepoCreation}}error{{end}}"> + <label for="max_repo_creation">{{ctx.Locale.Tr "admin.users.max_repo_creation"}}</label> + <input id="max_repo_creation" name="max_repo_creation" type="number" min="-1" value="{{.User.MaxRepoCreation}}"> + <p class="help">{{ctx.Locale.Tr "admin.users.max_repo_creation_desc"}}</p> + </div> + + <div class="divider"></div> + + <div class="inline field"> + <div class="ui checkbox"> + <label><strong>{{ctx.Locale.Tr "admin.users.is_activated"}}</strong></label> + <input name="active" type="checkbox" {{if .User.IsActive}}checked{{end}}> + </div> + </div> + <div class="inline field"> + <div class="ui checkbox"> + <label><strong>{{ctx.Locale.Tr "admin.users.prohibit_login"}}</strong></label> + <input name="prohibit_login" type="checkbox" {{if .User.ProhibitLogin}}checked{{end}} {{if (eq .User.ID .SignedUserID)}}disabled{{end}}> + </div> + </div> + <div class="inline field"> + <div class="ui checkbox"> + <label><strong>{{ctx.Locale.Tr "admin.users.is_admin"}}</strong></label> + <input name="admin" type="checkbox" {{if .User.IsAdmin}}checked{{end}}> + </div> + </div> + <div class="inline field"> + <div class="ui checkbox"> + <label><strong>{{ctx.Locale.Tr "admin.users.is_restricted"}}</strong></label> + <input name="restricted" type="checkbox" {{if .User.IsRestricted}}checked{{end}}> + </div> + </div> + <div class="inline field {{if DisableGitHooks}}tw-hidden{{end}}"> + <div class="ui checkbox" data-tooltip-content="{{ctx.Locale.Tr "admin.users.allow_git_hook_tooltip"}}"> + <label><strong>{{ctx.Locale.Tr "admin.users.allow_git_hook"}}</strong></label> + <input name="allow_git_hook" type="checkbox" {{if .User.CanEditGitHook}}checked{{end}} {{if DisableGitHooks}}disabled{{end}}> + </div> + </div> + <div class="inline field {{if or (DisableImportLocal) (.DisableMigrations)}}tw-hidden{{end}}"> + <div class="ui checkbox"> + <label><strong>{{ctx.Locale.Tr "admin.users.allow_import_local"}}</strong></label> + <input name="allow_import_local" type="checkbox" {{if .User.CanImportLocal}}checked{{end}} {{if DisableImportLocal}}disabled{{end}}> + </div> + </div> + {{if not .DisableRegularOrgCreation}} + <div class="inline field"> + <div class="ui checkbox"> + <label><strong>{{ctx.Locale.Tr "admin.users.allow_create_organization"}}</strong></label> + <input name="allow_create_organization" type="checkbox" {{if .User.CanCreateOrganization}}checked{{end}}> + </div> + </div> + {{end}} + + {{if .TwoFactorEnabled}} + <div class="divider"></div> + <div class="inline field"> + <div class="ui checkbox"> + <label><strong>{{ctx.Locale.Tr "admin.users.reset_2fa"}}</strong></label> + <input name="reset_2fa" type="checkbox"> + </div> + </div> + {{end}} + + <div class="divider"></div> + + <div class="field"> + <button class="ui primary button">{{ctx.Locale.Tr "admin.users.update_profile"}}</button> + <button class="ui red button show-modal" data-modal="#delete-user-modal">{{ctx.Locale.Tr "admin.users.delete_account"}}</button> + </div> + </form> + </div> + + <h4 class="ui top attached header"> + {{ctx.Locale.Tr "settings.avatar"}} + </h4> + <div class="ui attached segment"> + <form class="ui form" action="./avatar" method="post" enctype="multipart/form-data"> + {{.CsrfTokenHtml}} + {{if not .DisableGravatar}} + <div class="inline field"> + <div class="ui radio checkbox"> + <input name="source" value="lookup" type="radio" {{if not .User.UseCustomAvatar}}checked{{end}}> + <label>{{ctx.Locale.Tr "settings.lookup_avatar_by_mail"}}</label> + </div> + </div> + <div class="field tw-pl-4 {{if .Err_Gravatar}}error{{end}}"> + <label for="gravatar">Avatar {{ctx.Locale.Tr "email"}}</label> + <input id="gravatar" name="gravatar" value="{{.User.AvatarEmail}}"> + </div> + {{end}} + + <div class="inline field"> + <div class="ui radio checkbox"> + <input name="source" value="local" type="radio" {{if .User.UseCustomAvatar}}checked{{end}}> + <label>{{ctx.Locale.Tr "settings.enable_custom_avatar"}}</label> + </div> + </div> + + <div class="inline field tw-pl-4"> + <label for="avatar">{{ctx.Locale.Tr "settings.choose_new_avatar"}}</label> + <input name="avatar" type="file" accept="image/png,image/jpeg,image/gif,image/webp"> + </div> + + <div class="field"> + <button class="ui primary button">{{ctx.Locale.Tr "settings.update_avatar"}}</button> + <button class="ui red button link-action" data-url="./avatar/delete">{{ctx.Locale.Tr "settings.delete_current_avatar"}}</button> + </div> + </form> + </div> + </div> + +<div class="ui g-modal-confirm delete modal" id="delete-user-modal"> + <div class="header"> + {{svg "octicon-trash"}} + {{ctx.Locale.Tr "settings.delete_account_title"}} + </div> + <form class="ui form" method="post" action="./delete"> + <div class="content"> + <p>{{ctx.Locale.Tr "settings.delete_account_desc"}}</p> + {{$.CsrfTokenHtml}} + <div class="field"> + <div class="ui checkbox"> + <label for="purge">{{ctx.Locale.Tr "admin.users.purge"}}</label> + <input name="purge" type="checkbox"> + </div> + <p class="help">{{ctx.Locale.Tr "admin.users.purge_help"}}</p> + </div> + </div> + {{template "base/modal_actions_confirm" .}} + </form> +</div> + +{{template "admin/layout_footer" .}} diff --git a/templates/admin/user/list.tmpl b/templates/admin/user/list.tmpl new file mode 100644 index 00000000..e5d42995 --- /dev/null +++ b/templates/admin/user/list.tmpl @@ -0,0 +1,119 @@ +{{template "admin/layout_head" (dict "ctxData" . "pageClass" "admin user")}} + <div class="admin-setting-content"> + <h4 class="ui top attached header"> + {{ctx.Locale.Tr "admin.users.user_manage_panel"}} ({{ctx.Locale.Tr "admin.total" .Total}}) + <div class="ui right"> + <a class="ui primary tiny button" href="{{AppSubUrl}}/admin/users/new">{{ctx.Locale.Tr "admin.users.new_account"}}</a> + </div> + </h4> + <div class="ui attached segment"> + <form class="ui form ignore-dirty" id="user-list-search-form"> + + <!-- Right Menu --> + <div class="ui right floated secondary filter menu"> + <!-- Status Filter Menu Item --> + <div class="ui dropdown type jump item"> + <span class="text">{{ctx.Locale.Tr "admin.users.list_status_filter.menu_text"}}</span> + {{svg "octicon-triangle-down" 14 "dropdown icon"}} + <div class="menu"> + <a class="item j-reset-status-filter">{{ctx.Locale.Tr "admin.users.list_status_filter.reset"}}</a> + <div class="divider"></div> + <label class="item"><input type="radio" name="status_filter[is_admin]" value="1"> {{ctx.Locale.Tr "admin.users.list_status_filter.is_admin"}}</label> + <label class="item"><input type="radio" name="status_filter[is_admin]" value="0"> {{ctx.Locale.Tr "admin.users.list_status_filter.not_admin"}}</label> + <div class="divider"></div> + <label class="item"><input type="radio" name="status_filter[is_active]" value="1"> {{ctx.Locale.Tr "admin.users.list_status_filter.is_active"}}</label> + <label class="item"><input type="radio" name="status_filter[is_active]" value="0"> {{ctx.Locale.Tr "admin.users.list_status_filter.not_active"}}</label> + <div class="divider"></div> + <label class="item"><input type="radio" name="status_filter[is_restricted]" value="0"> {{ctx.Locale.Tr "admin.users.list_status_filter.not_restricted"}}</label> + <label class="item"><input type="radio" name="status_filter[is_restricted]" value="1"> {{ctx.Locale.Tr "admin.users.list_status_filter.is_restricted"}}</label> + <div class="divider"></div> + <label class="item"><input type="radio" name="status_filter[is_prohibit_login]" value="0"> {{ctx.Locale.Tr "admin.users.list_status_filter.not_prohibit_login"}}</label> + <label class="item"><input type="radio" name="status_filter[is_prohibit_login]" value="1"> {{ctx.Locale.Tr "admin.users.list_status_filter.is_prohibit_login"}}</label> + <div class="divider"></div> + <label class="item"><input type="radio" name="status_filter[is_2fa_enabled]" value="1"> {{ctx.Locale.Tr "admin.users.list_status_filter.is_2fa_enabled"}}</label> + <label class="item"><input type="radio" name="status_filter[is_2fa_enabled]" value="0"> {{ctx.Locale.Tr "admin.users.list_status_filter.not_2fa_enabled"}}</label> + </div> + </div> + + <!-- Sort Menu Item --> + <div class="ui dropdown type jump item"> + <span class="text"> + {{ctx.Locale.Tr "repo.issues.filter_sort"}} + </span> + {{svg "octicon-triangle-down" 14 "dropdown icon"}} + <div class="menu"> + <button class="item" name="sort" value="oldest">{{ctx.Locale.Tr "repo.issues.filter_sort.oldest"}}</button> + <button class="item" name="sort" value="newest">{{ctx.Locale.Tr "repo.issues.filter_sort.latest"}}</button> + <button class="item" name="sort" value="alphabetically">{{ctx.Locale.Tr "repo.issues.label.filter_sort.alphabetically"}}</button> + <button class="item" name="sort" value="reversealphabetically">{{ctx.Locale.Tr "repo.issues.label.filter_sort.reverse_alphabetically"}}</button> + <button class="item" name="sort" value="recentupdate">{{ctx.Locale.Tr "repo.issues.filter_sort.recentupdate"}}</button> + <button class="item" name="sort" value="leastupdate">{{ctx.Locale.Tr "repo.issues.filter_sort.leastupdate"}}</button> + </div> + </div> + </div> + + {{template "shared/search/combo" dict "Value" .Keyword "Placeholder" (ctx.Locale.Tr "search.user_kind")}} + </form> + </div> + <div class="ui attached table segment"> + <table class="ui very basic striped table unstackable"> + <thead> + <tr> + <th data-sortt-asc="oldest" data-sortt-desc="newest">ID{{SortArrow "oldest" "newest" .SortType false}}</th> + <th data-sortt-asc="alphabetically" data-sortt-desc="reversealphabetically" data-sortt-default="true"> + {{ctx.Locale.Tr "admin.users.name"}} + {{SortArrow "alphabetically" "reversealphabetically" $.SortType true}} + </th> + <th>{{ctx.Locale.Tr "email"}}</th> + <th>{{ctx.Locale.Tr "admin.users.activated"}}</th> + <th>{{ctx.Locale.Tr "admin.users.restricted"}}</th> + <th>{{ctx.Locale.Tr "admin.users.2fa"}}</th> + <th>{{ctx.Locale.Tr "admin.users.created"}}</th> + <th data-sortt-asc="lastlogin" data-sortt-desc="reverselastlogin"> + {{ctx.Locale.Tr "admin.users.last_login"}} + {{SortArrow "lastlogin" "reverselastlogin" $.SortType false}} + </th> + <th></th> + </tr> + </thead> + <tbody> + {{range .Users}} + <tr> + <td>{{.ID}}</td> + <td> + <a href="{{.HomeLink}}">{{.Name}}</a> + {{if .IsAdmin}} + <span class="ui mini label">{{ctx.Locale.Tr "admin.users.admin"}}</span> + {{else if eq 2 .Type}}{{/* Reserved user */}} + <span class="ui mini label">{{ctx.Locale.Tr "admin.users.reserved"}}</span> + {{else if eq 4 .Type}}{{/* Bot "user" */}} + <span class="ui mini label">{{ctx.Locale.Tr "admin.users.bot"}}</span> + {{else if eq 5 .Type}}{{/* Remote user */}} + <span class="ui mini label">{{ctx.Locale.Tr "admin.users.remote"}}</span> + {{end}} + </td> + <td class="gt-ellipsis tw-max-w-48">{{.Email}}</td> + <td>{{if .IsActive}}{{svg "octicon-check"}}{{else}}{{svg "octicon-x"}}{{end}}</td> + <td>{{if .IsRestricted}}{{svg "octicon-check"}}{{else}}{{svg "octicon-x"}}{{end}}</td> + <td>{{if index $.UsersTwoFaStatus .ID}}{{svg "octicon-check"}}{{else}}{{svg "octicon-x"}}{{end}}</td> + <td>{{DateTime "short" .CreatedUnix}}</td> + {{if .LastLoginUnix}} + <td>{{DateTime "short" .LastLoginUnix}}</td> + {{else}} + <td><span>{{ctx.Locale.Tr "admin.users.never_login"}}</span></td> + {{end}} + <td> + <div class="tw-flex tw-gap-2"> + <a href="{{$.Link}}/{{.ID}}" data-tooltip-content="{{ctx.Locale.Tr "admin.users.details"}}">{{svg "octicon-person"}}</a> + <a href="{{$.Link}}/{{.ID}}/edit" data-tooltip-content="{{ctx.Locale.Tr "edit"}}">{{svg "octicon-pencil"}}</a> + </div> + </td> + </tr> + {{end}} + </tbody> + </table> + </div> + + {{template "base/paginate" .}} + </div> +{{template "admin/layout_footer" .}} diff --git a/templates/admin/user/new.tmpl b/templates/admin/user/new.tmpl new file mode 100644 index 00000000..b04ebc4b --- /dev/null +++ b/templates/admin/user/new.tmpl @@ -0,0 +1,90 @@ +{{template "admin/layout_head" (dict "ctxData" . "pageClass" "admin new user")}} + <div class="admin-setting-content"> + <h4 class="ui top attached header"> + {{ctx.Locale.Tr "admin.users.new_account"}} + </h4> + <div class="ui attached segment"> + <form class="ui form" action="{{.Link}}" method="post"> + {{template "base/disable_form_autofill"}} + {{.CsrfTokenHtml}} + <!-- Types and name --> + <div class="inline required field {{if .Err_LoginType}}error{{end}}"> + <label>{{ctx.Locale.Tr "admin.users.auth_source"}}</label> + <div class="ui selection type dropdown"> + <input type="hidden" id="login_type" name="login_type" value="{{.login_type}}" data-password="required" required> + <div class="text">{{ctx.Locale.Tr "admin.users.local"}}</div> + {{svg "octicon-triangle-down" 14 "dropdown icon"}} + <div class="menu"> + <div class="item" data-value="0-0">{{ctx.Locale.Tr "admin.users.local"}}</div> + {{range .Sources}} + <div class="item" data-value="{{.Type.Int}}-{{.ID}}">{{.Name}}</div> + {{end}} + </div> + </div> + </div> + + <div class="inline field {{if .Err_Visibility}}error{{end}}"> + <span class="inline required field"><label for="visibility">{{ctx.Locale.Tr "settings.visibility"}}</label></span> + <div class="ui selection type dropdown"> + <input type="hidden" id="visibility" name="visibility" value="{{if .visibility}}{{printf "%d" .visibility}}{{else}}{{printf "%d" .DefaultUserVisibilityMode}}{{end}}"> + <div class="text"> + {{if .DefaultUserVisibilityMode.IsPublic}}{{ctx.Locale.Tr "settings.visibility.public"}}{{end}} + {{if .DefaultUserVisibilityMode.IsLimited}}{{ctx.Locale.Tr "settings.visibility.limited"}}{{end}} + {{if .DefaultUserVisibilityMode.IsPrivate}}{{ctx.Locale.Tr "settings.visibility.private"}}{{end}} + </div> + {{svg "octicon-triangle-down" 14 "dropdown icon"}} + <div class="menu"> + {{range $mode := .AllowedUserVisibilityModes}} + {{if $mode.IsPublic}} + <div class="item" data-tooltip-content="{{ctx.Locale.Tr "settings.visibility.public_tooltip"}}" data-value="0">{{ctx.Locale.Tr "settings.visibility.public"}}</div> + {{else if $mode.IsLimited}} + <div class="item" data-tooltip-content="{{ctx.Locale.Tr "settings.visibility.limited_tooltip"}}" data-value="1">{{ctx.Locale.Tr "settings.visibility.limited"}}</div> + {{else if $mode.IsPrivate}} + <div class="item" data-tooltip-content="{{ctx.Locale.Tr "settings.visibility.private_tooltip"}}" data-value="2">{{ctx.Locale.Tr "settings.visibility.private"}}</div> + {{end}} + {{end}} + </div> + </div> + </div> + + <div class="required non-local field {{if .Err_LoginName}}error{{end}} {{if eq .login_type "0-0"}}tw-hidden{{end}}"> + <label for="login_name">{{ctx.Locale.Tr "admin.users.auth_login_name"}}</label> + <input id="login_name" name="login_name" value="{{.login_name}}"> + </div> + <div class="required field {{if .Err_UserName}}error{{end}}"> + <label for="user_name">{{ctx.Locale.Tr "username"}}</label> + <input id="user_name" type="text" name="user_name" value="{{.user_name}}" autofocus required maxlength="40"> + </div> + <div class="required field {{if .Err_Email}}error{{end}}"> + <label for="email">{{ctx.Locale.Tr "email"}}</label> + <input id="email" name="email" type="email" value="{{.email}}" required> + </div> + <div class="required local field {{if .Err_Password}}error{{end}} {{if not (eq .login_type "0-0")}}tw-hidden{{end}}"> + <label for="password">{{ctx.Locale.Tr "password"}}</label> + <input id="password" name="password" type="password" autocomplete="new-password" value="{{.password}}" {{if eq .login_type "0-0"}}required{{end}}> + </div> + + <div class="inline field local {{if ne .login_type "0-0"}}tw-hidden{{end}}"> + <div class="ui checkbox"> + <label><strong>{{ctx.Locale.Tr "auth.allow_password_change"}}</strong></label> + <input name="must_change_password" type="checkbox" checked> + </div> + </div> + + <!-- Send register notify e-mail --> + {{if .CanSendEmail}} + <div class="inline field"> + <div class="ui checkbox"> + <label><strong>{{ctx.Locale.Tr "admin.users.send_register_notify"}}</strong></label> + <input name="send_notify" type="checkbox" {{if .send_notify}}checked{{end}}> + </div> + </div> + {{end}} + + <div class="field"> + <button class="ui primary button">{{ctx.Locale.Tr "admin.users.new_account"}}</button> + </div> + </form> + </div> + </div> +{{template "admin/layout_footer" .}} diff --git a/templates/admin/user/view.tmpl b/templates/admin/user/view.tmpl new file mode 100644 index 00000000..21943a83 --- /dev/null +++ b/templates/admin/user/view.tmpl @@ -0,0 +1,48 @@ +{{template "admin/layout_head" (dict "ctxData" . "pageClass" "admin view user")}} + +<div class="admin-setting-content"> + <div class="admin-responsive-columns"> + <div class="tw-flex-1"> + <h4 class="ui top attached header"> + {{.Title}} + <div class="ui right"> + <a class="ui primary tiny button" href="{{.Link}}/edit">{{ctx.Locale.Tr "admin.users.edit"}}</a> + </div> + </h4> + <div class="ui attached segment"> + {{template "admin/user/view_details" .}} + </div> + </div> + <div class="tw-flex-1"> + <h4 class="ui top attached header"> + {{ctx.Locale.Tr "admin.emails"}} + <div class="ui right"> + {{.EmailsTotal}} + </div> + </h4> + <div class="ui attached segment"> + {{template "admin/user/view_emails" .}} + </div> + </div> + </div> + <h4 class="ui top attached header"> + {{ctx.Locale.Tr "admin.repositories"}} + <div class="ui right"> + {{.ReposTotal}} + </div> + </h4> + <div class="ui attached segment"> + {{template "explore/repo_list" .}} + </div> + <h4 class="ui top attached header"> + {{ctx.Locale.Tr "settings.organization"}} + <div class="ui right"> + {{.OrgsTotal}} + </div> + </h4> + <div class="ui attached segment"> + {{template "explore/user_list" .}} + </div> +</div> + +{{template "admin/layout_footer" .}} diff --git a/templates/admin/user/view_details.tmpl b/templates/admin/user/view_details.tmpl new file mode 100644 index 00000000..be2f32b5 --- /dev/null +++ b/templates/admin/user/view_details.tmpl @@ -0,0 +1,74 @@ +<div class="flex-list"> + <div class="flex-item"> + <div class="flex-item-leading"> + {{ctx.AvatarUtils.Avatar .User 48}} + </div> + <div class="flex-item-main"> + <div class="flex-item-title"> + {{template "shared/user/name" .User}} + {{if .User.IsAdmin}} + <span class="ui basic label">{{ctx.Locale.Tr "admin.users.admin"}}</span> + {{end}} + </div> + <div class="flex-item-body"> + <b>{{ctx.Locale.Tr "admin.users.auth_source"}}:</b> + {{if eq .LoginSource.ID 0}} + {{ctx.Locale.Tr "admin.users.local"}} + {{else}} + {{.LoginSource.Name}} + {{end}} + </div> + <div class="flex-item-body"> + <b>{{ctx.Locale.Tr "admin.users.activated"}}:</b> + {{if .User.IsActive}} + {{svg "octicon-check"}} + {{else}} + {{svg "octicon-x"}} + {{end}} + </div> + <div class="flex-item-body"> + <b>{{ctx.Locale.Tr "admin.users.restricted"}}:</b> + {{if .User.IsRestricted}} + {{svg "octicon-check"}} + {{else}} + {{svg "octicon-x"}} + {{end}} + </div> + <div class="flex-item-body"> + <b>{{ctx.Locale.Tr "settings.visibility"}}:</b> + {{if .User.Visibility.IsPublic}}{{ctx.Locale.Tr "settings.visibility.public"}}{{end}} + {{if .User.Visibility.IsLimited}}{{ctx.Locale.Tr "settings.visibility.limited"}}{{end}} + {{if .User.Visibility.IsPrivate}}{{ctx.Locale.Tr "settings.visibility.private"}}{{end}} + </div> + <div class="flex-item-body"> + <b>{{ctx.Locale.Tr "admin.users.2fa"}}:</b> + {{if .TwoFactorEnabled}} + <span class="text green">{{svg "octicon-check"}}</span> + {{else}} + {{svg "octicon-x"}} + {{end}} + </div> + {{if .User.Language}} + <div class="flex-item-body"> + <span class="flex-text-inline"> + <b>{{ctx.Locale.Tr "settings.language"}}:</b> + {{range .AllLangs}}{{if eq $.User.Language .Lang}}{{.Name}}{{end}}{{end}} + </span> + </div> + {{end}} + {{if .User.Location}} + <div class="flex-item-body"> + <span class="flex-text-inline">{{svg "octicon-location"}}{{.User.Location}}</span> + </div> + {{end}} + {{if .User.Website}} + <div class="flex-item-body"> + <span class="flex-text-inline"> + {{svg "octicon-link"}} + <a target="_blank" href="{{.User.Website}}">{{.User.Website}}</a> + </span> + </div> + {{end}} + </div> + </div> +</div> diff --git a/templates/admin/user/view_emails.tmpl b/templates/admin/user/view_emails.tmpl new file mode 100644 index 00000000..22ce305a --- /dev/null +++ b/templates/admin/user/view_emails.tmpl @@ -0,0 +1,19 @@ +<div class="flex-list"> + {{range .Emails}} + <div class="flex-item"> + <div class="flex-item-main"> + <div class="flex-text-block"> + {{.Email}} + {{if .IsPrimary}} + <div class="ui primary label">{{ctx.Locale.Tr "settings.primary"}}</div> + {{end}} + {{if .IsActivated}} + <div class="ui green label">{{ctx.Locale.Tr "settings.activated"}}</div> + {{else}} + <div class="ui label">{{ctx.Locale.Tr "settings.requires_activation"}}</div> + {{end}} + </div> + </div> + </div> + {{end}} +</div> |