devise-authy 1.0.0 → 1.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (104) hide show
  1. data/Gemfile +3 -1
  2. data/Gemfile.lock +90 -62
  3. data/Rakefile +1 -1
  4. data/VERSION +1 -1
  5. data/app/controllers/devise/devise_authy_controller.rb +23 -5
  6. data/app/views/devise/enable_authy.html.erb +2 -3
  7. data/app/views/devise/enable_authy.html.haml +2 -5
  8. data/app/views/devise/verify_authy.html.erb +5 -0
  9. data/app/views/devise/verify_authy.html.haml +3 -0
  10. data/authy-devise-demo/Gemfile +1 -0
  11. data/authy-devise-demo/Gemfile.lock +12 -3
  12. data/authy-devise-demo/app/views/devise/devise_authy/enable_authy.html.erb +2 -3
  13. data/authy-devise-demo/app/views/devise/devise_authy/verify_authy.html.erb +5 -0
  14. data/authy-devise-demo/app/views/layouts/application.html.erb +14 -2
  15. data/authy-devise-demo/config/initializers/devise.rb +7 -2
  16. data/authy-devise-demo/config/locales/devise.authy.en.yml +4 -1
  17. data/config/locales/en.yml +4 -1
  18. data/devise-authy.gemspec +62 -51
  19. data/lib/devise-authy.rb +3 -0
  20. data/lib/devise-authy/controllers/helpers.rb +40 -17
  21. data/lib/devise-authy/models/authy_authenticatable.rb +2 -0
  22. data/lib/generators/devise_authy/install_generator.rb +10 -3
  23. data/spec/controllers/devise_authy_controller_spec.rb +134 -45
  24. data/spec/features/authy_authenticatable_spec.rb +95 -0
  25. data/spec/generators_spec.rb +12 -6
  26. data/spec/orm/active_record.rb +1 -1
  27. data/spec/rails-app/Gemfile +8 -0
  28. data/spec/rails-app/Gemfile.lock +111 -0
  29. data/spec/{rails_app → rails-app}/Rakefile +2 -5
  30. data/spec/{rails_app → rails-app}/app/assets/images/rails.png +0 -0
  31. data/spec/rails-app/app/assets/javascripts/application.js +15 -0
  32. data/spec/rails-app/app/assets/javascripts/devise_authy.js +7 -0
  33. data/spec/rails-app/app/assets/javascripts/welcome.js +2 -0
  34. data/spec/rails-app/app/assets/stylesheets/application.css +13 -0
  35. data/spec/{rails_app → rails-app}/app/assets/stylesheets/devise_authy.css +0 -0
  36. data/spec/rails-app/app/assets/stylesheets/welcome.css.scss +3 -0
  37. data/spec/{rails_app → rails-app}/app/controllers/application_controller.rb +0 -1
  38. data/spec/rails-app/app/controllers/welcome_controller.rb +6 -0
  39. data/spec/{rails_app → rails-app}/app/helpers/application_helper.rb +0 -0
  40. data/spec/rails-app/app/helpers/welcome_helper.rb +2 -0
  41. data/spec/{rails_app → rails-app}/app/mailers/.gitkeep +0 -0
  42. data/spec/{rails_app → rails-app}/app/models/.gitkeep +0 -0
  43. data/spec/{rails_app → rails-app}/app/models/user.rb +4 -2
  44. data/spec/{rails_app/app/views/devise/devise_authy/register.html.erb → rails-app/app/views/devise/devise_authy/enable_authy.html.erb} +4 -6
  45. data/spec/rails-app/app/views/devise/devise_authy/verify_authy.html.erb +13 -0
  46. data/spec/rails-app/app/views/devise/devise_authy/verify_authy_installation.html.erb +10 -0
  47. data/spec/rails-app/app/views/layouts/application.html.erb +29 -0
  48. data/spec/rails-app/app/views/welcome/index.html.erb +5 -0
  49. data/spec/{rails_app → rails-app}/config.ru +0 -0
  50. data/spec/{rails_app → rails-app}/config/application.rb +18 -2
  51. data/spec/rails-app/config/boot.rb +6 -0
  52. data/spec/{rails_app → rails-app}/config/database.yml +6 -3
  53. data/spec/{rails_app → rails-app}/config/environment.rb +0 -0
  54. data/spec/{rails_app → rails-app}/config/environments/development.rb +2 -0
  55. data/spec/{rails_app → rails-app}/config/environments/production.rb +0 -0
  56. data/spec/{rails_app → rails-app}/config/environments/test.rb +0 -0
  57. data/spec/rails-app/config/initializers/authy.rb +2 -0
  58. data/spec/{rails_app → rails-app}/config/initializers/backtrace_silencers.rb +0 -0
  59. data/spec/{rails_app → rails-app}/config/initializers/devise.rb +13 -5
  60. data/spec/{rails_app → rails-app}/config/initializers/inflections.rb +5 -0
  61. data/spec/{rails_app → rails-app}/config/initializers/mime_types.rb +0 -0
  62. data/spec/{rails_app → rails-app}/config/initializers/secret_token.rb +1 -1
  63. data/spec/{rails_app → rails-app}/config/initializers/session_store.rb +2 -2
  64. data/spec/{rails_app → rails-app}/config/initializers/wrap_parameters.rb +0 -0
  65. data/spec/{rails_app → rails-app}/config/locales/devise.authy.en.yml +7 -2
  66. data/spec/rails-app/config/locales/devise.en.yml +59 -0
  67. data/spec/rails-app/config/locales/en.yml +5 -0
  68. data/spec/{rails_app → rails-app}/config/routes.rb +3 -2
  69. data/spec/rails-app/db/development.sqlite3 +0 -0
  70. data/spec/{rails_app/db/migrate/20121029205626_devise_create_users.rb → rails-app/db/migrate/20130419164907_devise_create_users.rb} +15 -1
  71. data/spec/{rails_app/db/migrate/20121029205628_devise_authy_add_to_users.rb → rails-app/db/migrate/20130419164936_devise_authy_add_to_users.rb} +5 -2
  72. data/spec/{rails_app → rails-app}/db/schema.rb +7 -12
  73. data/spec/rails-app/db/seeds.rb +7 -0
  74. data/spec/rails-app/lib/assets/.gitkeep +0 -0
  75. data/spec/rails-app/lib/tasks/.gitkeep +0 -0
  76. data/spec/rails-app/public/404.html +26 -0
  77. data/spec/rails-app/public/422.html +26 -0
  78. data/spec/rails-app/public/500.html +25 -0
  79. data/spec/rails-app/public/favicon.ico +0 -0
  80. data/spec/rails-app/public/robots.txt +5 -0
  81. data/spec/{rails_app → rails-app}/script/rails +0 -0
  82. data/spec/routing/routes_spec.rb +20 -8
  83. data/spec/spec_helper.rb +1 -2
  84. data/spec/support/helpers.rb +6 -1
  85. metadata +86 -62
  86. data/spec/integration/authy_authenticatable.rb +0 -88
  87. data/spec/rails_app/app/assets/javascripts/application.js +0 -10
  88. data/spec/rails_app/app/assets/stylesheets/application.css +0 -9
  89. data/spec/rails_app/app/assets/stylesheets/devise_authy.css.scss +0 -26
  90. data/spec/rails_app/app/assets/stylesheets/scaffolds.css.scss +0 -56
  91. data/spec/rails_app/app/controllers/posts_controller.rb +0 -83
  92. data/spec/rails_app/app/helpers/posts_helper.rb +0 -2
  93. data/spec/rails_app/app/models/post.rb +0 -2
  94. data/spec/rails_app/app/views/devise/devise_authy/show.html.erb +0 -10
  95. data/spec/rails_app/app/views/layouts/application.html.erb +0 -24
  96. data/spec/rails_app/app/views/posts/_form.html.erb +0 -25
  97. data/spec/rails_app/app/views/posts/edit.html.erb +0 -6
  98. data/spec/rails_app/app/views/posts/index.html.erb +0 -27
  99. data/spec/rails_app/app/views/posts/new.html.erb +0 -5
  100. data/spec/rails_app/app/views/posts/show.html.erb +0 -15
  101. data/spec/rails_app/config/boot.rb +0 -7
  102. data/spec/rails_app/config/initializers/authy.rb +0 -3
  103. data/spec/rails_app/db/migrate/20121029205627_create_posts.rb +0 -10
  104. data/spec/rails_app/public/favicon.ico +0 -0
