gitcat
1{{define "content"}}
2{{$me := .Data.Profile}}
3<div class="pagehead">
4 <h1>账号设置</h1>
5 <p class="muted">你可以修改自己的昵称、头像、简介与密码。用户名是登录凭据,不可更改。</p>
6</div>
7
8<div class="split">
9 <div class="col-main">
10 <div class="card profile-card">
11 <div class="profile-top">
12 {{template "av" (dict "U" $me "S" 84)}}
13 <div class="profile-id">
14 <h2>{{$me.Display}}</h2>
15 <p class="muted">@{{$me.Username}} · 注册于 {{date $me.CreatedAt}}{{if $me.LastLoginAt}} · 最近登录 {{timeago $me.LastLoginAt}}{{end}}</p>
16 <div class="profile-stats">
17 <span><strong>{{num .Data.MyRepoCount}}</strong> 个项目</span>
18 <span><strong>{{num .Data.MyPushCount}}</strong> 次推送</span>
19 {{if $me.IsAdmin}}<span class="tag tag-ok">管理员</span>{{end}}
20 </div>
21 </div>
22 </div>
23 <form class="avatar-form" method="post" action="/settings/avatar" enctype="multipart/form-data">
24 <input type="hidden" name="csrf" value="{{.CSRF}}">
25 <label class="field">
26 <span>更换头像</span>
27 <input type="file" name="avatar" accept="image/png,image/jpeg,image/gif,image/webp">
28 <em class="field-hint">支持 PNG / JPG / GIF / WebP,不超过 2MB。</em>
29 </label>
30 <div class="row-actions">
31 <button class="btn btn-primary" type="submit">上传头像</button>
32 {{if $me.Avatar}}
33 <label class="check inline"><input type="checkbox" name="remove_avatar"><span>移除当前头像</span></label>
34 {{end}}
35 </div>
36 </form>
37 </div>
38
39 <div class="card">
40 <h3 class="card-title">基本资料</h3>
41 <form method="post" action="/settings/profile">
42 <input type="hidden" name="csrf" value="{{.CSRF}}">
43 <div class="grid-2">
44 <label class="field"><span>昵称</span><input type="text" name="display_name" maxlength="40" value="{{$me.DisplayName}}" placeholder="展示给其他成员的名字"></label>
45 <label class="field"><span>邮箱(用于匹配 git 提交)</span><input type="email" name="email" maxlength="120" value="{{$me.Email}}" placeholder="you@studio.com"></label>
46 </div>
47 <label class="field"><span>个人简介</span><textarea name="bio" rows="3" maxlength="300" placeholder="一句话介绍自己">{{$me.Bio}}</textarea></label>
48 <button class="btn btn-primary" type="submit">保存资料</button>
49 </form>
50 </div>
51
52 <div class="card">
53 <h3 class="card-title">修改密码</h3>
54 <form method="post" action="/settings/password">
55 <input type="hidden" name="csrf" value="{{.CSRF}}">
56 <div class="grid-3">
57 <label class="field"><span>当前密码</span><input type="password" name="current_password" required autocomplete="current-password"></label>
58 <label class="field"><span>新密码</span><input type="password" name="new_password" required minlength="6" autocomplete="new-password"></label>
59 <label class="field"><span>确认新密码</span><input type="password" name="new_password2" required minlength="6" autocomplete="new-password"></label>
60 </div>
61 <button class="btn btn-primary" type="submit">更新密码</button>
62 <p class="hint">修改后,git 推送时请使用新密码。</p>
63 </form>
64 </div>
65 </div>
66
67 <aside class="col-side">
68 <div class="card about">
69 <h3>我的最近推送</h3>
70 {{if .Data.MyRecent}}
71 <ul class="feed">
72 {{range .Data.MyRecent}}
73 <li class="feed-item">
74 <div class="feed-body">
75 <div class="feed-line"><a class="quiet" href="/{{.RepoName}}">{{.RepoName}}</a><span class="muted"> · {{.CommitCount}} 个提交</span></div>
76 <div class="feed-sub muted">{{timeago .CreatedAt}}{{if .WhatsNew}} · {{oneline .WhatsNew}}{{end}}</div>
77 </div>
78 </li>
79 {{end}}
80 </ul>
81 {{else}}<p class="muted small">还没有推送记录。</p>{{end}}
82 </div>
83 <div class="card tip-card">
84 <h3>让提交认得出你</h3>
85 <p>把 git 的提交邮箱设置成上面填写的邮箱,贡献者统计就能把提交对应到你的账号:</p>
86 <pre class="code">git config --global user.name "{{$me.Display}}"
87git config --global user.email "{{if $me.Email}}{{$me.Email}}{{else}}you@studio.com{{end}}"</pre>
88 </div>
89 </aside>
90</div>
91{{end}}