devowd 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (32) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +4 -0
  3. data/Gemfile.lock +118 -0
  4. data/LICENSE.txt +22 -0
  5. data/README.md +31 -0
  6. data/Rakefile +1 -0
  7. data/devowd.gemspec +27 -0
  8. data/lib/devowd/version.rb +3 -0
  9. data/lib/devowd.rb +9 -0
  10. data/lib/generators/devowd/install_generator.rb +169 -0
  11. data/lib/generators/devowd/templates/config/application.yml.erb +4 -0
  12. data/lib/generators/devowd/templates/config/devise.en.yml +59 -0
  13. data/lib/generators/devowd/templates/config/devise.rb.erb +254 -0
  14. data/lib/generators/devowd/templates/controllers/admins_controller.rb +10 -0
  15. data/lib/generators/devowd/templates/controllers/omniauth_callbacks_controller.rb +11 -0
  16. data/lib/generators/devowd/templates/controllers/users_controller.rb +84 -0
  17. data/lib/generators/devowd/templates/mailer/app_mailer.rb.erb +9 -0
  18. data/lib/generators/devowd/templates/mailer/user_activate_mail_template.html.erb +14 -0
  19. data/lib/generators/devowd/templates/migrations/admin_migration.rb +9 -0
  20. data/lib/generators/devowd/templates/migrations/user_migration.rb +25 -0
  21. data/lib/generators/devowd/templates/models/admin.rb +9 -0
  22. data/lib/generators/devowd/templates/models/user.rb +36 -0
  23. data/lib/generators/devowd/templates/views/_visitor_signed_in.html +7 -0
  24. data/lib/generators/devowd/templates/views/admin_show.html +13 -0
  25. data/lib/generators/devowd/templates/views/new.html +17 -0
  26. data/lib/generators/devowd/templates/views/user_collection_template.html +3 -0
  27. data/lib/generators/devowd/templates/views/user_edit.html +7 -0
  28. data/lib/generators/devowd/templates/views/user_edit_by_admin.html +10 -0
  29. data/lib/generators/devowd/templates/views/user_edit_by_user.html +14 -0
  30. data/lib/generators/devowd/templates/views/user_new.html +22 -0
  31. data/lib/generators/devowd/templates/views/user_show.html +0 -0
  32. metadata +160 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 6ffafd1c5be4777b4a6652a34252c24bd9726545
