Class: My::ProfilesController

Inherits:
ApplicationController
  • Object
show all
Includes:
Authentication
Defined in:
app/controllers/my/profiles_controller.rb

Overview

Managing profile for current user

Instance Method Summary collapse

Methods included from Authentication

#cookie_data, #create_token_for_user, #deactivate_token, #pop_token, #redirect_authenticated_user

Instance Method Details

#checkObject

post /my/profile/check



11
12
13
14
# File 'app/controllers/my/profiles_controller.rb', line 11

def check
  code = Code.active.find_by(body: param_from_request(:code))
  registration_handler.check(creation_parameters.to_h, code)
end

#createObject

post /my/profile



24
25
26
27
28
29
30
31
32
# File 'app/controllers/my/profiles_controller.rb', line 24

def create
  if params[:agree]
    metric = Biovision::Components::UsersComponent::METRIC_REGISTRATION_BOT
    component_handler.register_metric(metric)
    redirect_to root_path, alert: t('.are_you_bot')
  else
    create_user
  end
end

#editObject

get /my/profile/edit



39
40
# File 'app/controllers/my/profiles_controller.rb', line 39

def edit
end

#newObject

get /my/profile/new



17
18
19
20
21
# File 'app/controllers/my/profiles_controller.rb', line 17

def new
  @entity = User.new

  render :closed unless component_handler.registration_open?
end

#showObject

get /my/profile



35
36
# File 'app/controllers/my/profiles_controller.rb', line 35

def show
end

#updateObject

patch /my/profile



43
44
45
46
47
48
49
50
51
# File 'app/controllers/my/profiles_controller.rb', line 43

def update
  @entity = current_user
  if component_handler.update_user(@entity, user_parameters, profile_parameters)
    flash[:notice] = t('.success')
    form_processed_ok(my_path)
  else
    form_processed_with_error(:edit)
  end
end