Class: Admin::UsersController

Inherits:
AdminController
  • Object
show all
Defined in:
app/controllers/admin/users_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



13
14
# File 'app/controllers/admin/users_controller.rb', line 13

def create
end

#deleteObject

DELETE /accounts/1



39
40
41
42
# File 'app/controllers/admin/users_controller.rb', line 39

def delete
  ApiToken.find_by(token: params[:id]).destroy
  redirect_back(fallback_location: root_path)
end

#editObject

GET /accounts/1/edit



35
36
# File 'app/controllers/admin/users_controller.rb', line 35

def edit
end

#indexObject



4
5
6
# File 'app/controllers/admin/users_controller.rb', line 4

def index
  @users = User.all
end

#newObject

GET /accounts/new



30
31
32
# File 'app/controllers/admin/users_controller.rb', line 30

def new
  @user = User.new
end

#showObject

GET /accounts/1



9
10
11
# File 'app/controllers/admin/users_controller.rb', line 9

def show
  @tokens = @user.api_tokens
end

#updateObject



16
17
18
19
20
21
22
23
24
25
26
27
# File 'app/controllers/admin/users_controller.rb', line 16

def update
  @user = User.find(params[:user][:id])
  email = @user.email
  @user.update(email_params)
  if email != params[:user][:unconfirmed_email]
    @user.confirmation_sent_at = Time.now
    @user.save
    @user.send_confirmation_instructions
    # flash[:notice] = I18n.t("revise_auth.confirmation_email_sent", email: current_user.unconfirmed_email)
  end
  redirect_back(fallback_location: root_path)
end