lockie 0.3.3 → 0.4.5

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
  SHA256:
3
- metadata.gz: 4d9b6208ff552c48fcd48bf7dac345af06b688c598d8007248aa0b1801959b99
4
- data.tar.gz: b597f952ff77c9881ef7e4ab6f8a79f424c3265c3d84e673e0a1743725d5b733
3
+ metadata.gz: 86eac2be7c9981eb52904045b83103de633140c29fe6c1f8a58a05509ae10d2f
4
+ data.tar.gz: fa61c62cfc66f650bb288f8d29fa6b45a9d515635da2051fd50943ff2ac4cb8c
5
5
  SHA512:
6
- metadata.gz: 7878cb4bfe31f051b5f063c4467b52bde16494f8dde23661012414b5562b3dd65dfc20d005210582a0854fff51240b64faee18669b5355e67b4e27ebc4e40818
7
- data.tar.gz: f7967811725b81454729fdb33711e69441e843efe65affb96dca44d266add3c7897f52c746898f163affa1061580d3aeb183d1c2b6409a4983f8ab82c30aabe8
6
+ metadata.gz: 567d4b868e544121f9f62274634e6b50319774d4b8f8c479c04112016e669d3a930e4d74ea5d68bf5b8097a7ff9fc71201e1026a259c5eee40fba993b79a17e6
7
+ data.tar.gz: 24c141be113f8cc783c9a03ad9fb01e2cc139393215580e6703194cdb70cdbb537a5fe2e9420959c9200807eb7f99925a369a3338b842e5e891fbbd145a9e215
data/README.md CHANGED
@@ -41,8 +41,12 @@ Session controller
41
41
  class SessionController < ApplicationController
42
42
  skip_before_action :authenticate!, only: [:new]
43
43
 
44
+ def new
45
+ session[:callback_url] = params[:callback_url] if params[:callback_url]
46
+ end
47
+
44
48
  def create
45
- redirect_to root_url # redirect to your homepage if username and password is valid
49
+ redirect_to session[:callback_url] || root_url
46
50
  end
47
51
 
48
52
  def destroy
@@ -34,9 +34,12 @@ module Lockie
34
34
  flash[type] = message if message
35
35
  self.status = 302
36
36
  if Lockie.config.callback_url
37
- callback_url = request.base_url + request.original_fullpath
38
37
  uri = URI(warden_options[:unauthenticated_path] || Lockie.config.unauthenticated_path)
39
- uri.query = (uri.query.to_s.split("&") << "callback_url=#{ callback_url }").join("&")
38
+ # only add callback_url if original path is not the same with login path
39
+ unless request.original_fullpath == uri.path
40
+ callback_url = request.base_url + request.original_fullpath
41
+ uri.query = (uri.query.to_s.split("&") << "callback_url=#{ callback_url }").join("&")
42
+ end
40
43
  redirect_to uri.to_s
41
44
  else
42
45
  redirect_to Lockie.config.unauthenticated_path
@@ -44,7 +47,7 @@ module Lockie
44
47
  end
45
48
 
46
49
  def message
47
- @message ||= request.env['warden.message'] || "Unauthorized"
50
+ @message ||= request.env['warden.message']
48
51
  end
49
52
 
50
53
  def warden_options
@@ -1,3 +1,3 @@
1
1
  module Lockie
2
- VERSION = '0.3.3'
2
+ VERSION = '0.4.5'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lockie
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.3
4
+ version: 0.4.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Melvin Sembrano
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-08-06 00:00:00.000000000 Z
11
+ date: 2022-05-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -119,7 +119,7 @@ homepage: https://github.com/melvinsembrano/lockie
119
119
  licenses:
120
120
  - MIT
121
121
  metadata:
122
- allowed_push_host: 'TODO: Set to ''http://mygemserver.com'''
122
+ allowed_push_host: https://rubygems.org
123
123
  post_install_message:
124
124
  rdoc_options: []
125
125
  require_paths:
@@ -135,7 +135,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
135
135
  - !ruby/object:Gem::Version
136
136
  version: '0'
137
137
  requirements: []
138
- rubygems_version: 3.0.8
138
+ rubygems_version: 3.0.3.1
139
139
  signing_key:
140
140
  specification_version: 4
141
141
  summary: Drop in password and JWT token authentication for Ruby on Rails