myexperiment-hackers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[myexperiment-hackers] [3735] trunk/app: added given name / family name


From: noreply
Subject: [myexperiment-hackers] [3735] trunk/app: added given name / family name and require them during registration
Date: Mon, 30 Sep 2013 15:58:47 +0000 (UTC)

Revision
3735
Author
dgc
Date
2013-09-30 15:58:47 +0000 (Mon, 30 Sep 2013)

Log Message

added given name / family name and require them during registration

Modified Paths

Diff

Modified: trunk/app/controllers/users_controller.rb (3734 => 3735)


--- trunk/app/controllers/users_controller.rb	2013-09-30 13:55:57 UTC (rev 3734)
+++ trunk/app/controllers/users_controller.rb	2013-09-30 15:58:47 UTC (rev 3735)
@@ -157,11 +157,7 @@
     end
     
     unless params[:user][:name]
-      if params[:user][:username]
-        params[:user][:name] = params[:user][:username].humanize # initializes username (if one isn't entered)
-      else
-        params[:user][:name] = params[:user][:openid_url]
-      end
+      params[:user][:name] = "#{params[:user][:given_name]} #{params[:user][:family_name]}"
     end
     
     # Reset certain fields (to prevent injecting the values)
@@ -254,7 +250,7 @@
           elsif params[:update_type]
             case params[:update_type]
               when "upd_t_up"; flash.now[:notice] = 'You have successfully updated your password'
-              when "upd_t_displname"; flash.now[:notice] = 'You have successfully updated your display name'
+              when "upd_t_name"; flash.now[:notice] = 'You have successfully updated your name'
               when "upd_t_notify"; flash.now[:notice] = 'You have successfully updated notification options'
             end
           else

Modified: trunk/app/models/user.rb (3734 => 3735)


--- trunk/app/models/user.rb	2013-09-30 13:55:57 UTC (rev 3734)
+++ trunk/app/models/user.rb	2013-09-30 15:58:47 UTC (rev 3735)
@@ -111,6 +111,10 @@
   
   # BEGIN RESTful Authentication #
   attr_accessor :password
+
+  validates_presence_of     :name
+  validates_presence_of     :given_name
+  validates_presence_of     :family_name
   
   validates_presence_of     :username,                   :if => :not_openid?
   validates_presence_of     :password,                   :if => :password_required?

Modified: trunk/app/views/users/edit.rhtml (3734 => 3735)


--- trunk/app/views/users/edit.rhtml	2013-09-30 13:55:57 UTC (rev 3734)
+++ trunk/app/views/users/edit.rhtml	2013-09-30 15:58:47 UTC (rev 3735)
@@ -4,13 +4,26 @@
 <% unless @user.errors.empty? -%>
 	<%= link_to "Reset the form to the last saved correct state", edit_user_path(@user) -%>
 <% end -%>
-<h2>Display Name</h2>
+<h2>Name</h2>
 <% form_for(:user, :url ="" user_path(@user), :html => { :method => :put }) do |f| %>
-<%= hidden_field_tag(:update_type, "upd_t_displname") -%>
+<%= hidden_field_tag(:update_type, "upd_t_name") -%>
 <p style="margin-left: 0.1cm">
+    <b>Given Name:</b>
+    <br/>
+    <%= f.text_field :given_name %>
+    <br/>
+    <br/>
+    <b>Family Name:</b>
+    <br/>
+    <%= f.text_field :family_name %>
+    <br/>
+    <br/>
     <b>Display Name:</b>
     <br/>
     <%= f.text_field :name %>
+    <%= info_icon_with_tooltip("The display name is used to show your name in #{Conf.sitename}.  You can change it directly if your name does not follow the form: given name, space, family name.") -%>
+    <br />
+    <br />
 </p>
 <p style="margin-left: 0.1cm">
     <%= submit_tag "Save", :disable_with => 'Saving...' %>

Modified: trunk/app/views/users/new.rhtml (3734 => 3735)


--- trunk/app/views/users/new.rhtml	2013-09-30 13:55:57 UTC (rev 3734)
+++ trunk/app/views/users/new.rhtml	2013-09-30 15:58:47 UTC (rev 3735)
@@ -50,7 +50,17 @@
 							<div class="box_simple">
 								<p style="color: #990000; font-weight: bold; font-size: 108%;">First...</p>
 								<p>
-									Provide an <b>email address</b>:
+								  <b>Given name</b>
+									<br />
+								  <%= f.text_field :given_name %>
+								</p>
+								<p>
+								  <b>Family name</b>
+									<br />
+								  <%= f.text_field :family_name %>
+								</p>
+								<p>
+									<b>Email address</b>:
 									<span style="margin-left: 0.5em; font-size: 85%; vertical-align: middle;"><%= link_to_function "Why?" + expand_image("0.2em"), visual_effect(:toggle_blind, "email_why", :duration => 0.3) %></span>
 								</p>
 								<div id="email_why" class="box_dynamic_help" style="display: none;">

reply via email to

[Prev in Thread] Current Thread [Next in Thread]