stormpath-rails 1.1.2.beta → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (130) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/.rspec +1 -1
  4. data/.rubocop.yml +22 -0
  5. data/.travis.yml +6 -3
  6. data/Gemfile +10 -3
  7. data/README.md +139 -142
  8. data/Rakefile +9 -9
  9. data/app/assets/stylesheets/stormpath.css.scss +3 -2
  10. data/app/controllers/stormpath/rails/base_controller.rb +25 -6
  11. data/app/controllers/stormpath/rails/change_password/create_controller.rb +68 -0
  12. data/app/controllers/stormpath/rails/change_password/new_controller.rb +38 -0
  13. data/app/controllers/stormpath/rails/forgot_password/create_controller.rb +37 -0
  14. data/app/controllers/stormpath/rails/forgot_password/new_controller.rb +14 -0
  15. data/app/controllers/stormpath/rails/login/create_controller.rb +60 -0
  16. data/app/controllers/stormpath/rails/login/new_controller.rb +20 -0
  17. data/app/controllers/stormpath/rails/logout/create_controller.rb +61 -0
  18. data/app/controllers/stormpath/rails/oauth2/create_controller.rb +82 -0
  19. data/app/controllers/stormpath/rails/oauth2/new_controller.rb +11 -0
  20. data/app/controllers/stormpath/rails/profile/show_controller.rb +15 -0
  21. data/app/controllers/stormpath/rails/register/create_controller.rb +86 -0
  22. data/app/controllers/stormpath/rails/register/new_controller.rb +20 -0
  23. data/app/controllers/stormpath/rails/verify_email/create_controller.rb +37 -0
  24. data/app/controllers/stormpath/rails/verify_email/show_controller.rb +51 -0
  25. data/app/forms/stormpath/rails/login_form.rb +60 -0
  26. data/app/forms/stormpath/rails/registration_form.rb +106 -0
  27. data/app/forms/stormpath/rails/registration_form_fields.rb +71 -0
  28. data/app/helpers/social_helper.rb +2 -1
  29. data/app/serializers/stormpath/rails/account_serializer.rb +32 -0
  30. data/app/serializers/stormpath/rails/form_serializer.rb +37 -0
  31. data/app/serializers/stormpath/rails/login_new_serializer.rb +11 -0
  32. data/app/serializers/stormpath/rails/profile_serializer.rb +71 -0
  33. data/app/serializers/stormpath/rails/registration_form_serializer.rb +11 -0
  34. data/app/services/stormpath/rails/account_from_access_token/local_account_resolution.rb +48 -0
  35. data/app/services/stormpath/rails/account_from_access_token/stormpath_account_resolution.rb +27 -0
  36. data/app/services/stormpath/rails/account_from_access_token.rb +33 -0
  37. data/app/services/stormpath/rails/account_login.rb +28 -0
  38. data/app/services/stormpath/rails/account_login_with_stormpath_token.rb +32 -0
  39. data/app/services/stormpath/rails/client_credentials_authentication.rb +40 -0
  40. data/app/services/stormpath/rails/controller_authentication/from_basic_auth.rb +45 -0
  41. data/app/services/stormpath/rails/controller_authentication/from_bearer_auth.rb +34 -0
  42. data/app/services/stormpath/rails/controller_authentication/from_cookies.rb +71 -0
  43. data/app/services/stormpath/rails/controller_authentication.rb +44 -0
  44. data/app/services/stormpath/rails/delete_access_token.rb +48 -0
  45. data/app/services/stormpath/rails/delete_refresh_token.rb +11 -0
  46. data/app/services/stormpath/rails/forgot_password_token_verification.rb +31 -0
  47. data/app/services/stormpath/rails/password_change.rb +17 -0
  48. data/app/services/stormpath/rails/refresh_token_authentication.rb +28 -0
  49. data/app/services/stormpath/rails/resend_email_verification.rb +33 -0
  50. data/app/services/stormpath/rails/send_password_reset_email.rb +33 -0
  51. data/app/services/stormpath/rails/token_cookie_setter.rb +84 -0
  52. data/app/services/stormpath/rails/verify_email_token.rb +27 -0
  53. data/app/views/{passwords/forgot_change.html.erb → stormpath/rails/change_password/new.html.erb} +4 -10
  54. data/app/views/{passwords/forgot.html.erb → stormpath/rails/forgot_password/new.html.erb} +14 -4
  55. data/app/views/{layouts → stormpath/rails/layouts}/stormpath.html.erb +3 -3
  56. data/app/views/stormpath/rails/login/_form.html.erb +45 -0
  57. data/app/views/stormpath/rails/login/new.html.erb +12 -0
  58. data/app/views/stormpath/rails/register/_form.html.erb +19 -0
  59. data/app/views/{users → stormpath/rails/register}/new.html.erb +3 -3
  60. data/app/views/stormpath/rails/shared/_input.html.erb +15 -0
  61. data/app/views/stormpath/rails/verify_email/new.html.erb +49 -0
  62. data/bin/console +3 -3
  63. data/bin/rails +1 -1
  64. data/bin/rake +2 -2
  65. data/bin/rspec +2 -2
  66. data/config/initializers/assets.rb +3 -1
  67. data/lib/generators/stormpath/install/install_generator.rb +1 -92
  68. data/lib/generators/stormpath/install/templates/default_config.yml +229 -0
  69. data/lib/generators/stormpath/views/USAGE +0 -0
  70. data/lib/generators/stormpath/views/views_generator.rb +2 -2
  71. data/lib/stormpath/rails/client.rb +8 -85
  72. data/lib/stormpath/rails/config/account_store_verification.rb +45 -0
  73. data/lib/stormpath/rails/config/application_resolution.rb +76 -0
  74. data/lib/stormpath/rails/config/dynamic_configuration.rb +50 -0
  75. data/lib/stormpath/rails/config/read_file.rb +35 -0
  76. data/lib/stormpath/rails/configuration.rb +30 -35
  77. data/lib/stormpath/rails/content_type_negotiator.rb +50 -0
  78. data/lib/stormpath/rails/controller.rb +36 -5
  79. data/lib/stormpath/rails/errors/invalid_sptoken_error.rb +9 -0
  80. data/lib/stormpath/rails/errors/no_sptoken_error.rb +13 -0
  81. data/lib/stormpath/rails/router.rb +75 -0
  82. data/lib/stormpath/rails/routing_constraint.rb +9 -0
  83. data/lib/stormpath/rails/social.rb +6 -6
  84. data/lib/stormpath/rails/version.rb +2 -1
  85. data/lib/stormpath/rails.rb +9 -19
  86. data/lib/stormpath-rails.rb +1 -0
  87. data/stormpath-rails.gemspec +13 -11
  88. metadata +96 -54
  89. data/app/controllers/stormpath/rails/omniauth_controller.rb +0 -11
  90. data/app/controllers/stormpath/rails/passwords_controller.rb +0 -56
  91. data/app/controllers/stormpath/rails/sessions_controller.rb +0 -52
  92. data/app/controllers/stormpath/rails/users_controller.rb +0 -65
  93. data/app/views/passwords/edit.html.erb +0 -0
  94. data/app/views/passwords/email_sent.html.erb +0 -15
  95. data/app/views/passwords/forgot_change_failed.html.erb +0 -14
  96. data/app/views/passwords/forgot_complete.html.erb +0 -19
  97. data/app/views/sessions/_facebook_login_form.erb +0 -31
  98. data/app/views/sessions/_form.html.erb +0 -31
  99. data/app/views/sessions/_google_login_form.html.erb +0 -3
  100. data/app/views/sessions/_social_auth.html.erb +0 -7
  101. data/app/views/sessions/new.html.erb +0 -21
  102. data/app/views/users/_form.html.erb +0 -43
  103. data/app/views/users/verification_complete.html.erb +0 -20
  104. data/app/views/users/verification_email_sent.html.erb +0 -15
  105. data/app/views/users/verification_failed.html.erb +0 -14
  106. data/app/views/users/verification_resend.html.erb +0 -14
  107. data/config/routes.rb +0 -16
  108. data/lib/generators/stormpath/install/templates/db/migrate/add_stormpath_to_users.rb +0 -21
  109. data/lib/generators/stormpath/install/templates/db/migrate/create_users.rb +0 -12
  110. data/lib/generators/stormpath/install/templates/stormpath.rb +0 -4
  111. data/lib/generators/stormpath/install/templates/user.rb +0 -3
  112. data/lib/generators/stormpath/routes/routes_generator.rb +0 -23
  113. data/lib/generators/stormpath/routes/templates/routes.rb +0 -5
  114. data/lib/stormpath/rails/account.rb +0 -6
  115. data/lib/stormpath/rails/account_status.rb +0 -28
  116. data/lib/stormpath/rails/authentication.rb +0 -72
  117. data/lib/stormpath/rails/authentication_status.rb +0 -22
  118. data/lib/stormpath/rails/session.rb +0 -37
  119. data/lib/stormpath/rails/user.rb +0 -25
  120. data/lib/stormpath/rails/user_config/api_key.rb +0 -17
  121. data/lib/stormpath/rails/user_config/application.rb +0 -12
  122. data/lib/stormpath/rails/user_config/facebook.rb +0 -16
  123. data/lib/stormpath/rails/user_config/forgot_password.rb +0 -12
  124. data/lib/stormpath/rails/user_config/google.rb +0 -16
  125. data/lib/stormpath/rails/user_config/id_site.rb +0 -13
  126. data/lib/stormpath/rails/user_config/login.rb +0 -13
  127. data/lib/stormpath/rails/user_config/logout.rb +0 -13
  128. data/lib/stormpath/rails/user_config/register.rb +0 -13
  129. data/lib/stormpath/rails/user_config/verify_email.rb +0 -14
  130. data/lib/stormpath/testing/helpers.rb +0 -49
