Class: KeysController
Instance Method Summary
collapse
#active_tab
#sshkey_uploaded?
#domain_is_missing, #user_default_domain
#user_capabilities
Instance Method Details
#create ⇒ Object
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
# File 'app/controllers/keys_controller.rb', line 7
def create
@first = true if params[:first]
@key ||= Key.new params[:key]
@key.as = current_user
if @key.save
redirect_to (@first ? :back : account_path), :flash => {:success => 'Your public key has been created'} rescue redirect_to account_path
else
Rails.logger.debug @key.errors.inspect
render :new
end
rescue Key::DuplicateName
if @first
if @key.default?
@key = Key.default(:as => current_user).load(params[:key])
else
@key.make_unique! "#{@key.name}%s"
end
raise if @retried
@retried = true
retry
end
@key.errors.add(:name, 'You have already created a key with that name')
render :new
end
|
#destroy ⇒ Object
38
39
40
41
42
|
# File 'app/controllers/keys_controller.rb', line 38
def destroy
@key = Key.find params[:id], :as => current_user
@key.destroy
redirect_to account_path
end
|
#new ⇒ Object
2
3
4
5
|
# File 'app/controllers/keys_controller.rb', line 2
def new
@first = true if params[:first]
@key = Key.new
end
|