Commit ccfe5f7959be1ffe5af2d562ee5a35a9676345c8
Committed by
Tallys Martins
1 parent
24c79664
Exists in
master
and in
29 other branches
Fixing person identifier not saving and validation of user attributes.
(AI3036) Signed-off-by: André Bernardes <andrebsguedes@gmail.com> Signed-off-by: Gabriela Navarro <navarro1703@gmail.com> Signed-off-by: Hebert Douglas <hebertdougl@gmail.com> Signed-off-by: Renan Costa <renan2727@hotmail.com> Signed-off-by: Rodrigo Medeiros <rodrigo.mss01@gmail.com> Signed-off-by: Iolane Andrade <andrade.icaa@gmail.com> Signed-off-by: Tallys Martins <tallysmartins@gmail.com>
Showing
3 changed files
with
34 additions
and
17 deletions
Show diff stats
app/controllers/public/account_controller.rb
... | ... | @@ -87,7 +87,6 @@ class AccountController < ApplicationController |
87 | 87 | @person.environment = @user.environment |
88 | 88 | unless @user.environment.enabled?('admin_must_approve_new_users') |
89 | 89 | if request.post? |
90 | - @person.attributes = params[:profile_data] | |
91 | 90 | if may_be_a_bot |
92 | 91 | set_signup_start_time_for_now |
93 | 92 | @block_bot = true |
... | ... | @@ -107,6 +106,7 @@ class AccountController < ApplicationController |
107 | 106 | end |
108 | 107 | if @user.activated? |
109 | 108 | self.current_user = @user |
109 | + check_join_in_community(@user) | |
110 | 110 | go_to_signup_initial_page |
111 | 111 | else |
112 | 112 | @register_pending = true |
... | ... | @@ -117,11 +117,13 @@ class AccountController < ApplicationController |
117 | 117 | @task = CreateUser.new(params[:user]) |
118 | 118 | @task.person_data = @user.person_data |
119 | 119 | if request.post? |
120 | - @task.target = @user.environment | |
121 | - @task.name = @user.name | |
122 | - if @task.save | |
123 | - session[:notice] = _('Thanks for registering. The administrators were notified.') | |
124 | - @register_pending = true | |
120 | + if @user.valid? | |
121 | + @task.target = @user.environment | |
122 | + @task.name = @user.name | |
123 | + if @task.save | |
124 | + session[:notice] = _('Thanks for registering. The administrators were notified.') | |
125 | + @register_pending = true | |
126 | + end | |
125 | 127 | end |
126 | 128 | end |
127 | 129 | end | ... | ... |
app/models/create_user.rb
... | ... | @@ -28,6 +28,7 @@ class CreateUser < Task |
28 | 28 | def perform |
29 | 29 | user = User.new(user_data) |
30 | 30 | user.person = Person.new(person_data) |
31 | + user.person.identifier = user.login | |
31 | 32 | author_name = user.name |
32 | 33 | user.environment = self.environment |
33 | 34 | user.person.environment = user.environment | ... | ... |
app/views/account/signup.html.erb
... | ... | @@ -2,18 +2,32 @@ |
2 | 2 | <div id='thanks-for-signing'> |
3 | 3 | <% if environment.has_custom_welcome_screen? %> |
4 | 4 | <%= environment.settings[:signup_welcome_screen_body].html_safe %> |
5 | + <% elsif environment.enabled?('admin_must_approve_new_users')%> | |
6 | + <h1><%= _("The environment %s has a registration moderated policy!") % environment.name %></h1> | |
7 | + <h3><%= _("Your registration was sent to the environment administrator!") %></h3> | |
8 | + <h3><%= _("Once your registration is accepted you can start doing the cool stuffs bellow!") %></h3> | |
9 | + <p><%= _("Firstly, some tips for getting started:") %></p> | |
10 | + <h4><%= _("Confirm your account!") %></h4> | |
11 | + <p><%= _("You should receive a welcome email from us shortly. Please take a second to follow the link within to confirm your account.") %></p> | |
12 | + <p><%= _("You won't appear as %s until your account is confirmed.") % link_to(_('user'), {:controller => :search, :action => :people, :filter => 'more_recent'}, :target => '_blank') %></p> | |
13 | + <h4><%= _("What to do next?") %></h4> | |
14 | + <p><%= _("%s. Upload an avatar and let your friends find you easily :)") % link_to(_('Customize your profile'), {:controller => 'doc', :section => 'user', :topic => 'editing-person-info'}, :target => '_blank') %></p> | |
15 | + <p><%= _("Learn the guidelines. Read the %s for more details on how to use this social network!") % link_to(_('Documentation'), {:controller => 'doc'}, :target => '_blank') %></p> | |
16 | + <p><%= _("%s your Gmail, Yahoo and Hotmail contacts!") % link_to(_('Invite and find'), {:controller => 'doc', :section => 'user', :topic => 'invite-contacts'}, :target => '_blank') %></p> | |
17 | + <p><%= _("Start exploring and have fun!") %></p> | |
18 | + <h3><%= _("If by any chance your registration wasn't successful and you should be registred, send an email for the administrator!")%></h3> | |
5 | 19 | <% else %> |
6 | - <h1><%= _("Welcome to %s!") % environment.name %></h1> | |
7 | - <h3><%= _("Thanks for signing up, we're thrilled to have you on our social network!") %></h3> | |
8 | - <p><%= _("Firstly, some tips for getting started:") %></p> | |
9 | - <h4><%= _("Confirm your account!") %></h4> | |
10 | - <p><%= _("You should receive a welcome email from us shortly. Please take a second to follow the link within to confirm your account.") %></p> | |
11 | - <p><%= _("You won't appear as %s until your account is confirmed.") % link_to(_('user'), {:controller => :search, :action => :people, :filter => 'more_recent'}, :target => '_blank') %></p> | |
12 | - <h4><%= _("What to do next?") %></h4> | |
13 | - <p><%= _("%s. Upload an avatar and let your friends find you easily :)") % link_to(_('Customize your profile'), {:controller => 'doc', :section => 'user', :topic => 'editing-person-info'}, :target => '_blank') %></p> | |
14 | - <p><%= _("Learn the guidelines. Read the %s for more details on how to use this social network!") % link_to(_('Documentation'), {:controller => 'doc'}, :target => '_blank') %></p> | |
15 | - <p><%= _("%s your Gmail, Yahoo and Hotmail contacts!") % link_to(_('Invite and find'), {:controller => 'doc', :section => 'user', :topic => 'invite-contacts'}, :target => '_blank') %></p> | |
16 | - <p><%= _("Start exploring and have fun!") %></p> | |
20 | + <h1><%= _("Welcome to %s!") % environment.name %></h1> | |
21 | + <h3><%= _("Thanks for signing up, we're thrilled to have you on our social network!") %></h3> | |
22 | + <p><%= _("Firstly, some tips for getting started:") %></p> | |
23 | + <h4><%= _("Confirm your account!") %></h4> | |
24 | + <p><%= _("You should receive a welcome email from us shortly. Please take a second to follow the link within to confirm your account.") %></p> | |
25 | + <p><%= _("You won't appear as %s until your account is confirmed.") % link_to(_('user'), {:controller => :search, :action => :people, :filter => 'more_recent'}, :target => '_blank') %></p> | |
26 | + <h4><%= _("What to do next?") %></h4> | |
27 | + <p><%= _("%s. Upload an avatar and let your friends find you easily :)") % link_to(_('Customize your profile'), {:controller => 'doc', :section => 'user', :topic => 'editing-person-info'}, :target => '_blank') %></p> | |
28 | + <p><%= _("Learn the guidelines. Read the %s for more details on how to use this social network!") % link_to(_('Documentation'), {:controller => 'doc'}, :target => '_blank') %></p> | |
29 | + <p><%= _("%s your Gmail, Yahoo and Hotmail contacts!") % link_to(_('Invite and find'), {:controller => 'doc', :section => 'user', :topic => 'invite-contacts'}, :target => '_blank') %></p> | |
30 | + <p><%= _("Start exploring and have fun!") %></p> | |
17 | 31 | <% end %> |
18 | 32 | </div> |
19 | 33 | <% else %> | ... | ... |