Commit fa585a8ca4daa6acb32b7513a245d8c46dfc5a83
1 parent
c034e703
Exists in
master
and in
29 other branches
User Moderation new support
Added support for using User Moderation and Skip user email activation features together Signed-off-by: André Bernardes <andrebsguedes@gmail.com> Signed-off-by: Tallys Martins <tallysmartins@gmail.com>
Showing
2 changed files
with
14 additions
and
2 deletions
Show diff stats
app/controllers/public/account_controller.rb
... | ... | @@ -124,6 +124,9 @@ class AccountController < ApplicationController |
124 | 124 | self.current_user = @user |
125 | 125 | check_join_in_community(@user) |
126 | 126 | go_to_signup_initial_page |
127 | + elsif environment.enabled?('skip_new_user_email_confirmation') && environment.enabled?('admin_must_approve_new_users') | |
128 | + session[:notice] = _('Thanks for registering. The administrators were notified.') | |
129 | + redirect_to :controller => 'home', :action => 'index' | |
127 | 130 | else |
128 | 131 | @register_pending = true |
129 | 132 | end | ... | ... |
app/models/user.rb
... | ... | @@ -47,8 +47,17 @@ class User < ActiveRecord::Base |
47 | 47 | |
48 | 48 | user.person = p |
49 | 49 | end |
50 | - if user.environment.enabled?('skip_new_user_email_confirmation') | |
51 | - user.activate | |
50 | + if user.environment.enabled?('skip_new_user_email_confirmation') | |
51 | + unless user.environment.enabled?('admin_must_approve_new_users') | |
52 | + user.activate | |
53 | + else | |
54 | + @task = CreateUser.new | |
55 | + @task.user_id = user.id | |
56 | + @task.name = user.name | |
57 | + @task.email = user.email | |
58 | + @task.target = user.environment | |
59 | + @task.save | |
60 | + end | |
52 | 61 | end |
53 | 62 | end |
54 | 63 | after_create :deliver_activation_code | ... | ... |