tkh_authentication 0.9.8 → 0.9.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a6b683fdf77d249ed31b3965f83005273158e379
4
- data.tar.gz: 463bfb0a23424d14a461ae67d59a45083b23dffa
3
+ metadata.gz: ad67afa91517c97feb537facbd5a88becab69c46
4
+ data.tar.gz: 50a213457bc223e4f6d28038783d852e2435d0ee
5
5
  SHA512:
6
- metadata.gz: a8d4951353ea888963d3cb6c0cdb4c3934dbe81deefd96b3f29a51cfdc7c1bf2a6bf1651264787b4a65a4581a8c38ba136fd688c7ba07caeceeffaed440b873b
7
- data.tar.gz: 786ce1f96ea99508e4e5f0fd41ecc238cc7f65bdd1f72ad0476b715072ae76a45b02668b64602e5c8623d179c0dcfbf5c230b5437e4c5f58ae985c3da4f6f933
6
+ metadata.gz: f649d7e592ae9b578b21f01bfa6b1797d36e4e2c925ecb4a6e9ba52c6850377c8a3d388a4c8d65416993c3a86c0f7f2f85a31955f63448bb52eb2043d767029a
7
+ data.tar.gz: 11b7120fe872280c23731260b9c97431154c4da8f1038628d89e070a2815c31d4078d467875bef48e99808fd7ca9015270d3416d4d44c5702dccaf0cfb926c09
@@ -2,6 +2,12 @@
2
2
 
3
3
 
4
4
 
5
+ ## 0.9.9
6
+
7
+ * Upon succesful login, if target page is a reception page, redirect user to home page instead.
8
+ * Extracted the email_input form to a partial which can be called from any page on top of being used in the login page.
9
+
10
+
5
11
  ## 0.9.8
6
12
 
7
13
  * Debugged the parse_email method. The remote true submitting of the form was interfering with many conditions.
@@ -1,7 +1,5 @@
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
-
5
3
  # TODO change email address - may be a profile feature in tkh_mailing_list
6
4
  # TODO change password - ""
7
5
  # TODO localize the whole process
@@ -128,7 +126,8 @@ class ReceptionController < ApplicationController
128
126
  if @user.email_validated?
129
127
  if @user.authenticate(params[:user][:password])
130
128
  login_the_user
131
- redirect_to (session[:target_page] || root_url), notice: t('authentication.login_confirmation')
129
+ flash[:notice] = t('authentication.login_confirmation')
130
+ redirect_user_upon_successful_login
132
131
  destroy_target_page
133
132
  else # most likely wrong password
134
133
  flash.now.alert = t('authentication.warning.email_or_password_invalid')
@@ -251,4 +250,17 @@ class ReceptionController < ApplicationController
251
250
  end
252
251
  end
253
252
 
253
+ def redirect_user_upon_successful_login
254
+ if session[:target_page].present?
255
+ # add case when target pages is login page.
256
+ unless Rails.application.routes.recognize_path(session[:target_page])[:controller] == 'reception'
257
+ redirect_to session[:target_page]
258
+ else # the target page is the login or reception page
259
+ redirect_to root_url
260
+ end
261
+ else # no target page is set
262
+ redirect_to root_url
263
+ end
264
+ end
265
+
254
266
  end
@@ -0,0 +1,9 @@
1
+ <% submit_message = 'proceed' if submit_message.blank? %>
2
+
3
+ <%= simple_form_for User.new, url: parse_email_path, html: { id: 'email-input-form' }, remote: true, method: 'post' do |f| %>
4
+ <%= f.error_notification %>
5
+
6
+ <%= f.input :email, autofocus: true, label: 'Please enter your email address' %>
7
+ <br />
8
+ <%= f.button :submit, submit_message, :class => 'btn btn-primary' %>
9
+ <% end %>
@@ -5,13 +5,7 @@
5
5
 
6
6
  <h1 id="login-header">Login</h1>
7
7
 
8
- <%= simple_form_for User.new, url: parse_email_path, html: { id: 'email-input-form' }, remote: true, method: 'post' do |f| %>
9
- <%= f.error_notification %>
10
-
11
- <%= f.input :email, autofocus: true, label: 'Please enter your email address' %>
12
- <br />
13
- <%= f.button :submit, 'proceed', :class => 'btn btn-primary' %>
14
- <% end %>
8
+ <%= render 'email_input_form' %>
15
9
 
16
10
  <% else # the user is already logged in %>
17
11
 
@@ -11,7 +11,7 @@ Rails.application.routes.draw do
11
11
  end
12
12
 
13
13
  ##### ACCESS CONTROL
14
- # legacy routes. Pointing to new pathway.
14
+ # legacy routes. Pointing to new pathway. Keep them. They are semantically sound.
15
15
  get 'signup', to: 'reception#email_input', as: 'signup'
16
16
  get 'login', to: 'reception#email_input', as: 'login'
17
17
  get 'logout', to: 'reception#disconnect', as: 'logout'
@@ -1,3 +1,3 @@
1
1
  module TkhAuthentication
2
- VERSION = "0.9.8"
2
+ VERSION = "0.9.9"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tkh_authentication
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.8
4
+ version: 0.9.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Swami Atma
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-08-12 00:00:00.000000000 Z
11
+ date: 2014-08-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -96,6 +96,7 @@ files:
96
96
  - app/controllers/users_controller.rb
97
97
  - app/mailers/reception_mailer.rb
98
98
  - app/models/user.rb
99
+ - app/views/reception/_email_input_form.html.erb
99
100
  - app/views/reception/_enter_your_password_form.html.erb
100
101
  - app/views/reception/_enter_your_password_form.js.erb
101
102
  - app/views/reception/change_your_password.html.erb
@@ -170,7 +171,8 @@ files:
170
171
  - test/test_helper.rb
171
172
  - test/tkh_authentication_test.rb
172
173
  homepage: https://github.com/allesklar/tkh_authentication
173
- licenses: []
174
+ licenses:
175
+ - MIT
174
176
  metadata: {}
175
177
  post_install_message:
176
178
  rdoc_options: []