Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get demo app working #166

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@ build-iPhoneSimulator/

# for a library or gem, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
Gemfile.lock
.ruby-version
.ruby-gemset
.tool-versions

Expand Down
2 changes: 2 additions & 0 deletions demo/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,5 @@
# Ignore all logfiles and tempfiles.
/log/*.log
/tmp

.byebug_history
1 change: 1 addition & 0 deletions demo/.ruby-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2.5.1
8 changes: 5 additions & 3 deletions demo/Gemfile
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
source 'https://rubygems.org'

gem 'rails', '4.2.7.1'
gem 'sqlite3'
gem 'bundler', '1.17.3'
gem 'rails', '4.2.11'
gem 'sqlite3', '~> 1.3.6'
gem 'sass-rails', '~> 4.0.3'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.0.0'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby
gem 'byebug'

gem 'jquery-rails'
gem 'turbolinks'

gem 'devise'
gem 'devise-two-factor', path: '../'
gem 'rqrcode-rails3'
gem 'rqrcode'
177 changes: 177 additions & 0 deletions demo/Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,177 @@
PATH
remote: ..
specs:
devise-two-factor (3.1.0)
activesupport (< 6.1)
attr_encrypted (>= 1.3, < 4, != 2)
devise (~> 4.0)
railties (< 6.1)
rotp (~> 2.0)

GEM
remote: https://rubygems.org/
specs:
actionmailer (4.2.11)
actionpack (= 4.2.11)
actionview (= 4.2.11)
activejob (= 4.2.11)
mail (~> 2.5, >= 2.5.4)
rails-dom-testing (~> 1.0, >= 1.0.5)
actionpack (4.2.11)
actionview (= 4.2.11)
activesupport (= 4.2.11)
rack (~> 1.6)
rack-test (~> 0.6.2)
rails-dom-testing (~> 1.0, >= 1.0.5)
rails-html-sanitizer (~> 1.0, >= 1.0.2)
actionview (4.2.11)
activesupport (= 4.2.11)
builder (~> 3.1)
erubis (~> 2.7.0)
rails-dom-testing (~> 1.0, >= 1.0.5)
rails-html-sanitizer (~> 1.0, >= 1.0.3)
activejob (4.2.11)
activesupport (= 4.2.11)
globalid (>= 0.3.0)
activemodel (4.2.11)
activesupport (= 4.2.11)
builder (~> 3.1)
activerecord (4.2.11)
activemodel (= 4.2.11)
activesupport (= 4.2.11)
arel (~> 6.0)
activesupport (4.2.11)
i18n (~> 0.7)
minitest (~> 5.1)
thread_safe (~> 0.3, >= 0.3.4)
tzinfo (~> 1.1)
arel (6.0.4)
attr_encrypted (3.1.0)
encryptor (~> 3.0.0)
bcrypt (3.1.13)
builder (3.2.4)
byebug (11.1.1)
chunky_png (1.3.11)
coffee-rails (4.0.1)
coffee-script (>= 2.2.0)
railties (>= 4.0.0, < 5.0)
coffee-script (2.4.1)
coffee-script-source
execjs
coffee-script-source (1.12.2)
concurrent-ruby (1.1.6)
crass (1.0.6)
devise (4.7.1)
bcrypt (~> 3.0)
orm_adapter (~> 0.1)
railties (>= 4.1.0)
responders
warden (~> 1.2.3)
encryptor (3.0.0)
erubis (2.7.0)
execjs (2.7.0)
globalid (0.4.2)
activesupport (>= 4.2.0)
hike (1.2.3)
i18n (0.9.5)
concurrent-ruby (~> 1.0)
jquery-rails (4.3.5)
rails-dom-testing (>= 1, < 3)
railties (>= 4.2.0)
thor (>= 0.14, < 2.0)
loofah (2.4.0)
crass (~> 1.0.2)
nokogiri (>= 1.5.9)
mail (2.7.1)
mini_mime (>= 0.1.1)
mini_mime (1.0.2)
mini_portile2 (2.4.0)
minitest (5.14.0)
multi_json (1.14.1)
nokogiri (1.10.8)
mini_portile2 (~> 2.4.0)
orm_adapter (0.5.0)
rack (1.6.13)
rack-test (0.6.3)
rack (>= 1.0)
rails (4.2.11)
actionmailer (= 4.2.11)
actionpack (= 4.2.11)
actionview (= 4.2.11)
activejob (= 4.2.11)
activemodel (= 4.2.11)
activerecord (= 4.2.11)
activesupport (= 4.2.11)
bundler (>= 1.3.0, < 2.0)
railties (= 4.2.11)
sprockets-rails
rails-deprecated_sanitizer (1.0.3)
activesupport (>= 4.2.0.alpha)
rails-dom-testing (1.0.9)
activesupport (>= 4.2.0, < 5.0)
nokogiri (~> 1.6)
rails-deprecated_sanitizer (>= 1.0.1)
rails-html-sanitizer (1.3.0)
loofah (~> 2.3)
railties (4.2.11)
actionpack (= 4.2.11)
activesupport (= 4.2.11)
rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0)
rake (13.0.1)
responders (2.4.1)
actionpack (>= 4.2.0, < 6.0)
railties (>= 4.2.0, < 6.0)
rotp (2.1.2)
rqrcode (1.1.2)
chunky_png (~> 1.0)
rqrcode_core (~> 0.1)
rqrcode_core (0.1.1)
sass (3.2.19)
sass-rails (4.0.5)
railties (>= 4.0.0, < 5.0)
sass (~> 3.2.2)
sprockets (~> 2.8, < 3.0)
sprockets-rails (~> 2.0)
sprockets (2.12.5)
hike (~> 1.2)
multi_json (~> 1.0)
rack (~> 1.0)
tilt (~> 1.1, != 1.3.0)
sprockets-rails (2.3.3)
actionpack (>= 3.0)
activesupport (>= 3.0)
sprockets (>= 2.8, < 4.0)
sqlite3 (1.3.13)
thor (1.0.1)
thread_safe (0.3.6)
tilt (1.4.1)
turbolinks (5.2.1)
turbolinks-source (~> 5.2)
turbolinks-source (5.2.0)
tzinfo (1.2.6)
thread_safe (~> 0.1)
uglifier (4.2.0)
execjs (>= 0.3.0, < 3)
warden (1.2.7)
rack (>= 1.0)

PLATFORMS
ruby

DEPENDENCIES
bundler (= 1.17.3)
byebug
coffee-rails (~> 4.0.0)
devise
devise-two-factor!
jquery-rails
rails (= 4.2.11)
rqrcode
sass-rails (~> 4.0.3)
sqlite3 (~> 1.3.6)
turbolinks
uglifier (>= 1.3.0)

BUNDLED WITH
1.17.3
16 changes: 12 additions & 4 deletions demo/app/views/home/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,18 @@

<% if current_user.otp_required_for_login %>
<%= button_to "Disable 2FA", users_disable_otp_path, :method => :post %>
<%= raw RQRCode::render_qrcode(current_user.otp_provisioning_uri(current_user.email, issuer: "Devise-Two-Factor-Demo"),
:svg,
:level => :l,
:unit => 2) %>

<br />
<% code = current_user.otp_provisioning_uri(current_user.email, issuer: "Devise-Two-Factor-Demo") %>
<%= RQRCode::QRCode.new(code).as_svg(module_size: 4).html_safe %>

<br />
<p>
DEBUG INFO:
</p>
CODE: <%= code %><br />
SECRET: <%= current_user.otp_secret %><br />

<br>
<% end %>
<%= link_to "Log out", destroy_user_session_path, :method => :delete %>
Expand Down
2 changes: 2 additions & 0 deletions demo/config/local_env.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# update with rake secret
ENCRYPTION_KEY: "e2d9c3ce555255496121e9e869507a563467c89a0e2f7a89e59635656a9f46fad4b74d07e39a96ee1e40c5644008079dadce515f09f47188974d35b5c1e3fd86"