Class: Admin::CredentialsController
Instance Attribute Summary collapse
Instance Method Summary
collapse
#webauthn_authenticate!, #webauthn_nickname, #webauthn_register!, #webauthn_relying_party
Instance Attribute Details
#admin_user ⇒ Object
Returns the value of attribute admin_user.
13
14
15
|
# File 'app/controllers/admin/credentials_controller.rb', line 13
def admin_user
@admin_user
end
|
#credential ⇒ Object
Returns the value of attribute credential.
13
14
15
|
# File 'app/controllers/admin/credentials_controller.rb', line 13
def credential
@credential
end
|
Instance Method Details
#create ⇒ Object
23
24
25
26
27
28
29
30
31
|
# File 'app/controllers/admin/credentials_controller.rb', line 23
def create
webauthn_register!(credential_params[:response])
if %r{/credentials/new$}.match?(request.referer)
redirect_to(admin_root_path, status: :see_other)
else
redirect_back_or_to(admin_profile_path, status: :see_other)
end
end
|
#destroy ⇒ Object
41
42
43
44
45
|
# File 'app/controllers/admin/credentials_controller.rb', line 41
def destroy
credential.destroy!
redirect_to(admin_profile_path, status: :see_other)
end
|
#new ⇒ Object
19
20
21
|
# File 'app/controllers/admin/credentials_controller.rb', line 19
def new
render locals: { admin_user: }
end
|
#show ⇒ Object
15
16
17
|
# File 'app/controllers/admin/credentials_controller.rb', line 15
def show
render locals: { credential: }
end
|
#update ⇒ Object
33
34
35
36
37
38
39
|
# File 'app/controllers/admin/credentials_controller.rb', line 33
def update
if credential.update(credential_params)
redirect_to(admin_profile_path, status: :see_other)
else
render :show, locals: { credential: }, status: :unprocessable_content
end
end
|