diff --git a/config/i18n/en.yml b/config/i18n/en.yml index 04c173c..bb244af 100644 --- a/config/i18n/en.yml +++ b/config/i18n/en.yml @@ -168,4 +168,5 @@ profile.title: Profile profile.description: User profiles. profile.field.password.current: Current password profile.field.password.new: New password -profile.field.password.confirm: Password confirmation \ No newline at end of file +profile.field.password.confirm: Password confirmation +profile.password.warning: You are a LDAP user, can not modify password here. \ No newline at end of file diff --git a/config/i18n/zh.yml b/config/i18n/zh.yml index dc6b1d3..600fa25 100644 --- a/config/i18n/zh.yml +++ b/config/i18n/zh.yml @@ -168,4 +168,5 @@ profile.title: 资料 profile.description: 用户个人信息。 profile.field.password.current: 当前密码 profile.field.password.new: 新密码 -profile.field.password.confirm: 新密码确认 \ No newline at end of file +profile.field.password.confirm: 新密码确认 +profile.password.warning: 你是 LDAP 认证用户,不支持在这里修改密码。 \ No newline at end of file diff --git a/controller/profile.go b/controller/profile.go index 5d628dc..50e68c5 100644 --- a/controller/profile.go +++ b/controller/profile.go @@ -45,7 +45,12 @@ func profileModifyInfo(ctx web.Context) error { } func profilePassword(ctx web.Context) error { - m := newModel(ctx) + user, err := biz.User.GetByID(ctx.User().ID()) + if err != nil { + return err + } + + m := newModel(ctx).Set("User", user) return ctx.Render("profile/password", m) } diff --git a/views/profile/password.jet b/views/profile/password.jet index a17e44c..023db2c 100644 --- a/views/profile/password.jet +++ b/views/profile/password.jet @@ -65,9 +65,12 @@

- +

+ {{ if .User.Type == "ldap" }} +
{{ i18n("profile.password.warning") }}
+ {{ end }}