tkh_authentication 0.9.7 → 0.9.8

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b51349fbe53b75922d615973d307d7b3542e1679
4
- data.tar.gz: b1bcacda9bcd66ff228419359f504cdba7f27a3f
3
+ metadata.gz: a6b683fdf77d249ed31b3965f83005273158e379
4
+ data.tar.gz: 463bfb0a23424d14a461ae67d59a45083b23dffa
5
5
  SHA512:
6
- metadata.gz: 90594fe0bd1279e009d2d81606ef32c678b2fab5e7dcc42572b6fd7580813ae8abc56b9f927b12fc296ef9d7b2af099e6ff58eb26ac7ccddd4b139cb40587ecd
7
- data.tar.gz: 5274fdd8aa41e303d3c5549862cda66b22cc639e4b4e278de7ac2cc8d8e0b984f1812ef516ca3ac97a01a5da7e81e51bb3d9562f6db0cfd669c0ec6323f3b03a
6
+ metadata.gz: a8d4951353ea888963d3cb6c0cdb4c3934dbe81deefd96b3f29a51cfdc7c1bf2a6bf1651264787b4a65a4581a8c38ba136fd688c7ba07caeceeffaed440b873b
7
+ data.tar.gz: 786ce1f96ea99508e4e5f0fd41ecc238cc7f65bdd1f72ad0476b715072ae76a45b02668b64602e5c8623d179c0dcfbf5c230b5437e4c5f58ae985c3da4f6f933
data/CHANGELOG.md CHANGED
@@ -2,6 +2,11 @@
2
2
 
3
3
 
4
4
 
5
+ ## 0.9.8
6
+
7
+ * Debugged the parse_email method. The remote true submitting of the form was interfering with many conditions.
8
+
9
+
5
10
  ## 0.9.7
6
11
 
7
12
  * Created a whole new authentication pathway. Please run 'bundle update tkh_authentication' -> 'rake tkh_authentication:update' -> 'rake db:migrate'
@@ -1,5 +1,7 @@
1
1
  class ReceptionController < ApplicationController
2
2
 
3
+ # FIXME - debugging mode now. The ajax call has messed conditions where I want HTML to be rendered.
4
+
3
5
  # TODO change email address - may be a profile feature in tkh_mailing_list
4
6
  # TODO change password - ""
5
7
  # TODO localize the whole process
@@ -10,36 +12,57 @@ class ReceptionController < ApplicationController
10
12
  end
11
13
 
12
14
  def parse_email
13
- @user = User.find_by(email: params[:user][:email])
14
- if @user.blank? # first take care of the easy case with a completely new user
15
- # create new record
16
- @user = User.new(user_params)
17
- if @user.save
18
- send_validation_email
19
- flash[:notice] = "Your record has been successfully created."
20
- # show screen to user with notice about email validation
21
- @status = 'email_validation_email_sent'
22
- else # problem saving new user record for some reason
23
- redirect_to email_input_path, alert: "We had problems creating your record. Please try again. Make sure the email address is valid."
24
- end
25
- else # the email address was already in the database
26
- # Returning user pathway goes here
27
- if @user.email_validated? && @user.has_a_password?
28
- respond_to do |format|
29
- format.html { redirect_to enter_your_password_path(auth_token: @user.auth_token) }
30
- format.js {}
15
+ unless params[:user][:email].blank?
16
+ @user = User.find_by(email: params[:user][:email])
17
+ if @user.blank? # first take care of the easy case with a completely new user
18
+ # create new record
19
+ @user = User.new(user_params)
20
+ if @user.save
21
+ send_validation_email
22
+ @status = 'email_validation'
23
+ respond_to do |format|
24
+ format.html { flash[:notice] = "Your record has been successfully created." }
25
+ format.js {}
26
+ end
27
+ else # problem saving new user record for some reason
28
+ @status = 'no_user_save'
29
+ respond_to do |format|
30
+ format.html { flash[:alert] = "We had problems creating your record. Please try again. Make sure the email address is valid." }
31
+ format.js {}
32
+ end
31
33
  end
32
- elsif @user.email_validated? && !@user.has_a_password? # doesn't have a password
33
- # User needs to securily create a password
34
- send_password_creation_security_email
35
- flash[:notice] = "There is 1 last step!"
36
- # show screen to user with notice about password confirmation email
37
- @status = 'password_confirmation_email_sent'
38
- elsif !@user.email_validated?
39
- send_validation_email
40
- flash[:notice] = "For your security, we need to verify your email address."
41
- # show screen to user with notice about email validation
42
- @status = 'email_validation_email_sent'
34
+ else # the email address was already in the database
35
+ # Returning user pathway goes here
36
+ if @user.email_validated? && @user.has_a_password?
37
+ @status = 'enter_password'
38
+ respond_to do |format|
39
+ format.html { redirect_to enter_your_password_path(auth_token: @user.auth_token) }
40
+ format.js {}
41
+ end
42
+ elsif @user.email_validated? && !@user.has_a_password? # doesn't have a password
43
+ # User needs to securily create a password
44
+ send_password_creation_security_email
45
+ # show screen to user with notice about password confirmation email
46
+ @status = 'password_confirmation'
47
+ respond_to do |format|
48
+ format.html { flash[:notice] = "There is 1 last step!" }
49
+ format.js {}
50
+ end
51
+ elsif !@user.email_validated?
52
+ send_validation_email
53
+ # show screen to user with notice about email validation
54
+ @status = 'email_validation'
55
+ respond_to do |format|
56
+ format.html { flash[:notice] = "For your security, we need to verify your email address." }
57
+ format.js {}
58
+ end
59
+ end
60
+ end
61
+ else # email is blank
62
+ @status = 'blank_email'
63
+ respond_to do |format|
64
+ format.html { flash[:alert] = "Your email address cannot be blank." }
65
+ format.js {}
43
66
  end
