tkh_authentication 0.1.7 → 0.1.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/CHANGELOG.md +6 -1
- data/app/models/user.rb +11 -11
- data/app/views/users/index.html.erb +8 -4
- data/lib/generators/tkh_authentication/create_or_update_migrations/create_or_update_migrations_generator.rb +5 -4
- data/lib/generators/tkh_authentication/create_or_update_migrations/templates/add_other_name_to_users.rb +5 -0
- data/lib/tkh_authentication/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
NGY1YmQ4NDAzZDJiMWMyNDI3NjE2MTVjMzBhYTQ3ODEwODZmYTVhOQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
MTdiNzk1YTJhNjk2NmYwNzhmNDNlM2IwYWViNGNkZjcyNTNhODljNw==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
MzYwMzgwMTI3YWM3ZWRhODRlOGZkMWY1N2RmOWM0NjFhZWEyMDE5ZDY3YTY3
|
10
|
+
OTM3ZGVmMGZjZWZkZjlhM2I5Yjc1YzRiM2ZiMzdjZDIyYzVhYjYwM2MzYTAw
|
11
|
+
OTc0MTQ0OTEzYzM0MGRkODY0MmUwNGU1OGQ1NDkyNTVlOTRiMTE=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
ZTdkMjIzNjVkMmI5ZWExMTQxYmViZTQwOTkxOGRjNGMwMzNmYjRhYWUzODdi
|
14
|
+
NjYzMzBmN2ZkZTZlYjdkZTE4YjBiMjExODI5YzQ2OTcxMDMwMWExNTM3MDYx
|
15
|
+
M2RjZmM0MDM1ZjI3MjIzZDRkOWEzOGUyODM3ZjI4ZDk5ZjA3MTI=
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,11 @@
|
|
1
1
|
# TKH Authentication
|
2
2
|
|
3
3
|
|
4
|
+
## 0.1.8
|
5
|
+
|
6
|
+
* Added other name attribute to user model
|
7
|
+
* Integrated views and functionality with the new tkh-mailing-list gem. tkh-authentication handles the user model and creation of records by user and tkh-mailing-list will handle all additions/modifications/deletions by the admin.
|
8
|
+
|
4
9
|
|
5
10
|
## 0.1.7
|
6
11
|
|
@@ -47,7 +52,7 @@
|
|
47
52
|
|
48
53
|
* Styled login form the simple_form way
|
49
54
|
* Changed some text and translations in login form
|
50
|
-
* Worked on text and translation in signup form
|
55
|
+
* Worked on text and translation in signup form
|
51
56
|
* The shared/menus partial is called from all authentication pages
|
52
57
|
|
53
58
|
|
data/app/models/user.rb
CHANGED
@@ -1,36 +1,36 @@
|
|
1
1
|
class User < ActiveRecord::Base
|
2
|
-
|
2
|
+
|
3
3
|
has_secure_password
|
4
|
-
|
4
|
+
|
5
5
|
# associations connected to tkh_content gem. Any page or comment model will do
|
6
6
|
has_many :pages
|
7
7
|
has_many :comments, :dependent => :destroy
|
8
|
-
|
8
|
+
|
9
9
|
# not allowed are :admin:boolean, :auth_token:string, password_reset_token:string, password_reset_sent_at:datetime
|
10
|
-
attr_accessible :email, :password, :password_confirmation, :first_name, :last_name
|
11
|
-
|
10
|
+
attr_accessible :email, :password, :password_confirmation, :first_name, :last_name, :other_name
|
11
|
+
|
12
12
|
validates_presence_of :email
|
13
13
|
validates_uniqueness_of :email, :case_sensitive => false
|
14
14
|
validates_presence_of :password, on: :create
|
15
15
|
validates_presence_of :first_name
|
16
16
|
validates_presence_of :last_name
|
17
|
-
|
17
|
+
|
18
18
|
scope :alphabetically, order('last_name, first_name')
|
19
19
|
scope :administrators, where('admin = ?', true)
|
20
|
-
|
20
|
+
|
21
21
|
before_create { generate_token(:auth_token) }
|
22
|
-
|
22
|
+
|
23
23
|
# use the stringex gem to create slug | usually on the title or name attribute
|
24
24
|
def to_param
|
25
25
|
"#{id}-#{name.to_url}"
|
26
26
|
end
|
27
27
|
|
28
28
|
scope :by_recent, :order => 'updated_at desc'
|
29
|
-
|
29
|
+
|
30
30
|
def name
|
31
31
|
"#{first_name} #{last_name}".strip
|
32
32
|
end
|
33
|
-
|
33
|
+
|
34
34
|
def formal_name
|
35
35
|
"#{last_name}, #{first_name}".strip
|
36
36
|
end
|
@@ -47,5 +47,5 @@ class User < ActiveRecord::Base
|
|
47
47
|
self[column] = SecureRandom.urlsafe_base64
|
48
48
|
end while User.exists?(column => self[column])
|
49
49
|
end
|
50
|
-
|
50
|
+
|
51
51
|
end
|
@@ -1,18 +1,21 @@
|
|
1
1
|
<h1><%= t('activerecord.models.users') %></h1>
|
2
2
|
|
3
|
+
<%= render 'details/tab_admin_menu' %>
|
4
|
+
|
3
5
|
<table class='table table-striped'>
|
4
6
|
<thead>
|
5
|
-
<tr>
|
7
|
+
<tr>
|
6
8
|
<th><%= t 'authentication.name' %></th>
|
7
9
|
<th><%= t 'activerecord.attributes.user.email' %></th>
|
8
10
|
<th><%= t('question_mark_inverted') %><%= t('activerecord.attributes.user.admin') %><%= t('question_mark') %></th>
|
11
|
+
<th><%= t('actions') %></th>
|
9
12
|
</tr>
|
10
13
|
</thead>
|
11
|
-
|
14
|
+
|
12
15
|
<tbody>
|
13
16
|
<% @users.each do |user| %>
|
14
17
|
<tr>
|
15
|
-
<td><%= user.name %></td>
|
18
|
+
<td><%= link_to user.name, detail_path(user) %></td>
|
16
19
|
<td><%= user.email %></td>
|
17
20
|
<td>
|
18
21
|
<% unless user.admin? %>
|
@@ -21,9 +24,10 @@
|
|
21
24
|
<span class="label label-success">✓</span> <%= link_to t('authentication.disable_admin'), remove_admin_user_path(user), class: 'btn btn-mini', method: :post %>
|
22
25
|
<% end -%>
|
23
26
|
</td>
|
27
|
+
<td><%= link_to t('edit'), edit_detail_path(user), class: 'btn btn-mini' %></td>
|
24
28
|
</tr>
|
25
29
|
<% end %>
|
26
30
|
</tbody>
|
27
31
|
</table>
|
28
32
|
|
29
|
-
<%= render 'shared/admin_sidebar' %>
|
33
|
+
<%= render 'shared/admin_sidebar' %>
|
@@ -1,5 +1,5 @@
|
|
1
1
|
require 'rails/generators/migration'
|
2
|
-
|
2
|
+
|
3
3
|
module TkhAuthentication
|
4
4
|
module Generators
|
5
5
|
class CreateOrUpdateMigrationsGenerator < ::Rails::Generators::Base
|
@@ -14,12 +14,13 @@ module TkhAuthentication
|
|
14
14
|
end
|
15
15
|
@prev_migration_nr.to_s
|
16
16
|
end
|
17
|
-
|
17
|
+
|
18
18
|
def copy_migrations
|
19
19
|
puts 'creating user migration'
|
20
20
|
migration_template "create_users.rb", "db/migrate/create_users.rb"
|
21
|
+
migration_template "add_other_name_to_users.rb", "db/migrate/add_other_name_to_users.rb"
|
21
22
|
end
|
22
|
-
|
23
|
+
|
23
24
|
end
|
24
25
|
end
|
25
|
-
end
|
26
|
+
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.1.
|
4
|
+
version: 0.1.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Swami Atma
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-08-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -113,6 +113,7 @@ files:
|
|
113
113
|
- lib/generators/tkh_authentication/create_or_update_locales/templates/fr.yml
|
114
114
|
- lib/generators/tkh_authentication/create_or_update_locales/templates/it.yml
|
115
115
|
- lib/generators/tkh_authentication/create_or_update_migrations/create_or_update_migrations_generator.rb
|
116
|
+
- lib/generators/tkh_authentication/create_or_update_migrations/templates/add_other_name_to_users.rb
|
116
117
|
- lib/generators/tkh_authentication/create_or_update_migrations/templates/create_users.rb
|
117
118
|
- lib/tasks/tkh_authentication_tasks.rake
|
118
119
|
- lib/tkh_authentication/tkh_authentication_action_controller_extension.rb
|