@@ -0,0 +1,48 @@
1
+ module Stormpath
2
+ module Rails
3
+ class DeleteAccessToken
4
+ def self.call(token)
5
+ new(token).call
6
+ end
7
+
8
+ def initialize(token)
9
+ @token = token
10
+ end
11
+
12
+ def call
13
+ token && delete_token
14
+ end
15
+
16
+ private
17
+
18
+ def delete_token
19
+ token_resource.delete
20
+ rescue JWT::ExpiredSignature, JWT::DecodeError
21
+ end
22
+
23
+ def token_resource
24
+ tokens_collection.get(token_unique_identifier)
25
+ end
26
+
27
+ def tokens_collection
28
+ stormpath_client.access_tokens
29
+ end
30
+
31
+ def token_unique_identifier
32
+ JWT.decode(token, api_key_secret).first['jti']
33
+ end
34
+
35
+ def api_key_secret
36
+ stormpath_client.data_store.api_key.secret
37
+ end
38
+
39
+ def stormpath_client
40
+ Stormpath::Rails::Client.client
41
+ end
42
+
43
+ private
44
+
45
+ attr_reader(:token)
46
+ end
47
+ end
48
+ end
@@ -0,0 +1,11 @@
1
+ module Stormpath
2
+ module Rails
3
+ class DeleteRefreshToken < DeleteAccessToken
4
+ private
5
+
6
+ def tokens_collection
7
+ stormpath_client.refresh_tokens
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,31 @@
1
+ module Stormpath
2
+ module Rails
3
+ class ForgotPasswordTokenVerification
4
+ attr_reader :sptoken
5
+
6
+ def initialize(sptoken)
7
+ raise(NoSptokenError) if sptoken.nil?
8
+ @sptoken = sptoken
9
+ end
10
+
11
+ def call
12
+ begin
13
+ account_from_token
14
+ rescue Stormpath::Error => error
15
+ raise if error.status != 404
16
+ raise InvalidSptokenError, error.message
17
+ end
18
+ end
19
+
20
+ private
21
+
22
+ def account_from_token
23
+ Stormpath::Rails::Client
24
+ .application
25
+ .password_reset_tokens
26
+ .get(sptoken)
27
+ .account
28
+ end
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,17 @@
1
+ module Stormpath
2
+ module Rails
3
+ class PasswordChange
4
+ attr_reader :account, :password
5
+
6
+ def initialize(sptoken, password)
7
+ @account = ForgotPasswordTokenVerification.new(sptoken).call
8
+ @password = password
9
+ end
10
+
11
+ def call
12
+ account.password = password
13
+ account.save
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,28 @@
1
+ module Stormpath
2
+ module Rails
3
+ class RefreshTokenAuthentication
4
+ attr_reader :refresh_token
5
+
6
+ def initialize(refresh_token)
7
+ raise(FormError, "Refresh token can't be blank") if refresh_token.blank?
8
+ @refresh_token = refresh_token
9
+ end
10
+
11
+ def save!
12
+ Client.application.authenticate_oauth(refresh_grant_request)
13
+ end
14
+
15
+ private
16
+
17
+ def refresh_grant_request
18
+ Stormpath::Oauth::RefreshGrantRequest.new(refresh_token)
19
+ end
20
+
21
+ class FormError < ArgumentError
22
+ def status
23
+ 400
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,33 @@
1
+ module Stormpath
2
+ module Rails
3
+ class ResendEmailVerification
4
+ PROPERTY_VALUE_DOES_NOT_MATCH_A_STORMPATH_RESOURCE_CODE = 2016
5
+
6
+ attr_reader :email
7
+
8
+ def initialize(email)
9
+ raise(NoEmailError, 'Email parameter not provided.') if email.blank?
10
+ @email = email
11
+ end
12
+
13
+ def call
14
+ begin
15
+ application.verification_emails.create(login: email)
16
+ rescue Stormpath::Error => error
17
+ if error.code == PROPERTY_VALUE_DOES_NOT_MATCH_A_STORMPATH_RESOURCE_CODE
18
+ raise UnexistingEmailError, error.message
19
+ else
20
+ raise
21
+ end
22
+ end
23
+ end
24
+
25
+ def application
26
+ Stormpath::Rails::Client.application
27
+ end
28
+
29
+ NoEmailError = Class.new(ArgumentError)
30
+ UnexistingEmailError = Class.new(ArgumentError)
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,33 @@
1
+ module Stormpath
2
+ module Rails
3
+ class SendPasswordResetEmail
4
+ PROPERTY_VALUE_DOES_NOT_MATCH_A_STORMPATH_RESOURCE_CODE = 2016
5
+
6
+ attr_reader :email
7
+
8
+ def initialize(email)
9
+ raise(NoEmailError, 'Email parameter not provided.') if email.blank?
10
+ @email = email
11
+ end
12
+
13
+ def call
14
+ begin
15
+ application.send_password_reset_email(email)
16
+ rescue Stormpath::Error => error
17
+ if error.code == PROPERTY_VALUE_DOES_NOT_MATCH_A_STORMPATH_RESOURCE_CODE
18
+ raise UnexistingEmailError, error.message
19
+ else
20
+ raise
21
+ end
22
+ end
23
+ end
24
+
25
+ def application
26
+ Stormpath::Rails::Client.application
27
+ end
28
+
29
+ NoEmailError = Class.new(ArgumentError)
30
+ UnexistingEmailError = Class.new(ArgumentError)
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,84 @@
1
+ module Stormpath
2
+ module Rails
3
+ class TokenCookieSetter
4
+ attr_reader :cookie_jar, :access_token, :refresh_token
5
+
6
+ def self.call(cookie_jar, authentication_result)
7
+ new(cookie_jar, authentication_result).call
8
+ end
9
+
10
+ def initialize(cookie_jar, authentication_result)
11
+ @cookie_jar = cookie_jar
12
+ @access_token = authentication_result.access_token
13
+ @refresh_token = authentication_result.refresh_token
14
+ end
15
+
16
+ def call
17
+ SingleTokenCookieSetter.new(cookie_jar, access_token, access_token_cookie_config).call
18
+ SingleTokenCookieSetter.new(cookie_jar, refresh_token, refresh_token_cookie_config).call
19
+ end
20
+
21
+ private
22
+
23
+ def access_token_cookie_config
24
+ Stormpath::Rails.config.web.access_token_cookie
25
+ end
26
+
27
+ def refresh_token_cookie_config
28
+ Stormpath::Rails.config.web.refresh_token_cookie
29
+ end
30
+ end
31
+ end
32
+ end
33
+
34
+ class SingleTokenCookieSetter
35
+ attr_reader :cookie_jar, :token, :token_config
36
+
37
+ def initialize(cookie_jar, token, token_config)
38
+ @cookie_jar = cookie_jar
39
+ @token = token
40
+ @token_config = token_config
41
+ end
42
+
43
+ def call
44
+ cookie_jar[token_config.name] = cookie_data
45
+ end
46
+
47
+ private
48
+
49
+ def cookie_data
50
+ {
51
+ value: token,
52
+ expires: expires,
53
+ httponly: http_only,
54
+ path: path,
55
+ domain: domain,
56
+ secure: secure
57
+ }.compact
58
+ end
59
+
60
+ def expires
61
+ Time.zone.at(JWT.decode(token, ENV['STORMPATH_API_KEY_SECRET']).first['exp'])
62
+ end
63
+
64
+ def http_only
65
+ if token_config.http_only == false
66
+ nil
67
+ else
68
+ true
69
+ end
70
+ end
71
+
72
+ def path
73
+ token_config.path || '/'
74
+ end
75
+
76
+ def domain
77
+ token_config.domain
78
+ end
79
+
80
+ def secure
81
+ token_config.secure || false
82
+ end
83
+ end
84
+ # check for domain and https true
@@ -0,0 +1,27 @@
1
+ module Stormpath
2
+ module Rails
3
+ class VerifyEmailToken
4
+ attr_reader :sptoken
5
+
6
+ def initialize(sptoken)
7
+ raise(NoSptokenError) if sptoken.nil?
8
+ @sptoken = sptoken
9
+ end
10
+
11
+ def call
12
+ begin
13
+ client.accounts.verify_email_token(sptoken)
14
+ rescue Stormpath::Error => error
15
+ raise if error.code != 404
16
+ raise InvalidSptokenError, error.message
17
+ end
18
+ end
19
+
20
+ private
21
+
22
+ def client
23
+ Stormpath::Rails::Client.client
24
+ end
25
+ end
26
+ end
27
+ end
@@ -14,17 +14,11 @@
14
14
  </div>