44
67
  end
45
68
  end
@@ -13,5 +13,14 @@
13
13
  <br />
14
14
  <%= f.input_field :remember_me, as: :boolean, boolean_style: :inline, checked: 'checked' %> &nbsp;remember me
15
15
  <br /><br />
16
+
17
+ <% unless @user.visible_name_present? %>
18
+ <p>Please take a few seconds to enter your name.</p>
19
+ <%= f.input :first_name %>
20
+ <%= f.input :last_name %>
21
+ <% # i want certain sites to use a different label for this. They can add a partial in host app. %>
22
+ <%= f.input :other_name, label: render('shared/other_name_label') %><br />
23
+ <% end %>
24
+
16
25
  <%= f.submit 'Create password and log in!', class: 'btn btn-primary' %>
17
26
  <% end %>
@@ -3,7 +3,7 @@
3
3
 
4
4
  <% unless current_user # most folks coming to this page should not be logged in %>
5
5
 
6
- <h1>Login</h1>
6
+ <h1 id="login-header">Login</h1>
7
7
 
8
8
  <%= simple_form_for User.new, url: parse_email_path, html: { id: 'email-input-form' }, remote: true, method: 'post' do |f| %>
9
9
  <%= f.error_notification %>
@@ -1,4 +1,36 @@
1
- // $('#email-input-form').slideUp(500);
2
- $('#email-input-form').replaceWith("<%= escape_javascript(render(:partial => 'reception/enter_your_password_form')) %>");
3
- $(".user_password").effect("highlight", { color: '#8D5530' }, 750);
4
- $('input#user_password').focus();
1
+ <% if @status == 'enter_password' %>
2
+
3
+ $('h1#login-header').html('Please Enter Your Password');
4
+ $('#email-input-form').replaceWith("<%= escape_javascript(render(:partial => 'reception/enter_your_password_form')) %>");
5
+ $('h1').effect("highlight", { color: '#8D5530' }, 1000);
6
+ $(".user_password").effect("highlight", { color: '#8D5530' }, 1000);
7
+ $('input#user_password').focus();
8
+ $('.alert-danger').slideUp(750);
9
+
10
+ <% elsif @status == 'email_validation' %>
11
+
12
+ $('h1#login-header').html('A Validation Email is Coming');
13
+ $('#email-input-form').replaceWith("<p class=\"validation-message\">We have sent you an email. Please check your inbox or your spam folder.</p>");
14
+ $('h1').effect("highlight", { color: '#8D5530' }, 1000);
15
+ $("p.validation-message").effect("highlight", { color: '#8D5530' }, 1000);
16
+ $('.alert-danger').slideUp(750);
17
+
18
+ <% elsif @status == 'password_confirmation' %>
19
+
20
+ $('h1#login-header').html('A Password Creation Security Email is Coming');
21
+ $('#email-input-form').replaceWith("<p class=\"confirmation-message\">For your security we need to check that you truly are the owner of this account. Please check your inbox or spam folder.</p>");
22
+ $('h1').effect("highlight", { color: '#8D5530' }, 1000);
23
+ $("p.confirmation-message").effect("highlight", { color: '#8D5530' }, 1000);
24
+ $('.alert-danger').slideUp(750);
25
+
26
+ <% elsif @status == 'blank_email' %>
27
+
28
+ $('h1#login-header').after('<div class="alert alert-danger"><a class="close" data-dismiss="alert">×</a>The email address CANNOT be blank.</div>');
29
+ $('.alert-danger').hide().slideDown(750);
30
+
31
+ <% elsif @status == 'no_user_save' %>
32
+
33
+ $('h1#login-header').after('<div class="alert alert-danger"><a class="close" data-dismiss="alert">×</a>We had problems creating your record. Please try again. Make sure the email address is valid.</div>');
34
+ $('.alert-danger').hide().slideDown(750);
35
+
36
+ <% end %>
@@ -1,3 +1,3 @@
1
1
  module TkhAuthentication
2
- VERSION = "0.9.7"
2
+ VERSION = "0.9.8"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tkh_authentication
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.7
4
+ version: 0.9.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Swami Atma