Commit b2e4664cc78d61ec058e81f37cdff11636b02967

Authored by Dmitriy Zaporozhets
1 parent 44c55307

Read-only email field for LDAP user

Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
app/controllers/profiles_controller.rb
... ... @@ -13,6 +13,8 @@ class ProfilesController &lt; ApplicationController
13 13 end
14 14  
15 15 def update
  16 + params[:user].delete(:email) if @user.ldap_user?
  17 +
16 18 if @user.update_attributes(params[:user])
17 19 flash[:notice] = "Profile was successfully updated"
18 20 else
... ...
app/views/profiles/show.html.haml
... ... @@ -21,16 +21,22 @@
21 21 .controls
22 22 = f.text_field :name, class: "input-xlarge", required: true
23 23 %span.help-block Enter your name, so people you know can recognize you.
  24 +
24 25 .control-group
25 26 = f.label :email, class: "control-label"
26 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 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 40 .control-group
35 41 = f.label :skype, class: "control-label"
36 42 .controls= f.text_field :skype, class: "input-xlarge"
... ...