15
15
  <% end %>
16
16
 
17
- <%= form_for :password, html: { class: "login-form form-horizontal" }, url: forgot_update_path(@account_url) do |form| %>
17
+ <%= form_for :password, url: "/change?sptoken=#{params[:sptoken]}", html: { class: "login-form form-horizontal" } do |form| %>
18
18
  <div class="form-group group-password">
19
- <%= form.label :original, class: "col-sm-4" %>
19
+ <%= form.label :password, 'Password', class: "col-sm-4" %>
20
20
  <div class="col-sm-8">
21
- <%= form.password_field :original, placeholder: 'Password', class: "form-control" %>
22
- </div>
23
- </div>
24
- <div class="form-group group-password">
25
- <%= form.label :repeated, 'Password (Again)', class: "col-sm-4" %>
26
- <div class="col-sm-8">
27
- <%= form.password_field :repeated, placeholder: 'Password (Again)', class: "form-control" %>
21
+ <%= form.password_field :repeated, placeholder: 'Password', class: "form-control", name: :password %>
28
22
  </div>
29
23
  </div>
30
24
  <div>
@@ -35,4 +29,4 @@
35
29
  </div>
36
30
  </div>
37
31
  </div>
38
- </div>
32
+ </div>
@@ -1,6 +1,16 @@
1
1
  <div class="container custom-container">
