refinerycms-authentication 0.9.9.20 → 0.9.9.21
Sign up to get free protection for your applications and to get access to all the features.
- data/app/controllers/{registrations_controller.rb → users_controller.rb} +1 -1
- data/app/models/user.rb +7 -2
- data/app/views/{registrations → users}/new.html.erb +0 -0
- data/config/locales/fi.yml +72 -0
- data/config/routes.rb +9 -11
- data/lib/gemspec.rb +1 -1
- data/lib/refinerycms-authentication.rb +11 -11
- data/refinerycms-authentication.gemspec +8 -7
- data/spec/models/user_spec.rb +4 -5
- metadata +7 -6
data/app/models/user.rb
CHANGED
@@ -18,6 +18,11 @@ class User < ActiveRecord::Base
|
|
18
18
|
validates :username, :presence => true, :uniqueness => true
|
19
19
|
|
20
20
|
class << self
|
21
|
+
# Configure authentication_keys here instead of devise.rb initialzer so we don't overwrite standard devise models
|
22
|
+
def authentication_keys
|
23
|
+
[:login]
|
24
|
+
end
|
25
|
+
|
21
26
|
# Find user by email or username.
|
22
27
|
# https://github.com/plataformatec/devise/wiki/How-To:-Allow-users-to-sign_in-using-their-username-or-email-address
|
23
28
|
def find_for_database_authentication(conditions)
|
@@ -42,9 +47,9 @@ class User < ActiveRecord::Base
|
|
42
47
|
|
43
48
|
def can_delete?(user_to_delete = self)
|
44
49
|
user_to_delete.persisted? and
|
50
|
+
id != user_to_delete.id and
|
45
51
|
!user_to_delete.has_role?(:superuser) and
|
46
|
-
Role[:refinery].users.count > 1
|
47
|
-
id != user_to_delete.id
|
52
|
+
Role[:refinery].users.count > 1
|
48
53
|
end
|
49
54
|
|
50
55
|
def add_role(title)
|
File without changes
|
@@ -0,0 +1,72 @@
|
|
1
|
+
fi:
|
2
|
+
plugins:
|
3
|
+
refinery_users:
|
4
|
+
title: Käyttäjät
|
5
|
+
description: Hallitse käyttäjiä
|
6
|
+
admin:
|
7
|
+
users:
|
8
|
+
delete: Poista tämä käyttäjä ikuisesti
|
9
|
+
edit: Muokkaa tätä käyttäjää
|
10
|
+
update:
|
11
|
+
cannot_remove_user_plugin_from_current_user: "Et voi poistaa 'Käyttäjät-' palikkaa tunnukselta, jolla olet kirjautunut sisään."
|
12
|
+
form:
|
13
|
+
blank_password_keeps_current: "Jätä tyhjäksi, jos et halua vaihtaa salasanaa"
|
14
|
+
plugin_access: Palikkaluvat
|
15
|
+
role_access: Rooliluvat
|
16
|
+
enable_all: "salli kaikki"
|
17
|
+
actions:
|
18
|
+
create_new_user: Lisää uusi käyttäjä
|
19
|
+
user:
|
20
|
+
email_user: Lähetä sähköpostia tälle käyttäjälle
|
21
|
+
preview: '(%{who}) lisätty %{created_at}'
|
22
|
+
sessions:
|
23
|
+
new:
|
24
|
+
hello_please_sign_in: "Hei! Ole hyvä, ja kirjaudu."
|
25
|
+
sign_in: Kirjaudu
|
26
|
+
forgot_password: Unohdin salasanani
|
27
|
+
users:
|
28
|
+
setup_website_name_html: "Annetaan nettisivustolle ensimmäiseksi nimi. <a href='%{link}' name='%{title}'>Mene tänne</a> muokataksesi nettisivusi nimeä"
|
29
|
+
new:
|
30
|
+
fill_form: "Täytä alhaalla olevat tiedot, että voimme aloittaa."
|
31
|
+
sign_up: Rekisteröidy
|
32
|
+
create:
|
33
|
+
welcome: 'Tervetuloa Refineryyn, %{who}'
|
34
|
+
forgot:
|
35
|
+
email_address: Sähköpostiosoite
|
36
|
+
enter_email_address: Kirjoita tunnuksesi sähköpostiosoite.
|
37
|
+
reset_password: Nollaa salasanasi
|
38
|
+
blank_email: Et kirjoittanut sähköpostiosoitetta.
|
39
|
+
email_not_associated_with_account_html: "Valitettavasti osoitetta '%{email}' ei löydy tietokannasta.<br />Oletko varma, että kirjoitit oikean osoitteen?"
|
40
|
+
email_reset_sent: "Sinulle on lähetetty sähköposti, joka sisältää linkin salasanan vaihtoon"
|
41
|
+
password_encryption: "Sinun täytyy vaihtaa salasanasi, koska Refineryn käyttämää salausmenetelmää on muokattu turvallisuussyistä."
|
42
|
+
reset:
|
43
|
+
code_invalid: "Olemme pahoillamme, mutta tämä vaihtokoodi on joko vanhentunut tai viallinen. Yritä kopioida ja liittää osoite sähköpostistasi selaimeen, tai käynnistää salasanan vaihto uudelleen."
|
44
|
+
successful: "Salasana nollattu onnistuneesti osoitteelle '%{email}'"
|
45
|
+
pick_new_password_for: "Kirjoita uusi salasana osoitteelle %{email}"
|
46
|
+
reset_password: Nollaa salasana
|
47
|
+
user_mailer:
|
48
|
+
reset_notification:
|
49
|
+
subject: Linkki salasanan nollaukseen
|
50
|
+
reset_request_received_for: "Pyyntö nollata käyttäjän %{username} salasana"
|
51
|
+
visit_this_url: Käy tässä osoitteessa valitaksesi uuden salasanan
|
52
|
+
remain_same_if_no_action: "Jos et tee mitään, salasanaasi ei vaihdeta"
|
53
|
+
devise:
|
54
|
+
failure:
|
55
|
+
unauthenticated: Sinun täytyy kirjautua sisään.
|
56
|
+
invalid: "Valitettavasti käyttäjätunnuksesi tai salasanasi oli väärin."
|
57
|
+
sessions:
|
58
|
+
signed_in: Kirjautuminen onnistui.
|
59
|
+
roles:
|
60
|
+
superuser: Superuser
|
61
|
+
refinery: Refinery
|
62
|
+
activerecord:
|
63
|
+
models:
|
64
|
+
user: user
|
65
|
+
attributes:
|
66
|
+
user:
|
67
|
+
login: Kirjautuminen
|
68
|
+
username: Käyttäjätunnus
|
69
|
+
password: Salasana
|
70
|
+
password_confirmation: Salasana (uudelleen)
|
71
|
+
email: Sähköpostiosoite
|
72
|
+
remember_me: Muista minut
|
data/config/routes.rb
CHANGED
@@ -2,17 +2,15 @@
|
|
2
2
|
|
3
3
|
# Add Devise necessary routes.
|
4
4
|
# For Devise routes, see: https://github.com/plataformatec/devise
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
}
|
15
|
-
#end
|
5
|
+
devise_for :users, :controllers => {
|
6
|
+
:sessions => 'sessions',
|
7
|
+
:registrations => 'users',
|
8
|
+
:passwords => 'passwords'
|
9
|
+
}, :path_names => {
|
10
|
+
:sign_out => 'logout',
|
11
|
+
:sign_in => 'login',
|
12
|
+
:sign_up => 'register'
|
13
|
+
}
|
16
14
|
|
17
15
|
# Override Devise's default after login redirection route. This will pushed a logged in user to the dashboard.
|
18
16
|
get 'refinery', :to => 'admin/dashboard#index', :as => :refinery_root
|
data/lib/gemspec.rb
CHANGED
@@ -20,7 +20,7 @@ Gem::Specification.new do |s|
|
|
20
20
|
s.executables = %w(#{Pathname.glob(gempath.join('bin/*')).map{|d| d.relative_path_from(gempath)}.sort.join(" ")})
|
21
21
|
|
22
22
|
s.add_dependency 'refinerycms-core', '= #{::Refinery::Version}'
|
23
|
-
s.add_dependency 'devise', '~> 1.
|
23
|
+
s.add_dependency 'devise', '~> 1.3.0'
|
24
24
|
s.add_dependency 'friendly_id_globalize3', '~> 3.2.1'
|
25
25
|
|
26
26
|
s.files = [
|
@@ -1,20 +1,13 @@
|
|
1
1
|
require 'devise'
|
2
2
|
require 'refinerycms-core'
|
3
3
|
require 'friendly_id'
|
4
|
-
# Attach authenticated system methods to the ::Refinery::ApplicationController
|
5
|
-
require File.expand_path('../authenticated_system', __FILE__)
|
6
|
-
[::Refinery::ApplicationController, ::Refinery::ApplicationHelper].each do |c|
|
7
|
-
c.class_eval {
|
8
|
-
include AuthenticatedSystem
|
9
|
-
}
|
10
|
-
end
|
11
4
|
|
12
5
|
module Refinery
|
13
6
|
module Authentication
|
14
7
|
|
15
8
|
class Engine < ::Rails::Engine
|
16
9
|
|
17
|
-
initializer
|
10
|
+
initializer 'serve static assets' do |app|
|
18
11
|
app.middleware.insert_after ::ActionDispatch::Static, ::ActionDispatch::Static, "#{root}/public"
|
19
12
|
end
|
20
13
|
|
@@ -22,14 +15,21 @@ module Refinery
|
|
22
15
|
|
23
16
|
config.after_initialize do
|
24
17
|
::Refinery::Plugin.register do |plugin|
|
25
|
-
plugin.name =
|
26
|
-
plugin.version = %q{0.9.9.
|
18
|
+
plugin.name = 'refinery_users'
|
19
|
+
plugin.version = %q{0.9.9.21}
|
27
20
|
plugin.menu_match = /(refinery|admin)\/users$/
|
28
21
|
plugin.activity = {
|
29
22
|
:class => User,
|
30
23
|
:title => 'username'
|
31
24
|
}
|
32
|
-
plugin.url = {:controller =>
|
25
|
+
plugin.url = {:controller => '/admin/users'}
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
refinery.before_inclusion do
|
30
|
+
[::Refinery::ApplicationController, ::Refinery::ApplicationHelper].each do |c|
|
31
|
+
c.send :require, File.expand_path('../authenticated_system', __FILE__)
|
32
|
+
c.send :include, AuthenticatedSystem
|
33
33
|
end
|
34
34
|
end
|
35
35
|
end
|
@@ -2,10 +2,10 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{refinerycms-authentication}
|
5
|
-
s.version = %q{0.9.9.
|
5
|
+
s.version = %q{0.9.9.21}
|
6
6
|
s.summary = %q{Authentication engine for Refinery CMS}
|
7
7
|
s.description = %q{The default authentication engine for Refinery CMS}
|
8
|
-
s.date = %q{2011-
|
8
|
+
s.date = %q{2011-05-03}
|
9
9
|
s.email = %q{info@refinerycms.com}
|
10
10
|
s.homepage = %q{http://refinerycms.com}
|
11
11
|
s.rubyforge_project = %q{refinerycms}
|
@@ -14,8 +14,8 @@ Gem::Specification.new do |s|
|
|
14
14
|
s.require_paths = %w(lib)
|
15
15
|
s.executables = %w()
|
16
16
|
|
17
|
-
s.add_dependency 'refinerycms-core', '= 0.9.9.
|
18
|
-
s.add_dependency 'devise', '~> 1.
|
17
|
+
s.add_dependency 'refinerycms-core', '= 0.9.9.21'
|
18
|
+
s.add_dependency 'devise', '~> 1.3.0'
|
19
19
|
s.add_dependency 'friendly_id_globalize3', '~> 3.2.1'
|
20
20
|
|
21
21
|
s.files = [
|
@@ -24,8 +24,8 @@ Gem::Specification.new do |s|
|
|
24
24
|
'app/controllers/admin',
|
25
25
|
'app/controllers/admin/users_controller.rb',
|
26
26
|
'app/controllers/passwords_controller.rb',
|
27
|
-
'app/controllers/registrations_controller.rb',
|
28
27
|
'app/controllers/sessions_controller.rb',
|
28
|
+
'app/controllers/users_controller.rb',
|
29
29
|
'app/helpers',
|
30
30
|
'app/helpers/sessions_helper.rb',
|
31
31
|
'app/helpers/users_helper.rb',
|
@@ -52,13 +52,13 @@ Gem::Specification.new do |s|
|
|
52
52
|
'app/views/passwords',
|
53
53
|
'app/views/passwords/edit.html.erb',
|
54
54
|
'app/views/passwords/new.html.erb',
|
55
|
-
'app/views/registrations',
|
56
|
-
'app/views/registrations/new.html.erb',
|
57
55
|
'app/views/sessions',
|
58
56
|
'app/views/sessions/new.html.erb',
|
59
57
|
'app/views/user_mailer',
|
60
58
|
'app/views/user_mailer/reset_notification.html.erb',
|
61
59
|
'app/views/user_mailer/reset_notification.text.plain.erb',
|
60
|
+
'app/views/users',
|
61
|
+
'app/views/users/new.html.erb',
|
62
62
|
'config',
|
63
63
|
'config/locales',
|
64
64
|
'config/locales/cs.yml',
|
@@ -67,6 +67,7 @@ Gem::Specification.new do |s|
|
|
67
67
|
'config/locales/el.yml',
|
68
68
|
'config/locales/en.yml',
|
69
69
|
'config/locales/es.yml',
|
70
|
+
'config/locales/fi.yml',
|
70
71
|
'config/locales/fr.yml',
|
71
72
|
'config/locales/it.yml',
|
72
73
|
'config/locales/jp.yml',
|
data/spec/models/user_spec.rb
CHANGED
@@ -10,18 +10,18 @@ describe User do
|
|
10
10
|
context "Roles" do
|
11
11
|
context "add_role" do
|
12
12
|
it "raises Exception when Role object is passed" do
|
13
|
-
|
13
|
+
proc {user.add_role(Role.new)}.should raise_exception
|
14
14
|
end
|
15
15
|
|
16
16
|
it "adds a Role to the User when role not yet assigned to User" do
|
17
|
-
|
17
|
+
proc {
|
18
18
|
user.add_role(:new_role)
|
19
19
|
}.should change(user.roles, :count).by(1)
|
20
20
|
user.roles.collect(&:title).should include("NewRole")
|
21
21
|
end
|
22
22
|
|
23
23
|
it "does not add a Role to the User when this Role is already assigned to User" do
|
24
|
-
|
24
|
+
proc {
|
25
25
|
refinery_user.add_role(:refinery)
|
26
26
|
}.should_not change(refinery_user.roles, :count).by(1)
|
27
27
|
refinery_user.roles.collect(&:title).should include("Refinery")
|
@@ -30,7 +30,7 @@ describe User do
|
|
30
30
|
|
31
31
|
context "has_role" do
|
32
32
|
it "raises Exception when Role object is passed" do
|
33
|
-
|
33
|
+
proc{ user.has_role?(Role.new)}.should raise_exception
|
34
34
|
end
|
35
35
|
|
36
36
|
it "returns the true if user has Role" do
|
@@ -61,7 +61,6 @@ describe User do
|
|
61
61
|
}
|
62
62
|
end
|
63
63
|
|
64
|
-
|
65
64
|
it "requires username" do
|
66
65
|
User.new(attr.merge(:username => "")).should_not be_valid
|
67
66
|
end
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: refinerycms-authentication
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.9.9.
|
5
|
+
version: 0.9.9.21
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Resolve Digital
|
@@ -13,7 +13,7 @@ autorequire:
|
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
15
|
|
16
|
-
date: 2011-
|
16
|
+
date: 2011-05-03 00:00:00 Z
|
17
17
|
dependencies:
|
18
18
|
- !ruby/object:Gem::Dependency
|
19
19
|
name: refinerycms-core
|
@@ -23,7 +23,7 @@ dependencies:
|
|
23
23
|
requirements:
|
24
24
|
- - "="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.9.9.
|
26
|
+
version: 0.9.9.21
|
27
27
|
type: :runtime
|
28
28
|
version_requirements: *id001
|
29
29
|
- !ruby/object:Gem::Dependency
|
@@ -34,7 +34,7 @@ dependencies:
|
|
34
34
|
requirements:
|
35
35
|
- - ~>
|
36
36
|
- !ruby/object:Gem::Version
|
37
|
-
version: 1.
|
37
|
+
version: 1.3.0
|
38
38
|
type: :runtime
|
39
39
|
version_requirements: *id002
|
40
40
|
- !ruby/object:Gem::Dependency
|
@@ -59,8 +59,8 @@ extra_rdoc_files: []
|
|
59
59
|
files:
|
60
60
|
- app/controllers/admin/users_controller.rb
|
61
61
|
- app/controllers/passwords_controller.rb
|
62
|
-
- app/controllers/registrations_controller.rb
|
63
62
|
- app/controllers/sessions_controller.rb
|
63
|
+
- app/controllers/users_controller.rb
|
64
64
|
- app/helpers/sessions_helper.rb
|
65
65
|
- app/helpers/users_helper.rb
|
66
66
|
- app/mailers/user_mailer.rb
|
@@ -79,16 +79,17 @@ files:
|
|
79
79
|
- app/views/layouts/login.html.erb
|
80
80
|
- app/views/passwords/edit.html.erb
|
81
81
|
- app/views/passwords/new.html.erb
|
82
|
-
- app/views/registrations/new.html.erb
|
83
82
|
- app/views/sessions/new.html.erb
|
84
83
|
- app/views/user_mailer/reset_notification.html.erb
|
85
84
|
- app/views/user_mailer/reset_notification.text.plain.erb
|
85
|
+
- app/views/users/new.html.erb
|
86
86
|
- config/locales/cs.yml
|
87
87
|
- config/locales/da.yml
|
88
88
|
- config/locales/de.yml
|
89
89
|
- config/locales/el.yml
|
90
90
|
- config/locales/en.yml
|
91
91
|
- config/locales/es.yml
|
92
|
+
- config/locales/fi.yml
|
92
93
|
- config/locales/fr.yml
|
93
94
|
- config/locales/it.yml
|
94
95
|
- config/locales/jp.yml
|