4
+ data.tar.gz: 4518699e6994308b06eee37efbaad83b805e5f74
5
+ SHA512:
6
+ metadata.gz: 29c574eb3b9f4d39748631699e3d45abfd6d22cc13ff754a3a1b5c52844ff6aa58815a6350b5594653393255e447830bf17b64fd6de93389870586dc04f9562a
7
+ data.tar.gz: 2b47cc97d158133eb706470b2d34c576c7f6943741eb0a5aec3ad5ab081c84f84bb11db9b2cea13739a8bee156dad70a8dc4d852698657cff0dc826ce6d0d4aa
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in devowd.gemspec
4
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,118 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ devowd (0.0.1)
5
+ devise (~> 3.2)
6
+ figaro
7
+ omniauth (>= 1.0.0)
8
+ omniauth_crowd
9
+
10
+ GEM
11
+ remote: https://rubygems.org/
12
+ specs:
13
+ actionmailer (4.1.4)
14
+ actionpack (= 4.1.4)
15
+ actionview (= 4.1.4)
16
+ mail (~> 2.5.4)
17
+ actionpack (4.1.4)
18
+ actionview (= 4.1.4)
19
+ activesupport (= 4.1.4)
20
+ rack (~> 1.5.2)
21
+ rack-test (~> 0.6.2)
22
+ actionview (4.1.4)
23
+ activesupport (= 4.1.4)
24
+ builder (~> 3.1)
25
+ erubis (~> 2.7.0)
26
+ activemodel (4.1.4)
27
+ activesupport (= 4.1.4)
28
+ builder (~> 3.1)
29
+ activerecord (4.1.4)
30
+ activemodel (= 4.1.4)
31
+ activesupport (= 4.1.4)
32
+ arel (~> 5.0.0)
33
+ activesupport (4.1.4)
34
+ i18n (~> 0.6, >= 0.6.9)
35
+ json (~> 1.7, >= 1.7.7)
36
+ minitest (~> 5.1)
37
+ thread_safe (~> 0.1)
38
+ tzinfo (~> 1.1)
39
+ arel (5.0.1.20140414130214)
40
+ bcrypt (3.1.7)
41
+ builder (3.2.2)
42
+ devise (3.2.4)
43
+ bcrypt (~> 3.0)
44
+ orm_adapter (~> 0.1)
45
+ railties (>= 3.2.6, < 5)
46
+ thread_safe (~> 0.1)
47
+ warden (~> 1.2.3)
48
+ erubis (2.7.0)
49
+ figaro (0.7.0)
50
+ bundler (~> 1.0)
51
+ rails (>= 3, < 5)
52
+ hashie (3.2.0)
53
+ hike (1.2.3)
54
+ i18n (0.6.11)
55
+ json (1.8.1)
56
+ mail (2.5.4)
57
+ mime-types (~> 1.16)
58
+ treetop (~> 1.4.8)
59
+ mime-types (1.25.1)
60
+ mini_portile (0.6.0)
61
+ minitest (5.4.0)
62
+ multi_json (1.10.1)
63
+ nokogiri (1.6.2.1)
64
+ mini_portile (= 0.6.0)
65
+ omniauth (1.2.2)
66
+ hashie (>= 1.2, < 4)
67
+ rack (~> 1.0)
68
+ omniauth_crowd (2.2.2)
69
+ nokogiri (>= 1.4.4)
70
+ omniauth (~> 1.0)
71
+ orm_adapter (0.5.0)
72
+ polyglot (0.3.5)
73
+ rack (1.5.2)
74
+ rack-test (0.6.2)
75
+ rack (>= 1.0)
76
+ rails (4.1.4)
77
+ actionmailer (= 4.1.4)
78
+ actionpack (= 4.1.4)
79
+ actionview (= 4.1.4)
80
+ activemodel (= 4.1.4)
81
+ activerecord (= 4.1.4)
82
+ activesupport (= 4.1.4)
83
+ bundler (>= 1.3.0, < 2.0)
84
+ railties (= 4.1.4)
85
+ sprockets-rails (~> 2.0)
86
+ railties (4.1.4)
87
+ actionpack (= 4.1.4)
88
+ activesupport (= 4.1.4)
89
+ rake (>= 0.8.7)
90
+ thor (>= 0.18.1, < 2.0)
91
+ rake (10.3.2)
92
+ sprockets (2.12.1)
93
+ hike (~> 1.2)
94
+ multi_json (~> 1.0)
95
+ rack (~> 1.0)
96
+ tilt (~> 1.1, != 1.3.0)
97
+ sprockets-rails (2.1.3)
98
+ actionpack (>= 3.0)
99
+ activesupport (>= 3.0)
100
+ sprockets (~> 2.8)
101
+ thor (0.19.1)
102
+ thread_safe (0.3.4)
103
+ tilt (1.4.1)
104
+ treetop (1.4.15)
105
+ polyglot
106
+ polyglot (>= 0.3.1)
107
+ tzinfo (1.2.1)
108
+ thread_safe (~> 0.1)
109
+ warden (1.2.3)
110
+ rack (>= 1.0)
111
+
112
+ PLATFORMS
113
+ ruby
114
+
115
+ DEPENDENCIES
116
+ bundler (~> 1.5)
117
+ devowd!
118
+ rake
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Ivan Zamylin
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,31 @@
1
+ # Devowd
2
+
3
+ `Devowd` helps to build user management system within a minute. It will create `database_authenticatable` and `rememberable` user with `Devise`. It will add admin who may invite, edit or destroy users. Admins are added and managed through the `Crowd server`.
4
+
5
+ ### Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+ <pre><code>gem 'devowd'
9
+ </pre></code>
10
+ And then execute:
11
+ <pre><code>$ bundle
12
+ </pre></code>
13
+
14
+ ### Usage
15
+
16
+ After `Devowd` is installed, run
17
+ <pre><code>rails g devowd:install
18
+ </pre></code>
19
+ You'll be asked some questions about mail account and `Crowd server` configuration. As generator is done, you are ready to launch server and test.
20
+
21
+ ###Figaro support
22
+
23
+ If you use [figaro](https://github.com/laserlemon/figaro) gem, `Devowd` will pick up `application.yml` file and put mail account and `Crowd server` configuration data there. If you don't have [figaro](https://github.com/laserlemon/figaro), `Devowd` will add it for you.
24
+
25
+ ### Contributing
26
+
27
+ 1. Fork it ( http://github.com/rinatd/devowd/fork )
28
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
29
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
30
+ 4. Push to the branch (`git push origin my-new-feature`)
31
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
data/devowd.gemspec ADDED
@@ -0,0 +1,27 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'devowd/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "devowd"
8
+ spec.version = Devowd::VERSION
9
+ spec.authors = ["Ivan Zamylin", "Rinat Dobrohotov"]
10
+ spec.email = ["zamylin@yandex.ru"]
11
+ spec.summary = %q{Authorization solution with devise and crowd.}
12
+ spec.description = %q{Authorization solution with devise and crowd. Helps to generate model, view, controller for user and admin.}
13
+ spec.homepage = "https://github.com/rinatd/devowd"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files`.split($/)
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.5"
22
+ spec.add_development_dependency "rake"
23
+ spec.add_dependency "devise", "~> 3.2"
24
+ spec.add_dependency "omniauth", ">= 1.0.0"
25
+ spec.add_dependency "omniauth_crowd"
26
+ spec.add_dependency "figaro"
27
+ end
@@ -0,0 +1,3 @@
1
+ module Devowd
2
+ VERSION = "0.0.1"
3
+ end
data/lib/devowd.rb ADDED
@@ -0,0 +1,9 @@
1
+ require "devowd/version"
2
+ require "devise"
3
+ require "omniauth"
4
+ require "omniauth_crowd"
5
+ require "figaro"
6
+
7
+ module Devowd
8
+ # Your code goes here...
9
+ end
@@ -0,0 +1,169 @@
1
+ require 'rails/generators/base'
2
+
3
+ module Devowd
4
+ module Generators
5
+ class InstallGenerator < Rails::Generators::Base
6
+ include Rails::Generators::Migration
7
+ source_root File.expand_path("../templates", __FILE__)
8
+
9
+ def install_devise
10
+ puts "DEVISE CONFIG"
11
+ @email_signature = ask("Signature you will use to send activation invitation from [ex.: Mike Brown]:")
12
+ @email = ask("Email you will use to send activation invitation from [ex.: m.brown@example.com]:")
13
+ @email_password = ask("Password for email [ex.: s0mepaSS]:")
14
+ #crowd configurations
15
+ puts "CROWD CONFIG"
16
+ @crowd_http = ask("Crowd server http [ex.: http://crowd.example.ru/crowd]:")
17
+ @crowd_appname = ask("Name for your application at Crowd server [ex.: awesomeApp]:")
18
+ @crowd_apppassword = ask("Password for your applicaiton at Crowd server [ex.: secret]:")
19
+ template "config/devise.rb.erb", "config/initializers/devise.rb"
20
+ copy_file "config/devise.en.yml", "config/locales/devise.en.yml"
21
+ copy_file "controllers/omniauth_callbacks_controller.rb", "app/controllers/omniauth_callbacks_controller.rb"
22
+ inject_into_class "app/controllers/application_controller.rb", ApplicationController do
23
+ " def after_sign_in_path_for(resource)
24
+ if resource.instance_of? User
25
+ sign_out(current_admin) if !current_admin.nil?
26
+ resource.pass_required = true
27
+ return user_path(resource)
28
+ end
29
+ if resource.instance_of? Admin
30
+ sign_out(current_user) if !current_user.nil?
31
+ return admin_path(resource)
32
+ end
33
+ end
34
+
35
+ def after_sign_out_path_for(resource)
36
+ return admin_login_path if resource == :admin
37
+ return new_user_session_path if resource == :user
38
+ end\n"
39
+ end
40
+ end
41
+
42
+ def install_mailer
43
+ template "mailer/app_mailer.rb.erb", "app/mailers/app_mailer.rb"
44
+ @tls = 'false'
45
+ @address = 'smtp.yandex.ru'
46
+ @port = '587'
47
+ @domain = 'awesome.domain.com'
48
+ @authentication = 'plain'
49
+ @enable_starttls_auto = 'true'
50
+
51
+ development = "config/environments/development.rb"
52
+ this_text = " config.action_mailer.default_url_options = { :host => ENV['HOST'] }
53
+ config.action_mailer.perform_deliveries = true
54
+ config.action_mailer.delivery_method = :smtp
55
+ config.action_mailer.smtp_settings = {
56
+ :tls => #{@tls},
57
+ :address => '#{@address}',
58
+ :port => #{@port},
59
+ :domain => '#{@domain}',
60
+ :user_name => ENV['MAIL_USERNAME'],
61
+ :password => ENV['MAIL_PASSWORD'],
62
+ :authentication => '#{@authentication}',
63
+ :enable_starttls_auto => #{@enable_starttls_auto}
64
+ }"
65
+ this_line = "#{Rails.application.class.parent_name}::Application.configure do\n"
66
+ inject_into_file development, this_text, after: this_line
67
+ this_line = "Rails.application.configure do\n"
68
+ inject_into_file development, this_text, after: this_line
69
+
70
+ production = "config/environments/production.rb"
71
+ this_line = "#{Rails.application.class.parent_name}::Application.configure do\n"
72
+ inject_into_file production, this_text, after: this_line
73
+ this_line = "Rails.application.configure do\n"
74
+ inject_into_file production, this_text, after: this_line
75
+
76
+ copy_file "mailer/user_activate_mail_template.html.erb", "app/views/app_mailer/user_activate.html.erb"
77
+ end
78
+
79
+ def install_admin_model
80
+ puts "..."
81
+ copy_file "models/admin.rb", "app/models/admin.rb"
82
+ copy_file "controllers/admins_controller.rb", "app/controllers/admins_controller.rb"
83
+ migration_template "migrations/admin_migration.rb", "db/migrate/create_admins.rb"
84
+ copy_file "views/admin_show.html", "app/views/admins/show.html.erb"
85
+ end
86
+
87
+ def install_user_model
88
+ copy_file "models/user.rb", "app/models/user.rb"
89
+ copy_file "controllers/users_controller.rb", "app/controllers/users_controller.rb"
90
+ migration_template "migrations/user_migration.rb", "db/migrate/create_users.rb"
91
+ empty_directory "app/views/devise/sessions"
92
+ copy_file "views/new.html", "app/views/devise/sessions/new.html.erb"
93
+ copy_file "views/user_new.html", "app/views/users/new.html.erb"
94
+ copy_file "views/user_show.html", "app/views/users/show.html.erb"
95
+ copy_file "views/user_edit.html", "app/views/users/edit.html.erb"
96
+ copy_file "views/user_edit_by_admin.html", "app/views/application/_edit_user_by_admin.html.erb"
97
+ copy_file "views/user_edit_by_user.html", "app/views/application/_edit_user_by_user.html.erb"
98
+ copy_file "views/user_collection_template.html", "app/views/application/_user.html.erb"
99
+ end
100
+
101
+ def install_migration
102
+ run('bundle exec rake db:create')
103
+ run('bundle exec rake db:migrate')
104
+ end
105
+
106
+ def install_routes
107
+ routes = "config/routes.rb"
108
+ this_text = " devise_for :admins, controllers: {omniauth_callbacks: 'omniauth_callbacks'}
109
+ devise_scope :admin do
110
+ delete '/admins/logout', to: 'devise/sessions#destroy'
111
+ get '/admin', to: 'admins#admin', as: 'admin_login'
112
+ end
113
+ resources :admins, only: [:show]
114
+
115
+ unauthenticated do
116
+ root to: redirect('/users/login'), as: 'user_redirect_to_login'
117
+ get '/users/new', to: redirect('/users/login'), as: 'new_user_redirect_to_login'
118
+ end
119
+
120
+ authenticated :user do
121
+ devise_scope :user do
122
+ get '/users/new', to: redirect('/'), as: 'new_user_redirect_to_root'
123
+ end
124
+ end
125
+
126
+ devise_for :users, path_names: {sign_in: 'login', sign_out: 'logout'}
127
+ resources :users, only: [:show, :create, :new, :edit, :update, :destroy]"
128
+ this_line = "#{Rails.application.class.parent_name}::Application.routes.draw do\n"
129
+ inject_into_file routes, this_text, after: this_line
130
+ this_line = "Rails.application.routes.draw do\n"
131
+ inject_into_file routes, this_text, after: this_line
132
+ end
133
+
134
+ def install_figaro
135
+ if File.exists?("config/application.yml")
136
+ append_to_file("config/application.yml") do
137
+ "CROWD_APPNAME: '#{@crowd_appname}'
138
+ CROWD_APPPASSWORD: '#{@crowd_apppassword}'
139
+ MAIL_USERNAME: '#{@email}'
140
+ MAIL_PASSWORD: '#{@email_password}'
141
+ "
142
+ end
143
+ else
144
+ template("config/application.yml.erb", "config/application.yml")
145
+ end
146
+ end
147
+
148
+ def install_application_layout
149
+ app_layout = "app/views/layouts/application.html.erb"
150
+ this_text = ' <% ENV["HOST"] = request.host_with_port %>
151
+ <%= render partial: "visitor_signed_in" %>
152
+ <%= flash[:notice] %>
153
+ <%= flash[:alert] %>'
154
+ this_line = "<body>\n"
155
+ inject_into_file app_layout, this_text, after: this_line
156
+ copy_file "views/_visitor_signed_in.html", "app/views/application/_visitor_signed_in.html.erb"
157
+ end
158
+
159
+ def self.next_migration_number(path)
160
+ unless @prev_migration_nr
161
+ @prev_migration_nr = Time.now.utc.strftime("%Y%m%d%H%M%S").to_i
162
+ else
163
+ @prev_migration_nr += 1
164
+ end
165
+ @prev_migration_nr.to_s
166
+ end
167
+ end
168
+ end
169
+ end
@@ -0,0 +1,4 @@
1
+ CROWD_APPNAME: "<%= @crowd_appname %>"
2
+ CROWD_APPPASSWORD: "<%= @crowd_apppassword %>"
3
+ MAIL_USERNAME: "<%= @email %>"
4
+ MAIL_PASSWORD: "<%= @email_password %>"
@@ -0,0 +1,59 @@
1
+ # Additional translations at https://github.com/plataformatec/devise/wiki/I18n
2
+
3
+ en:
4
+ devise:
5
+ confirmations:
6
+ confirmed: "Your account was successfully confirmed."
7
+ send_instructions: "You will receive an email with instructions about how to confirm your account in a few minutes."
8
+ send_paranoid_instructions: "If your email address exists in our database, you will receive an email with instructions about how to confirm your account in a few minutes."
9
+ failure:
10
+ already_authenticated: "You are already signed in."
11
+ inactive: "Your account is not activated yet."
12
+ invalid: "Invalid email or password."
13
+ locked: "Your account is locked."
14
+ last_attempt: "You have one more attempt before your account will be locked."
15
+ not_found_in_database: "Invalid email or password."
16
+ timeout: "Your session expired. Please sign in again to continue."
17
+ unauthenticated: "You need to sign in or sign up before continuing."
18
+ unconfirmed: "You have to confirm your account before continuing."
19
+ mailer:
20
+ confirmation_instructions:
21
+ subject: "Confirmation instructions"
22
+ reset_password_instructions:
23
+ subject: "Reset password instructions"
24
+ unlock_instructions:
25
+ subject: "Unlock Instructions"
26
+ omniauth_callbacks:
27
+ failure: "Could not authenticate you from %{kind} because \"%{reason}\"."
28
+ success: "Successfully authenticated from %{kind} account."
29
+ passwords:
30
+ no_token: "You can't access this page without coming from a password reset email. If you do come from a password reset email, please make sure you used the full URL provided."
31
+ send_instructions: "You will receive an email with instructions on how to reset your password in a few minutes."
32
+ send_paranoid_instructions: "If your email address exists in our database, you will receive a password recovery link at your email address in a few minutes."
33
+ updated: "Your password was changed successfully. You are now signed in."
34
+ updated_not_active: "Your password was changed successfully."
35
+ registrations:
36
+ destroyed: "Bye! Your account was successfully cancelled. We hope to see you again soon."
37
+ signed_up: "Welcome! You have signed up successfully."
38
+ signed_up_but_inactive: "You have signed up successfully. However, we could not sign you in because your account is not yet activated."
39
+ signed_up_but_locked: "You have signed up successfully. However, we could not sign you in because your account is locked."
40
+ signed_up_but_unconfirmed: "A message with a confirmation link has been sent to your email address. Please open the link to activate your account."
41
+ update_needs_confirmation: "You updated your account successfully, but we need to verify your new email address. Please check your email and click on the confirm link to finalize confirming your new email address."
42
+ updated: "You updated your account successfully."
43
+ sessions:
44
+ signed_in: "Signed in successfully."
45
+ signed_out: "Signed out successfully."
46
+ unlocks:
47
+ send_instructions: "You will receive an email with instructions about how to unlock your account in a few minutes."
48
+ send_paranoid_instructions: "If your account exists, you will receive an email with instructions about how to unlock it in a few minutes."
49
+ unlocked: "Your account has been unlocked successfully. Please sign in to continue."
50
+ errors:
51
+ messages:
52
+ already_confirmed: "was already confirmed, please try signing in"
53
+ confirmation_period_expired: "needs to be confirmed within %{period}, please request a new one"
54
+ expired: "has expired, please request a new one"
55
+ not_found: "not found"
56
+ not_locked: "was not locked"
57
+ not_saved:
58
+ one: "1 error prohibited this %{resource} from being saved:"
59
+ other: "%{count} errors prohibited this %{resource} from being saved:"
@@ -0,0 +1,254 @@
1
+ # Use this hook to configure devise mailer, warden hooks and so forth.
2
+ # Many of these configuration options can be set straight in your model.
3
+ Devise.setup do |config|
4
+ # The secret key used by Devise. Devise uses this key to generate
5
+ # random tokens. Changing this key will render invalid all existing
6
+ # confirmation, reset password and unlock tokens in the database.
7
+ config.secret_key = '<%= SecureRandom.hex(64) %>'
8
+
9
+ # ==> Mailer Configuration
10
+ # Configure the e-mail address which will be shown in Devise::Mailer,
11
+ # note that it will be overwritten if you use your own mailer class
12
+ # with default "from" parameter.
13
+ config.mailer_sender = '<%= @email_signature %> <<%= @email %>>'
14
+
15
+ # Configure the class responsible to send e-mails.
16
+ # config.mailer = 'Devise::Mailer'
17
+
18
+ # ==> ORM configuration
19
+ # Load and configure the ORM. Supports :active_record (default) and
20
+ # :mongoid (bson_ext recommended) by default. Other ORMs may be
21
+ # available as additional gems.
22
+ require 'devise/orm/active_record'
23
+
24
+ # ==> Configuration for any authentication mechanism
25
+ # Configure which keys are used when authenticating a user. The default is
26
+ # just :email. You can configure it to use [:username, :subdomain], so for
27
+ # authenticating a user, both parameters are required. Remember that those
28
+ # parameters are used only when authenticating and not when retrieving from
29
+ # session. If you need permissions, you should implement that in a before filter.
30
+ # You can also supply a hash where the value is a boolean determining whether
31
+ # or not authentication should be aborted when the value is not present.
32
+ # config.authentication_keys = [ :email ]
33
+
34
+ # Configure parameters from the request object used for authentication. Each entry
35
+ # given should be a request method and it will automatically be passed to the
36
+ # find_for_authentication method and considered in your model lookup. For instance,
37
+ # if you set :request_keys to [:subdomain], :subdomain will be used on authentication.
38
+ # The same considerations mentioned for authentication_keys also apply to request_keys.
39
+ # config.request_keys = []
40
+
41
+ # Configure which authentication keys should be case-insensitive.
42
+ # These keys will be downcased upon creating or modifying a user and when used
43
+ # to authenticate or find a user. Default is :email.
44
+ config.case_insensitive_keys = [ :email ]
45
+
46
+ # Configure which authentication keys should have whitespace stripped.
47
+ # These keys will have whitespace before and after removed upon creating or
48
+ # modifying a user and when used to authenticate or find a user. Default is :email.
49
+ config.strip_whitespace_keys = [ :email ]
50
+
51
+ # Tell if authentication through request.params is enabled. True by default.
52
+ # It can be set to an array that will enable params authentication only for the
53
+ # given strategies, for example, `config.params_authenticatable = [:database]` will
54
+ # enable it only for database (email + password) authentication.
55
+ # config.params_authenticatable = true
56
+
57
+ # Tell if authentication through HTTP Auth is enabled. False by default.
58
+ # It can be set to an array that will enable http authentication only for the
59
+ # given strategies, for example, `config.http_authenticatable = [:database]` will
60
+ # enable it only for database authentication. The supported strategies are:
61
+ # :database = Support basic authentication with authentication key + password
62
+ # config.http_authenticatable = false
63
+
64
+ # If http headers should be returned for AJAX requests. True by default.
65
+ # config.http_authenticatable_on_xhr = true
66
+
67
+ # The realm used in Http Basic Authentication. 'Application' by default.
68
+ # config.http_authentication_realm = 'Application'
69
+
70
+ # It will change confirmation, password recovery and other workflows
71
+ # to behave the same regardless if the e-mail provided was right or wrong.
72
+ # Does not affect registerable.
73
+ # config.paranoid = true
74
+
75
+ # By default Devise will store the user in session. You can skip storage for
76
+ # particular strategies by setting this option.
77
+ # Notice that if you are skipping storage for all authentication paths, you
78
+ # may want to disable generating routes to Devise's sessions controller by
79
+ # passing :skip => :sessions to `devise_for` in your config/routes.rb
80
+ config.skip_session_storage = [:http_auth]
81
+
82
+ # By default, Devise cleans up the CSRF token on authentication to
83
+ # avoid CSRF token fixation attacks. This means that, when using AJAX
84
+ # requests for sign in and sign up, you need to get a new CSRF token
85
+ # from the server. You can disable this option at your own risk.
86
+ # config.clean_up_csrf_token_on_authentication = true
87
+
88
+ # ==> Configuration for :database_authenticatable
89
+ # For bcrypt, this is the cost for hashing the password and defaults to 10. If
90
+ # using other encryptors, it sets how many times you want the password re-encrypted.
91
+ #
92
+ # Limiting the stretches to just one in testing will increase the performance of
93
+ # your test suite dramatically. However, it is STRONGLY RECOMMENDED to not use
94
+ # a value less than 10 in other environments.
95
+ config.stretches = Rails.env.test? ? 1 : 10
96
+
97
+ # Setup a pepper to generate the encrypted password.
98
+ # config.pepper = '<%= SecureRandom.hex(64) %>'
99
+
100
+ # ==> Configuration for :confirmable
101
+ # A period that the user is allowed to access the website even without
102
+ # confirming their account. For instance, if set to 2.days, the user will be
103
+ # able to access the website for two days without confirming their account,
104
+ # access will be blocked just in the third day. Default is 0.days, meaning
105
+ # the user cannot access the website without confirming their account.
106
+ # config.allow_unconfirmed_access_for = 2.days
107
+
108
+ # A period that the user is allowed to confirm their account before their
109
+ # token becomes invalid. For example, if set to 3.days, the user can confirm
110
+ # their account within 3 days after the mail was sent, but on the fourth day
111
+ # their account can't be confirmed with the token any more.
112
+ # Default is nil, meaning there is no restriction on how long a user can take
113
+ # before confirming their account.
114
+ # config.confirm_within = 3.days
115
+
116
+ # If true, requires any email changes to be confirmed (exactly the same way as
117
+ # initial account confirmation) to be applied. Requires additional unconfirmed_email
118
+ # db field (see migrations). Until confirmed new email is stored in
119
+ # unconfirmed email column, and copied to email column on successful confirmation.
120
+ config.reconfirmable = true
121
+
122
+ # Defines which key will be used when confirming an account
123
+ # config.confirmation_keys = [ :email ]
124
+
125
+ # ==> Configuration for :rememberable
126
+ # The time the user will be remembered without asking for credentials again.
127
+ # config.remember_for = 2.weeks
128
+
129
+ # If true, extends the user's remember period when remembered via cookie.
130
+ # config.extend_remember_period = false
131
+
132
+ # Options to be passed to the created cookie. For instance, you can set
133
+ # :secure => true in order to force SSL only cookies.
134
+ # config.rememberable_options = {}
135
+
136
+ # ==> Configuration for :validatable
137
+ # Range for password length.
138
+ config.password_length = 8..128
139
+
140
+ # Email regex used to validate email formats. It simply asserts that
141
+ # one (and only one) @ exists in the given string. This is mainly
142
+ # to give user feedback and not to assert the e-mail validity.
143
+ # config.email_regexp = /\A[^@]+@[^@]+\z/
144
+
145
+ # ==> Configuration for :timeoutable
146
+ # The time you want to timeout the user session without activity. After this
147
+ # time the user will be asked for credentials again. Default is 30 minutes.
148
+ # config.timeout_in = 30.minutes
149
+
150
+ # If true, expires auth token on session timeout.
151
+ # config.expire_auth_token_on_timeout = false
152
+
153
+ # ==> Configuration for :lockable
154
+ # Defines which strategy will be used to lock an account.
155
+ # :failed_attempts = Locks an account after a number of failed attempts to sign in.
156
+ # :none = No lock strategy. You should handle locking by yourself.
157
+ # config.lock_strategy = :failed_attempts
158
+
159
+ # Defines which key will be used when locking and unlocking an account
160
+ # config.unlock_keys = [ :email ]
161
+
162
+ # Defines which strategy will be used to unlock an account.
163
+ # :email = Sends an unlock link to the user email
164
+ # :time = Re-enables login after a certain amount of time (see :unlock_in below)
165
+ # :both = Enables both strategies
166
+ # :none = No unlock strategy. You should handle unlocking by yourself.
167
+ # config.unlock_strategy = :both
168
+
169
+ # Number of authentication tries before locking an account if lock_strategy
170
+ # is failed attempts.
171
+ # config.maximum_attempts = 20
172
+
173
+ # Time interval to unlock the account if :time is enabled as unlock_strategy.
174
+ # config.unlock_in = 1.hour
175
+
176
+ # Warn on the last attempt before the account is locked.
177
+ # config.last_attempt_warning = false
178
+
179
+ # ==> Configuration for :recoverable
180
+ #
181
+ # Defines which key will be used when recovering the password for an account
182
+ # config.reset_password_keys = [ :email ]
183
+
184
+ # Time interval you can reset your password with a reset password key.
185
+ # Don't put a too small interval or your users won't have the time to
186
+ # change their passwords.
187
+ config.reset_password_within = 6.hours
188
+
189
+ # ==> Configuration for :encryptable
190
+ # Allow you to use another encryption algorithm besides bcrypt (default). You can use
191
+ # :sha1, :sha512 or encryptors from others authentication tools as :clearance_sha1,
192
+ # :authlogic_sha512 (then you should set stretches above to 20 for default behavior)
193
+ # and :restful_authentication_sha1 (then you should set stretches to 10, and copy
194
+ # REST_AUTH_SITE_KEY to pepper).
195
+ #
196
+ # Require the `devise-encryptable` gem when using anything other than bcrypt
197
+ # config.encryptor = :sha512
198
+
199
+ # ==> Scopes configuration
200
+ # Turn scoped views on. Before rendering "sessions/new", it will first check for
201
+ # "users/sessions/new". It's turned off by default because it's slower if you
202
+ # are using only default views.
203
+ # config.scoped_views = false
204
+
205
+ # Configure the default scope given to Warden. By default it's the first
206
+ # devise role declared in your routes (usually :user).
207
+ # config.default_scope = :user
208
+
209
+ # Set this configuration to false if you want /users/sign_out to sign out
210
+ # only the current scope. By default, Devise signs out all scopes.
211
+ # config.sign_out_all_scopes = true
212
+
213
+ # ==> Navigation configuration
214
+ # Lists the formats that should be treated as navigational. Formats like
215
+ # :html, should redirect to the sign in page when the user does not have
216
+ # access, but formats like :xml or :json, should return 401.
217
+ #
218
+ # If you have any extra navigational formats, like :iphone or :mobile, you
219
+ # should add them to the navigational formats lists.
220
+ #
221
+ # The "*/*" below is required to match Internet Explorer requests.
222
+ # config.navigational_formats = ['*/*', :html]
223
+
224
+ # The default HTTP method used to sign out a resource. Default is :delete.
225
+ config.sign_out_via = :delete
226
+
227
+ # ==> OmniAuth
228
+ # Add a new OmniAuth provider. Check the wiki for more information on setting
229
+ # up on your models and hooks.
230
+ config.omniauth :crowd, crowd_server_url: "<%= @crowd_http %>", application_name: ENV['CROWD_APPNAME'], application_password: ENV['CROWD_APPPASSWORD']
231
+
232
+ # ==> Warden configuration
233
+ # If you want to use other strategies, that are not supported by Devise, or
234
+ # change the failure app, you can configure them inside the config.warden block.
235
+ #
236
+ # config.warden do |manager|
237
+ # manager.intercept_401 = false
238
+ # manager.default_strategies(:scope => :user).unshift :some_external_strategy
239
+ # end
240
+
241
+ # ==> Mountable engine configurations
242
+ # When using Devise inside an engine, let's call it `MyEngine`, and this engine
243
+ # is mountable, there are some extra configurations to be taken into account.
244
+ # The following options are available, assuming the engine is mounted as:
245
+ #
246
+ # mount MyEngine, at: '/my_engine'
247
+ #
248
+ # The router that invoked `devise_for`, in the example above, would be:
249
+ # config.router_name = :my_engine
250
+ #
251
+ # When using omniauth, Devise cannot automatically set Omniauth path,
252
+ # so you need to do it manually. For the users scope, it would be:
253
+ # config.omniauth_path_prefix = '/my_engine/users/auth'
254
+ end
@@ -0,0 +1,10 @@
1
+ class AdminsController < ApplicationController
2
+ def show
3
+ @admin = Admin.find(params[:id])
4
+ @users = User.all
5
+ end
6
+
7
+ def admin
8
+ redirect_to admin_signed_in? ? admin_path(current_admin) : admin_omniauth_authorize_path(:crowd)
9
+ end
10
+ end
@@ -0,0 +1,11 @@
1
+ class OmniauthCallbacksController < Devise::OmniauthCallbacksController
2
+ def failure
3
+ redirect_to admin_login_path
4
+ end
5
+
6
+ def crowd
7
+ admin = Admin.from_omniauth(request.env["omniauth.auth"].with_indifferent_access)
8
+ sign_out(current_user) if !current_user.nil?
9
+ sign_in_and_redirect admin
10
+ end
11
+ end
@@ -0,0 +1,84 @@
1
+ class UsersController < ApplicationController
2
+ def show
3
+
4
+ end
5
+
6
+ def new
7
+ @user = User.new
8
+ end
9
+
10
+ def create
11
+ args = params.require(:user).permit(:email, :fname, :mname, :lname)
12
+ args[:password] = ''
13
+ args[:password_confirmation] = ''
14
+
15
+ @user = User.new args
16
+
17
+ if @user.save
18
+ redirect_to current_admin, flash: {notice: 'Приглашение отправлено'}
19
+ else
20
+ flash[:alert] = @user.errors.messages
21
+ render :new
22
+ end
23
+ end
24
+
25
+ def edit
26
+ if current_admin != nil
27
+ @user = User.find(params[:id])
28
+ else
29
+ token = (params[:token] != nil ? params[:token] : params[:user][:token])
30
+ @user = User.find_by(token: token)
31
+ if @user.nil?
32
+ flash[:alert] = "Неправильный токен!"
33
+ @user = User.new
34
+ end
35
+ if @user.activated?
36
+ redirect_to ('/') and return
37
+ end
38
+ end
39
+ end
40
+
41
+ def update
42
+ if current_admin != nil
43
+ @user = User.find(params[:id])
44
+ args = params.require(:user).permit(:fname, :mname, :lname)
45
+ @user.pass_required = false
46
+ if @user.update(args)
47
+ @user.pass_required = true
48
+ flash[:notice] = 'Данные изменены'
49
+ redirect_to admin_path(current_admin)
50
+ else
51
+ @user.pass_required = true
52
+ flash[:alert] = @user.errors.messages
53
+ render :edit
54
+ end
55
+ else
56
+ token = (params[:token] != nil ? params[:token] : params[:user][:token])
57
+ @user = User.find_by(token: token)
58
+ args = params.require(:user).permit(:password, :password_confirmation, :fname, :mname, :lname).merge(activated: true)
59
+ if @user.nil?
60
+ flash[:alert] = "Неправильный токен!"
61
+ @user = User.new
62
+ return render :edit
63
+ end
64
+ if @user.activated?
65
+ redirect_to ('/') and return
66
+ end
67
+ if @user.update(args)
68
+ flash[:notice] = 'Регистрация прошла успешно'
69
+ sign_out(current_admin) if !current_admin.nil?
70
+ sign_in_and_redirect @user
71
+ else
72
+ flash[:alert] = @user.errors.messages
73
+ render :edit
74
+ end
75
+ end
76
+ end
77
+
78
+ def destroy
79
+ @user = User.find(params[:id])
80
+ @user.destroy
81
+ flash[:notice] = 'Пользователь удален'
82
+ redirect_to admin_path(current_admin)
83
+ end
84
+ end
@@ -0,0 +1,9 @@
1
+ class AppMailer < ActionMailer::Base
2
+ default from: "<%= @email_signature %> <#{ENV["MAIL_USERNAME"]}>"
3
+
4
+ def user_activate(user)
5
+ @user = user
6
+ @url = 'http://' + (ENV['HOST'] != nil ? ENV['HOST'] : "localhost:3000") + '/users/' + @user[:id].to_s + '/edit?token=' + @user[:token]
7
+ mail(to: @user.email, subject: 'Invitation')
8
+ end
9
+ end
@@ -0,0 +1,14 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta content='text/html; charset=UTF-8' http-equiv='Content-Type' />
5
+ </head>
6
+ <body>
7
+ <p>
8
+ Вы получили приглашение для регистрации в ПРИЛОЖЕНИИ.<br/>
9
+ Для того, чтобы завершить регистрацию, перейдите по ссылке:<br/>
10
+ <%= @url %> <br/>
11
+ <br/>
12
+ </p>
13
+ </body>
14
+ </html>
@@ -0,0 +1,9 @@
1
+ class CreateAdmins < ActiveRecord::Migration
2
+ def change
3
+ create_table :admins do |t|
4
+ t.string :uid
5
+ t.string :fname
6
+ t.string :lname
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,25 @@
1
+ class CreateUsers < ActiveRecord::Migration
2
+ def change
3
+ create_table :users do |t|
4
+ t.string :fname
5
+ t.string :lname
6
+ t.string :mname
7
+ t.boolean :activated, default: false
8
+ t.string :token
9
+
10
+ ## Database authenticatable
11
+ t.string :email, :null => false, :default => ""
12
+ t.string :encrypted_password, :null => false, :default => ""
13
+
14
+ ## Rememberable
15
+ t.datetime :remember_created_at
16
+
17
+ ## Trackable
18
+ t.integer :sign_in_count, :default => 0, :null => false
19
+ t.datetime :current_sign_in_at
20
+ t.datetime :last_sign_in_at
21
+ t.string :current_sign_in_ip
22
+ t.string :last_sign_in_ip
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,9 @@
1
+ class Admin < ActiveRecord::Base
2
+ devise :omniauthable
3
+
4
+ validates :uid, presence: true, uniqueness: true
5
+
6
+ def self.from_omniauth params
7
+ where(params.slice(:uid)).first_or_create(fname: params[:info][:first_name], lname: params[:info][:last_name])
8
+ end
9
+ end
@@ -0,0 +1,36 @@
1
+ class User < ActiveRecord::Base
2
+ devise :database_authenticatable, :rememberable, :trackable
3
+
4
+ before_create :generate_token
5
+ after_create :send_activate_email
6
+
7
+ validates_presence_of :fname, message: "Поле Имя не может быть пустым"
8
+ validates_presence_of :mname, message: "Поле Отчество не может быть пустым"
9
+
10
+ validates_presence_of :email, message: "Поле Email не может быть пустым"
11
+ validates_uniqueness_of :email, message: "Данный Email уже зарегистрирован"
12
+ validates_format_of :email, with: /\A[^@]+@([^@\.]+\.)+[^@\.]+\z/, message: "Неверный формат Email"
13
+
14
+ validates_presence_of :password, on: :update, message: "Пароль не может быть пустым", :if => :password_required?
15
+ validates_confirmation_of :password, message: "Пароли не совпадают"
16
+ validates_length_of :password, within: 0..128, on: :create, allow_blank: true
17
+ validates_length_of :password, within: 6..128, on: :update, message: "Пароль должен быть не менее 6 символов", :if => :password_required?
18
+
19
+ attr_accessor :pass_required
20
+
21
+ def send_activate_email
22
+ AppMailer.user_activate(self).deliver
23
+ end
24
+
25
+ def generate_token
26
+ self.token = loop do
27
+ random_token = SecureRandom.urlsafe_base64(nil, false).slice!(0...6)
28
+ break random_token unless User.exists?(token: random_token)
29
+ end
30
+ end
31
+
32
+ def password_required?
33
+ pass_required == nil ? true : pass_required
34
+ end
35
+
36
+ end
@@ -0,0 +1,7 @@
1
+ <div>
2
+ <% if current_admin != nil %>
3
+ Вы вошли как <strong><%= current_admin[:lname] %> <%= current_admin[:fname] %> </strong><%= link_to "Выйти", admins_logout_path, method: :delete %>
4
+ <% elsif current_user != nil %>
5
+ Вы вошли как <strong><%= current_user[:lname] %> <%= current_user[:fname] %> <%= current_user[:mname] %> </strong><%= link_to "Выйти", destroy_user_session_path, method: :delete %>
6
+ <% end %>
7
+ </div>
@@ -0,0 +1,13 @@
1
+ <div>
2
+ <div>
3
+ <h3>Пользователи</h3>
4
+ <div style="width: 280px"></i><%= link_to "Пригласить пользователя", new_user_path%></div>
5
+ </div>
6
+
7
+ <div>
8
+ <div>
9
+ <%= render partial: "user", collection: @users %>
10
+ </div>
11
+ </div>
12
+
13
+ </div>
@@ -0,0 +1,17 @@
1
+ <h3>Войти</h3>
2
+
3
+ <%= form_for(resource, as: resource_name, url: session_path(resource_name)) do |f| %>
4
+ <div><%= f.label :email %><br />
5
+ <%= f.email_field :email, autofocus: true %></div>
6
+
7
+ <div><%= f.label :password %><br />
8
+ <%= f.password_field :password, autocomplete: "off" %></div>
9
+
10
+ <% if devise_mapping.rememberable? -%>
11
+ <div><%= f.check_box :remember_me %> <%= f.label :remember_me %></div>
12
+ <% end -%>
13
+
14
+ <div><%= f.submit "Войти" %></div>
15
+ <% end %>
16
+
17
+ <%= render "devise/shared/links" %>
@@ -0,0 +1,3 @@
1
+ <div>
2
+ <p><%= user[:fname] %> (<%= user[:activated] == true ? "Активирован" : "Не активирован" %>)</p> <%= link_to "Удалить", user_path(user), method: :delete, data: { confirm: 'Вы действительно хотите удалить пользователя?' } %> <%= link_to "Изменить", edit_user_path(user) %>
3
+ </div>
@@ -0,0 +1,7 @@
1
+ <div>
2
+ <div>
3
+ <h3>Пользователь</h3>
4
+ <%= render partial: "edit_user_by_user" if current_admin == nil %>
5
+ <div><%= render partial: "edit_user_by_admin" if current_admin != nil %></div>
6
+ </div>
7
+ </div>
@@ -0,0 +1,10 @@
1
+ <%= form_for @user, :url => {:action => "update"}, method: :put do |f| %>
2
+ <% f.label :fname %><br />
3
+ <div><%= f.text_field :lname, placeholder: "Фамилия" %><br></div>
4
+ <div><%= f.text_field :fname, placeholder: "Имя" %><br></div>
5
+ <div><%= f.text_field :mname, placeholder: "Отчество" %><br></div>
6
+ <div><%= f.text_field :email, disabled: true %><br></div>
7
+ <div><%= f.submit "Сохранить"%></div>
8
+ <div></div>
9
+ <% end %>
10
+ <div><%= link_to "Отмена", admin_path(current_admin), data: { confirm: "Изменения не будут сохранены, все равно выйти?" } %></div>
@@ -0,0 +1,14 @@
1
+ <%= form_for @user, :url => {:action => "update"}, method: :put, :token => params[:token] do |f| %>
2
+ <% f.label :fname %><br />
3
+ <div><%= f.text_field :lname, placeholder: "Фамилия" %><br></div>
4
+ <div><%= f.text_field :fname, placeholder: "Имя" %><br></div>
5
+ <div><%= f.text_field :mname, placeholder: "Отчество" %><br></div>
6
+ <div>
7
+ <input type="text" name="fake_pass" id="fake_pass" value="Укажите пароль" style="display:none;"/>
8
+ <%= f.password_field :password, placeholder: "Укажите пароль" %><br></div>
9
+ <div>
10
+ <input type="text" name="fake_passconfirm" id="fake_passconfirm" value="Подтвердите пароль" style="display:none;"/>
11
+ <%= f.password_field :password_confirmation, placeholder: "Подтвердите пароль" %><br></div>
12
+ <div><%= f.hidden_field :token, value: params[:token] != nil ? params[:token] : params[:user][:token] %></div>
13
+ <div><%= f.submit "Зарегистрироваться" %></div>
14
+ <% end %>
@@ -0,0 +1,22 @@
1
+ <div>
2
+ <div>
3
+ <div id = "mainContainer">
4
+ <h3>Приглашение пользователя</h3>
5
+ <%= form_for @user do |f| %>
6
+ <% f.label :fname %><br />
7
+ <div>
8
+ <div>
9
+ <div><%= f.text_field :lname, placeholder: "Фамилия" %></div>
10
+ <div><%= f.text_field :fname, placeholder: "Имя" %></div>
11
+ <div><%= f.text_field :mname, placeholder: "Отчество" %></div>
12
+ <div><%= f.text_field :email, placeholder: "Email" %></div>
13
+
14
+ <div>
15
+ <%= f.button "Пригласить" %>
16
+ </div>
17
+ </div>
18
+ </div>
19
+ <% end %>
20
+ </div>
21
+ </div>
22
+ </div>
metadata ADDED
@@ -0,0 +1,160 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: devowd
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Ivan Zamylin
8
+ - Rinat Dobrohotov
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2014-07-16 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: bundler
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - "~>"
19
+ - !ruby/object:Gem::Version
20
+ version: '1.5'
21
+ type: :development
22
+ prerelease: false
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - "~>"
26
+ - !ruby/object:Gem::Version
27
+ version: '1.5'
28
+ - !ruby/object:Gem::Dependency
29
+ name: rake
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - ">="
33
+ - !ruby/object:Gem::Version
34
+ version: '0'
35
+ type: :development
36
+ prerelease: false
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - ">="
40
+ - !ruby/object:Gem::Version
41
+ version: '0'
42
+ - !ruby/object:Gem::Dependency
43
+ name: devise
44
+ requirement: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - "~>"
47
+ - !ruby/object:Gem::Version
48
+ version: '3.2'
49
+ type: :runtime
50
+ prerelease: false
51
+ version_requirements: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - "~>"
54
+ - !ruby/object:Gem::Version
55
+ version: '3.2'
56
+ - !ruby/object:Gem::Dependency
57
+ name: omniauth
58
+ requirement: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - ">="
61
+ - !ruby/object:Gem::Version
62
+ version: 1.0.0
63
+ type: :runtime
64
+ prerelease: false
65
+ version_requirements: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - ">="
68
+ - !ruby/object:Gem::Version
69
+ version: 1.0.0
70
+ - !ruby/object:Gem::Dependency
71
+ name: omniauth_crowd
72
+ requirement: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - ">="
75
+ - !ruby/object:Gem::Version
76
+ version: '0'
77
+ type: :runtime
78
+ prerelease: false
79
+ version_requirements: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - ">="
82
+ - !ruby/object:Gem::Version
83
+ version: '0'
84
+ - !ruby/object:Gem::Dependency
85
+ name: figaro
86
+ requirement: !ruby/object:Gem::Requirement
87
+ requirements:
88
+ - - ">="
89
+ - !ruby/object:Gem::Version
90
+ version: '0'
91
+ type: :runtime
92
+ prerelease: false
93
+ version_requirements: !ruby/object:Gem::Requirement
94
+ requirements:
95
+ - - ">="
96
+ - !ruby/object:Gem::Version
97
+ version: '0'
98
+ description: Authorization solution with devise and crowd. Helps to generate model,
99
+ view, controller for user and admin.
100
+ email:
101
+ - zamylin@yandex.ru
102
+ executables: []
103
+ extensions: []
104
+ extra_rdoc_files: []
105
+ files:
106
+ - Gemfile
107
+ - Gemfile.lock
108
+ - LICENSE.txt
109
+ - README.md
110
+ - Rakefile
111
+ - devowd.gemspec
112
+ - lib/devowd.rb
113
+ - lib/devowd/version.rb
114
+ - lib/generators/devowd/install_generator.rb
115
+ - lib/generators/devowd/templates/config/application.yml.erb
116
+ - lib/generators/devowd/templates/config/devise.en.yml
117
+ - lib/generators/devowd/templates/config/devise.rb.erb
118
+ - lib/generators/devowd/templates/controllers/admins_controller.rb
119
+ - lib/generators/devowd/templates/controllers/omniauth_callbacks_controller.rb
120
+ - lib/generators/devowd/templates/controllers/users_controller.rb
121
+ - lib/generators/devowd/templates/mailer/app_mailer.rb.erb
122
+ - lib/generators/devowd/templates/mailer/user_activate_mail_template.html.erb
123
+ - lib/generators/devowd/templates/migrations/admin_migration.rb
124
+ - lib/generators/devowd/templates/migrations/user_migration.rb
125
+ - lib/generators/devowd/templates/models/admin.rb
126
+ - lib/generators/devowd/templates/models/user.rb
127
+ - lib/generators/devowd/templates/views/_visitor_signed_in.html
128
+ - lib/generators/devowd/templates/views/admin_show.html
129
+ - lib/generators/devowd/templates/views/new.html
130
+ - lib/generators/devowd/templates/views/user_collection_template.html
131
+ - lib/generators/devowd/templates/views/user_edit.html
132
+ - lib/generators/devowd/templates/views/user_edit_by_admin.html
133
+ - lib/generators/devowd/templates/views/user_edit_by_user.html
134
+ - lib/generators/devowd/templates/views/user_new.html
135
+ - lib/generators/devowd/templates/views/user_show.html
136
+ homepage: https://github.com/rinatd/devowd
137
+ licenses:
138
+ - MIT
139
+ metadata: {}
140
+ post_install_message:
141
+ rdoc_options: []
142
+ require_paths:
143
+ - lib
144
+ required_ruby_version: !ruby/object:Gem::Requirement
145
+ requirements:
146
+ - - ">="
147
+ - !ruby/object:Gem::Version
148
+ version: '0'
149
+ required_rubygems_version: !ruby/object:Gem::Requirement
150
+ requirements:
151
+ - - ">="
152
+ - !ruby/object:Gem::Version
153
+ version: '0'
154
+ requirements: []
155
+ rubyforge_project:
156
+ rubygems_version: 2.2.2
157
+ signing_key:
158
+ specification_version: 4
159
+ summary: Authorization solution with devise and crowd.
160
+ test_files: []