2
2
  <div class="va-wrapper">
3
3
  <div class="view login-view container">
4
+ <% if params[:status] == 'invalid_sptoken' %>
5
+ <div class="row">
6
+ <div class="alert alert-warning">
7
+ <p>
8
+ The password reset link you tried to use is no longer valid. Please request a new link from the form below.
9
+ </p>
10
+ </div>
11
+ </div>
12
+ <% end %>
13
+
4
14
  <div class="box row">
5
15
  <div class="email-password-area col-xs-12 large col-sm-12">
6
16
  <div class="header">
@@ -14,11 +24,11 @@
14
24
  </div>
15
25
  <% end %>
16
26
 
17
- <%= form_for :password, html: { class: "login-form form-horizontal" }, url: forgot_send_path do |form| %>
27
+ <%= form_for :password, html: { class: "login-form form-horizontal" }, url: forgot_password_path do |form| %>
18
28
  <div class="form-group group-email">
19
29
  <%= form.label :email, class: "col-sm-4" %>
20
30
  <div class="col-sm-8">
21
- <%= form.text_field :email, placeholder: 'Email', class: "form-control" %>
31
+ <%= form.text_field :email, placeholder: 'Email', class: "form-control", name: :email %>
22
32
  </div>
23
33
  </div>
24
34
  <div>
