Skip to content
This repository has been archived by the owner on Feb 6, 2024. It is now read-only.

Commit

Permalink
Clickable otpauth Link, fixes #66
Browse files Browse the repository at this point in the history
  • Loading branch information
pencil committed Feb 8, 2015
1 parent 657a66c commit a61a3bf
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

class CASino::TwoFactorAuthenticatorsController < CASino::ApplicationController
include CASino::SessionsHelper
include CASino::TwoFactorAuthenticatorsHelper
include CASino::TwoFactorAuthenticatorProcessor

before_action :ensure_signed_in
Expand Down
5 changes: 5 additions & 0 deletions app/helpers/casino/two_factor_authenticators_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module CASino::TwoFactorAuthenticatorsHelper
def otp_auth_url(two_factor_authenticator)
"otpauth://totp/#{u CASino.config.frontend[:sso_name] + ': ' + two_factor_authenticator.user.username}?secret=#{two_factor_authenticator.secret}&issuer=#{u CASino.config.frontend[:sso_name]}"
end
end
2 changes: 0 additions & 2 deletions app/helpers/service_tickets_helper.rb

This file was deleted.

7 changes: 5 additions & 2 deletions app/views/casino/two_factor_authenticators/new.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,13 @@
<%= t('two_factor_authenticators.instructions') %>
</p>
<div id="qr-code">
<img src="https://chart.googleapis.com/chart?cht=qr&chs=250x250&chl=<%= u "otpauth://totp/#{u CASino.config.frontend[:sso_name] + ': ' + @two_factor_authenticator.user.username}?secret=#{@two_factor_authenticator.secret}&issuer=#{u CASino.config.frontend[:sso_name]}" %>" height="250" width="250"><br />
<img src="https://chart.googleapis.com/chart?cht=qr&chs=250x250&chl=<%= u otp_auth_url(@two_factor_authenticator) %>" height="250" width="250"><br />
</div>
<p id="secret">
<%= t('two_factor_authenticators.secret') %>: <%= @two_factor_authenticator.secret %>
<%= t('two_factor_authenticators.secret') %>:
<a href="<%= otp_auth_url(@two_factor_authenticator) %>">
<%= @two_factor_authenticator.secret %>
</a>
</p>
</div>

Expand Down

0 comments on commit a61a3bf

Please sign in to comment.