Commit b2e4664cc78d61ec058e81f37cdff11636b02967
1 parent
44c55307
Exists in
master
and in
4 other branches
Read-only email field for LDAP user
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Showing
2 changed files
with
14 additions
and
6 deletions
Show diff stats
app/controllers/profiles_controller.rb
@@ -13,6 +13,8 @@ class ProfilesController < ApplicationController | @@ -13,6 +13,8 @@ class ProfilesController < ApplicationController | ||
13 | end | 13 | end |
14 | 14 | ||
15 | def update | 15 | def update |
16 | + params[:user].delete(:email) if @user.ldap_user? | ||
17 | + | ||
16 | if @user.update_attributes(params[:user]) | 18 | if @user.update_attributes(params[:user]) |
17 | flash[:notice] = "Profile was successfully updated" | 19 | flash[:notice] = "Profile was successfully updated" |
18 | else | 20 | else |
app/views/profiles/show.html.haml
@@ -21,16 +21,22 @@ | @@ -21,16 +21,22 @@ | ||
21 | .controls | 21 | .controls |
22 | = f.text_field :name, class: "input-xlarge", required: true | 22 | = f.text_field :name, class: "input-xlarge", required: true |
23 | %span.help-block Enter your name, so people you know can recognize you. | 23 | %span.help-block Enter your name, so people you know can recognize you. |
24 | + | ||
24 | .control-group | 25 | .control-group |
25 | = f.label :email, class: "control-label" | 26 | = f.label :email, class: "control-label" |
26 | .controls | 27 | .controls |
27 | - = f.text_field :email, class: "input-xlarge", required: true | ||
28 | - - if @user.unconfirmed_email.present? | ||
29 | - %span.help-block | ||
30 | - We sent confirmation email to | ||
31 | - %strong #{@user.unconfirmed_email} | 28 | + - if @user.ldap_user? |
29 | + = f.text_field :email, class: "input-xlarge", required: true, readonly: true | ||
30 | + %span.help-block.light | ||
31 | + Email is read-only for LDAP user | ||
32 | - else | 32 | - else |
33 | - %span.help-block We also use email for avatar detection if no avatar is uploaded. | 33 | + = f.text_field :email, class: "input-xlarge", required: true |
34 | + - if @user.unconfirmed_email.present? | ||
35 | + %span.help-block | ||
36 | + We sent confirmation email to | ||
37 | + %strong #{@user.unconfirmed_email} | ||
38 | + - else | ||
39 | + %span.help-block We also use email for avatar detection if no avatar is uploaded. | ||
34 | .control-group | 40 | .control-group |
35 | = f.label :skype, class: "control-label" | 41 | = f.label :skype, class: "control-label" |
36 | .controls= f.text_field :skype, class: "input-xlarge" | 42 | .controls= f.text_field :skype, class: "input-xlarge" |