@@ -27,7 +37,7 @@
27
37
  <% end %>
28
38
  </div>
29
39
  </div>
30
- <%= link_to "Back to Log In", sign_in_path, class: "forgot" %>
40
+ <%= link_to "Back to Log In", new_login_path, class: "forgot" %>
31
41
  </div>
32
42
  </div>
33
- </div>
43
+ </div>
@@ -1,7 +1,7 @@
1
1
  <!DOCTYPE html>
2
2
  <html>
3
3
  <head>
4
- <title>StormAuth</title>
4
+ <title><%= Rails.application.class.parent_name %></title>
5
5
  <%= stylesheet_link_tag "//fonts.googleapis.com/css?family=Open+Sans:300italic,300,400italic,400,600italic,600,700italic,700,800italic,800" %>
6
6
  <%= stylesheet_link_tag "//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" %>
7
7
  <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
@@ -20,8 +20,8 @@
20
20
  <% end %>
21
21
 
22
22
  <% if signed_in? %>
23
- <p>Logged in as: <%= current_user.given_name %></p>
24
- <%= link_to "Log out", sign_out_path, method: :delete %>
23
+ <p>Logged in as: <%= current_account.given_name %></p>
24
+ <%= link_to "Log out", logout_path, method: :post %>
25
25
  <% end %>
