tkh_authentication 0.9.7 → 0.9.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/app/controllers/reception_controller.rb +52 -29
- data/app/views/reception/create_your_password.html.erb +9 -0
- data/app/views/reception/email_input.html.erb +1 -1
- data/app/views/reception/parse_email.js.erb +36 -4
- data/lib/tkh_authentication/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a6b683fdf77d249ed31b3965f83005273158e379
|
4
|
+
data.tar.gz: 463bfb0a23424d14a461ae67d59a45083b23dffa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
14
|
-
|
15
|
-
#
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
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
|
-
|
33
|
-
#
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
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' %> 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
|
-
|
2
|
-
|
3
|
-
$(
|
4
|
-
$('input
|
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 %>
|