@@ -1,10 +0,0 @@
1
- // This is a manifest file that'll be compiled into including all the files listed below.
2
- // Add new JavaScript/Coffee code in separate files in this directory and they'll automatically
3
- // be included in the compiled file accessible from http://example.com/assets/application.js
4
- // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
5
- // the compiled file.
6
- //
7
- //= require jquery
8
- //= require jquery_ujs
9
- //= require form.authy
10
- //= require_tree .
@@ -1,9 +0,0 @@
1
- /*
2
- * This is a manifest file that'll automatically include all the stylesheets available in this directory
3
- * and any sub-directories. You're free to add application-wide styles to this file and they'll appear at
4
- * the top of the compiled file, but it's generally better to create a new file per style scope.
5
- *= require_self
6
- *= require_tree .
7
- *= require 'flags.authy'
8
- *= require 'form.authy'
9
- */
@@ -1,26 +0,0 @@
1
- .devise_authy {
2
- margin-left: auto;
3
- margin-right: auto;
4
- width: 350px;
5
- }
6
-
7
- legend {
8
- display: block;
9
- width: 100%;
10
- padding: 0;
11
- margin-bottom: 20px;
12
- font-size: 21px;
13
- line-height: 40px;
14
- color: #333;
15
- border-bottom: 1px solid #E5E5E5;
16
- }
17
-
18
- label,
19
- input[type="submit"],
20
- button {
21
- font-size: 14px;
22
- font-weight: normal;
23
- line-height: 20px;
24
- padding: 8px;
25
- margin: 8px;
26
- }
@@ -1,56 +0,0 @@
1
- body {
2
- background-color: #fff;
3
- color: #333;
4
- font-family: verdana, arial, helvetica, sans-serif;
5
- font-size: 13px;
6
- line-height: 18px; }
7
-
8
- p, ol, ul, td {
9
- font-family: verdana, arial, helvetica, sans-serif;
10
- font-size: 13px;
11
- line-height: 18px; }
12
-
13
- pre {
14
- background-color: #eee;
15
- padding: 10px;
16
- font-size: 11px; }
17
-
18
- a {
19
- color: #000;
20
- &:visited {
21
- color: #666; }
22
- &:hover {
23
- color: #fff;}
24
- }
25
-
26
- div {
27
- &.field, &.actions {
28
- margin-bottom: 10px; } }
29
-
30
- #notice {
31
- color: green; }
32
-
33
- .field_with_errors {
34
- padding: 2px;
35
- background-color: red;
36
- display: table; }
37
-
38
- #error_explanation {
39
- width: 450px;
40
- border: 2px solid red;
41
- padding: 7px;
42
- padding-bottom: 0;
43
- margin-bottom: 20px;
44
- background-color: #f0f0f0;
45
- h2 {
46
- text-align: left;
47
- font-weight: bold;
48
- padding: 5px 5px 5px 15px;
49
- font-size: 12px;
50
- margin: -7px;
51
- margin-bottom: 0px;
52
- background-color: #c00;
53
- color: #fff; }
54
- ul li {
55
- font-size: 12px;
56
- list-style: square; } }
@@ -1,83 +0,0 @@
1
- class PostsController < ApplicationController
2
- # GET /posts
3
- # GET /posts.json
4
- def index
5
- @posts = Post.all
6
-
7
- respond_to do |format|
8
- format.html # index.html.erb
9
- format.json { render json: @posts }
10
- end
11
- end
12
-
13
- # GET /posts/1
14
- # GET /posts/1.json
15
- def show
16
- @post = Post.find(params[:id])
17
-
18
- respond_to do |format|
19
- format.html # show.html.erb
20
- format.json { render json: @post }
21
- end
22
- end
23
-
24
- # GET /posts/new
25
- # GET /posts/new.json
26
- def new
27
- @post = Post.new
28
-
29
- respond_to do |format|
30
- format.html # new.html.erb
31
- format.json { render json: @post }
32
- end
33
- end
34
-
35
- # GET /posts/1/edit
36
- def edit
37
- @post = Post.find(params[:id])
38
- end
39
-
40
- # POST /posts
41
- # POST /posts.json
42
- def create
43
- @post = Post.new(params[:post])
44
-
45
- respond_to do |format|
46
- if @post.save
47
- format.html { redirect_to @post, notice: 'Post was successfully created.' }
48
- format.json { render json: @post, status: :created, location: @post }
49
- else
50
- format.html { render action: "new" }
51
- format.json { render json: @post.errors, status: :unprocessable_entity }
52
- end
53
- end
54
- end
55
-
56
- # PUT /posts/1
57
- # PUT /posts/1.json
58
- def update
59
- @post = Post.find(params[:id])
60
-
61
- respond_to do |format|
62
- if @post.update_attributes(params[:post])
63
- format.html { redirect_to @post, notice: 'Post was successfully updated.' }
64
- format.json { head :ok }
65
- else
66
- format.html { render action: "edit" }
67
- format.json { render json: @post.errors, status: :unprocessable_entity }
68
- end
69
- end
70
- end
71
-
72
- # DELETE /posts/1
73
- # DELETE /posts/1.json
74
- def destroy
75
- @post = Post.find(params[:id])
76
- @post.destroy
77
-
78
- respond_to do |format|
79
- format.html { redirect_to posts_url }
80
- format.json { head :ok }
81
- end
82
- end
83
- end
@@ -1,2 +0,0 @@
1
- module PostsHelper
2
- end
@@ -1,2 +0,0 @@
1
- class Post < ActiveRecord::Base
2
- end
@@ -1,10 +0,0 @@
1
- <div class="devise_authy">
2
- <%= form_for(resource, :as => resource_name, :url => [resource_name, :devise_authy], :html => {:id => 'devise_authy', :method => :put }) do |f| %>
3
- <legend><%= I18n.t('submit_token_title', {:scope => 'devise'}) %></legend>
4
- <%= f.hidden_field :authy_id, {:value => @authy_id} %>
5
- <%= f.label :token %>
6
- <%= f.text_field :token, :autocomplete => :off, :id => 'authy-token'%>
7
- <%= link_to '?', '#', :id => 'authy-help' %>
8
- <%= f.submit I18n.t('submit_token', {:scope => 'devise'}), :class => 'btn' %>
9
- <% end %>
10
- </div>
@@ -1,24 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <title>Authy App</title>
5
- <%= stylesheet_link_tag 'application' %>
6
- <%= javascript_include_tag 'application' %>
7
- <%= csrf_meta_tags %>
8
- </head>
9
- <body>
10
- <% if flash[:notice] %>
11
- <div id="notice">
12
- <%= flash[:notice] %>
13
- </div>
14
- <% end %>
15
-
16
- <% if flash[:error] %>
17
- <div class='alert alert-error'>
18
- <%= flash[:error] %>
19
- <% end %>
20
-
21
- <%= yield %>
22
-
23
- </body>
24
- </html>
@@ -1,25 +0,0 @@
1
- <%= form_for(@post) do |f| %>
2
- <% if @post.errors.any? %>
3
- <div id="error_explanation">
4
- <h2><%= pluralize(@post.errors.count, "error") %> prohibited this post from being saved:</h2>
5
-
6
- <ul>
7
- <% @post.errors.full_messages.each do |msg| %>
8
- <li><%= msg %></li>
9
- <% end %>
10
- </ul>
11
- </div>
12
- <% end %>
13
-
14
- <div class="field">
15
- <%= f.label :title %><br />
16
- <%= f.text_field :title %>
17
- </div>
18
- <div class="field">
19
- <%= f.label :body %><br />
20
- <%= f.text_area :body %>
21
- </div>
22
- <div class="actions">
23
- <%= f.submit %>
24
- </div>
25
- <% end %>
@@ -1,6 +0,0 @@
1
- <h1>Editing post</h1>
2
-
3
- <%= render 'form' %>
4
-
5
- <%= link_to 'Show', @post %> |
6
- <%= link_to 'Back', posts_path %>
@@ -1,27 +0,0 @@
1
- <h1>Listing posts</h1>
2
-
3
- <table>
4
- <tr>
5
- <th>Title</th>
6
- <th>Body</th>
7
- <th></th>
8
- <th></th>
9
- <th></th>
10
- </tr>
11
-
12
- <% @posts.each do |post| %>
13
- <tr>
14
- <td><%= post.title %></td>
15
- <td><%= post.body %></td>
16
- <td><%= link_to 'Show', post %></td>
17
- <td><%= link_to 'Edit', edit_post_path(post) %></td>
18
- <td><%= link_to 'Destroy', post, confirm: 'Are you sure?', method: :delete %></td>
19
- </tr>
20
- <% end %>
21
- </table>
22
-
23
- <br />
24
-
25
- <%= link_to 'New Post', new_post_path %>
26
- <%= link_to 'Enable Authy', user_enable_authy_path %>
27
- <%= link_to 'Logout', destroy_user_session_path, :method => :delete %>
@@ -1,5 +0,0 @@
1
- <h1>New post</h1>
2
-
3
- <%= render 'form' %>
4
-
5
- <%= link_to 'Back', posts_path %>
@@ -1,15 +0,0 @@
1
- <p id="notice"><%= notice %></p>
2
-
3
- <p>
4
- <b>Title:</b>
5
- <%= @post.title %>
6
- </p>
7
-
8
- <p>
9
- <b>Body:</b>
10
- <%= @post.body %>
11
- </p>
12
-
13
-
14
- <%= link_to 'Edit', edit_post_path(@post) %> |
15
- <%= link_to 'Back', posts_path %>
@@ -1,7 +0,0 @@
1
- begin
2
- require File.expand_path("../../../../.bundle/environment", __FILE__)
3
- rescue LoadError
4
- require 'rubygems'
5
- require 'bundler'
6
- Bundler.setup :default, :test, :active_record
7
- end
@@ -1,3 +0,0 @@
1
- require 'authy'
2
-
3
- Authy.api_key = 'faa790e925ddebed1288d2dd28242291'
@@ -1,10 +0,0 @@
1
- class CreatePosts < ActiveRecord::Migration
2
- def change
3
- create_table :posts do |t|
4
- t.string :title
5
- t.text :body
6
-
7
- t.timestamps
8
- end
9
- end
10
- end
Binary file