26
26
 
27
27
  <%= yield %>
@@ -0,0 +1,45 @@
1
+ <div class="email-password-area col-xs-12 <%= box_class %>">
2
+ <div class="header">
3
+ <span>Log in or <%= link_to "Create Account", new_register_path %></span>
4
+ </div>
5
+
6
+ <% if flash[:error] %>
7
+ <div class="alert alert-danger bad-login">
8
+ <p><%= flash[:error] %></p>
9
+ </div>
10
+ <% end %>
11
+
12
+ <% if params[:status].present? %>
13
+ <% case params[:status] %>
14
+ <% when 'unverified' %>
15
+ <div class="alert alert-success">
16
+ <p>Your account verification email has been sent! Before you can log into your account, you need to activate your account by clicking the link we sent to your inbox. Didn't get the email? <%= link_to "Click Here", Stormpath::Rails.config.web.verify_email.uri %></p>
17
+ </div>
18
+ <% when 'verified' %>
19
+ <div class="alert alert-success">
20
+ <p>Your Account Has Been Verified. You may now login.</p>
21
+ </div>
22
+ <% when 'created' %>
23
+ <div class="alert alert-success">
24
+ <p>Your Account Has Been Created. You may now login.</p>
25
+ </div>
26
+ <% when 'forgot' %>
27
+ <div class="alert alert-success">
28
+ <p>Password Reset Requested. If an account exists for the email provided, you will receive an email shortly.</p>
29
+ </div>
30
+ <% when 'reset' %>
31
+ <div class="alert alert-success">
32
+ <p>Password Reset Successfully. You can now login with your new password.</p>
33
+ </div>
34
+ <% end %>
35
+ <% end %>
36
+
37
+ <%= form_for '', url: login_path(next: params[:next]), html: {class: "login-form form-horizontal"} do |form| %>
38
+ <%= render 'stormpath/rails/shared/input', form: form, input_config: Stormpath::Rails.config.web.login.form.fields.login, input_name: :login, value: params[:login] %>
39
+ <%= render 'stormpath/rails/shared/input', form: form, input_config: Stormpath::Rails.config.web.login.form.fields.password, input_name: :password, value: nil %>
40
+
41
+ <div>
42
+ <%= button_tag "Log in", :class => "login btn btn-login btn-sp-green", :type => "submit" %>
43
+ </div>
44
+ <% end %>
45
+ </div>
@@ -0,0 +1,12 @@
1
+ <div class="container custom-container">
2
+ <div class="va-wrapper">
3
+ <div class="view login-view container">
4
+ <div class="box row">
5
+ <%= render partial: 'stormpath/rails/login/form' %>
6
+ </div>
7
+ <% if Stormpath::Rails.config.web.forgot_password.enabled %>
8
+ <%= link_to "Forgot Password?", new_forgot_password_path, class: "forgot" %>
9
+ <% end %>
10
+ </div>
11
+ </div>
12
+ </div>
@@ -0,0 +1,19 @@
1
+ <div class="col-sm-12">
2
+ <div class="header">
3
+ <span>Create Account</span>
4
+ </div>
5
+
6
+ <% if flash[:error] %>
7
+ <div class="alert alert-danger">
8
+ <p><%= flash[:error] %></p>
9
+ </div>
10
+ <% end %>
11
+
12
+ <%= form_for '', url: register_path, html: { class: "registration-form form-horizontal sp-form" } do |form| %>
13
+ <% Stormpath::Rails::RegistrationFormFields.enabled_field_names.each do |field| %>
14
+ <%= render 'stormpath/rails/shared/input', form: form, input_config: Stormpath::Rails.config.web.register.form.fields.send(field), input_name: field.to_s.camelize(:lower), value: params[field.to_s.camelize(:lower)] %>
15
+ <% end %>
16
+
17
+ <%= button_tag "Create Account", :class => "btn btn-register btn-sp-green", :type => "submit" %>
18
+ <% end %>
19
+ </div>
@@ -2,9 +2,9 @@
2
2
  <div class="va-wrapper">
3
3
  <div class="view registration-view container">
4
4
  <div class="box row">
5
- <%= render partial: '/users/form' %>
5
+ <%= render partial: 'stormpath/rails/register/form' %>
6
6
  </div>
7
- <%= link_to "Back to Log In", sign_in_path, class: "to-login" %>
7
+ <%= link_to "Back to Log In", new_login_path, class: "to-login" %>
8
8
  </div>
9
9
  </div>
10
- </div>
10
+ </div>
@@ -0,0 +1,15 @@
1
+ <% if input_config.enabled && input_config.visible %>
2
+ <div class="form-group group-email">
3
+ <%= form.label input_name, input_config.label, class: label_class %>
4
+ <div class="<%= input_class %>">
5
+ <%= form.text_field input_name,
6
+ value: (input_config.type == 'password' ? '' : value),
7
+ name: input_name,
8
+ placeholder: input_config.placeholder,
9
+ required: input_config.required,
10
+ type: input_config.type,
11
+ class: "form-control"
12
+ %>
13
+ </div>
14
+ </div>
15
+ <% end %>
@@ -0,0 +1,49 @@
1
+ <div class="container custom-container">
2
+ <div class="va-wrapper">
3
+ <div class="view login-view container">
4
+ <% if params[:sptoken] %>
5
+ <div class="row">
6
+ <div class="alert alert-warning">
7
+ <p>
8
+ This verification link is no longer valid. Please request a new link from the form below.
9
+ </p>
10
+ </div>
11
+ </div>
12
+ <% end %>
13
+ <div class="box row">
14
+ <div class="email-password-area col-xs-12 large col-sm-12">
15
+ <div class="header">
16
+ <span>Resend Account Verification Email?</span>
17
+ <% if params[:sptoken].nil? %>
18
+ <p>
19
+ Enter your email address below and we'll resend your account
20
+ verification email. You will be sent an email which you will
21
+ need to open to continue. You may need to check your spam
22
+ folder.
23
+ </p>
24
+ <% end %>
25
+ </div>
26
+
27
+ <% if flash[:error] %>
28
+ <div class="alert alert-danger bad-login">
29
+ <p><%= flash[:error] %></p>
30
+ </div>
31
+ <% end %>
32
+
33
+ <%= form_for :verify_email, html: { class: "login-form form-horizontal" }, url: verify_email_path do |form| %>
34
+ <div class="form-group group-email">
35
+ <%= form.label :email, class: "col-sm-4" %>
36
+ <div class="col-sm-8">
37
+ <%= form.text_field :email, placeholder: 'Email', class: "form-control", name: :email, type: :email, required: true %>
38
+ </div>
39
+ </div>
40
+ <div>
41
+ <%= button_tag "Submit", :class => "login btn btn-login btn-sp-green", :type => "submit" %>
42
+ </div>
43
+ <% end %>
44
+ </div>
45
+ </div>
46
+ <%= link_to "Back to Log In", new_login_path, class: "forgot" %>
47
+ </div>
48
+ </div>
49
+ </div>
data/bin/console CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- require "bundler/setup"
4
- require "stormpath/rails"
3
+ require 'bundler/setup'
4
+ require 'stormpath/rails'
5
5
 
6
6
  # You can add fixtures and/or initialization code here to make experimenting
7
7
  # with your gem easier. You can also use a different console, if you like.
@@ -10,5 +10,5 @@ require "stormpath/rails"
10
10
  # require "pry"
11
11
  # Pry.start
12
12
 
13
- require "irb"
13
+ require 'irb'
14
14
  IRB.start
data/bin/rails CHANGED
@@ -9,4 +9,4 @@ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
9
9
  require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
10
10
 
11
11
  require 'rails/all'
12
- require 'rails/engine/commands'
12
+ require 'rails/engine/commands'
data/bin/rake CHANGED
@@ -7,8 +7,8 @@
7
7
  #
8
8
 
9
9
  require 'pathname'
10
- ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
11
- Pathname.new(__FILE__).realpath)
10
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile',
11
+ Pathname.new(__FILE__).realpath)
12
12
 
13
13
  require 'rubygems'
14
14
  require 'bundler/setup'
data/bin/rspec CHANGED
@@ -7,8 +7,8 @@
7
7
  #
8
8
 
9
9
  require 'pathname'
10
- ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
11
- Pathname.new(__FILE__).realpath)
10
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile',
11
+ Pathname.new(__FILE__).realpath)
12
12
 
13
13
  require 'rubygems'
14
14
  require 'bundler/setup'
@@ -1 +1,3 @@
1
- Rails.application.config.assets.precompile += %w( stormpath.css )
1
+ if Rails.application.config.respond_to?(:assets)
2
+ Rails.application.config.assets.precompile += %w(stormpath.css)
3
+ end