oxen_user 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (55) hide show
  1. checksums.yaml +7 -0
  2. data/.envrc +0 -0
  3. data/.gitignore +10 -0
  4. data/.rspec +3 -0
  5. data/.ruby-version +1 -0
  6. data/.travis.yml +3 -0
  7. data/CODE_OF_CONDUCT.md +13 -0
  8. data/Gemfile +7 -0
  9. data/Guardfile +77 -0
  10. data/LICENSE.txt +21 -0
  11. data/README.md +39 -0
  12. data/Rakefile +10 -0
  13. data/app/assets/javascripts/oxen_user.js +3 -0
  14. data/app/assets/javascripts/pw_strength.js.coffee +24 -0
  15. data/app/assets/javascripts/zxcvbn.js +43 -0
  16. data/app/controllers/oxen/invitations_controller.rb +66 -0
  17. data/app/controllers/oxen/users_controller.rb +96 -0
  18. data/app/helpers/oxen/users_helper.rb +8 -0
  19. data/app/models/ox_user.rb +89 -0
  20. data/app/policies/oxen/user_policy.rb +48 -0
  21. data/app/views/devise/confirmations/new.html.haml +13 -0
  22. data/app/views/devise/mailer/eksempel +10 -0
  23. data/app/views/devise/mailer/invitation_instructions.html.erb +1087 -0
  24. data/app/views/devise/passwords/edit.html.haml +21 -0
  25. data/app/views/devise/passwords/new.html.haml +10 -0
  26. data/app/views/devise/registrations/edit.html.haml +51 -0
  27. data/app/views/devise/registrations/new.html.haml +32 -0
  28. data/app/views/devise/sessions/new.html.haml +25 -0
  29. data/app/views/devise/shared/_links.html.haml +24 -0
  30. data/app/views/devise/unlocks/new.html.haml +13 -0
  31. data/app/views/oxen/users/_account_user.html.haml +14 -0
  32. data/app/views/oxen/users/_account_users.html.haml +15 -0
  33. data/app/views/oxen/users/_form.html.haml +41 -0
  34. data/app/views/oxen/users/_user_form.html.erb +12 -0
  35. data/app/views/oxen/users/confirm.html.haml +4 -0
  36. data/app/views/oxen/users/invitations/_new.html.haml +38 -0
  37. data/app/views/oxen/users/invitations/create.html.haml +5 -0
  38. data/app/views/oxen/users/invitations/edit.html.haml +22 -0
  39. data/bin/console +14 -0
  40. data/bin/setup +7 -0
  41. data/config/initializers/devise.rb +360 -0
  42. data/config/initializers/devise_permitted_parameters.rb +17 -0
  43. data/config/locales/devise.da.yml +58 -0
  44. data/config/locales/devise.en.yml +61 -0
  45. data/config/locales/devise_invitable.da.yml +26 -0
  46. data/config/locales/devise_invitable.en.yml +23 -0
  47. data/config/routes.rb +51 -0
  48. data/lib/generators/oxen_user/account_generator.rb +26 -0
  49. data/lib/generators/oxen_user/templates/user.rb +10 -0
  50. data/lib/generators/oxen_user/templates/user_permission.rb +14 -0
  51. data/lib/oxen_user/engine.rb +17 -0
  52. data/lib/oxen_user/version.rb +3 -0
  53. data/lib/oxen_user.rb +10 -0
  54. data/oxen_user.gemspec +57 -0
  55. metadata +377 -0
@@ -0,0 +1,360 @@
1
+ require 'devise'
2
+ require 'devise_invitable'
3
+ require 'devise_zxcvbn'
4
+ #require 'devise_cas_authenticatable'
5
+
6
+ # Use this hook to configure devise mailer, warden hooks and so forth.
7
+ # Many of these configuration options can be set straight in your model.
8
+ Devise.setup do |config|
9
+ # The secret key used by Devise. Devise uses this key to generate
10
+ # random tokens. Changing this key will render invalid all existing
11
+ # confirmation, reset password and unlock tokens in the database.
12
+ # config.secret_key = '9443b88a35d00851d85f3d87bd8ba61298bf0ccb57b1971589140626f5a9da4351e8214811da0002f212e3bc107650e06c5097e63da74e6ffa092bc4a54a3f2e'
13
+
14
+ # ==> Mailer Configuration
15
+ # Configure the e-mail address which will be shown in Devise::Mailer,
16
+ # note that it will be overwritten if you use your own mailer class
17
+ # with default "from" parameter.
18
+ config.mailer_sender = 'no-reply@' + Rails.application.secrets.domain_name
19
+
20
+ # Configure the class responsible to send e-mails.
21
+ # config.mailer = 'Devise::Mailer'
22
+
23
+ # ==> ORM configuration
24
+ # Load and configure the ORM. Supports :active_record (default) and
25
+ # :mongoid (bson_ext recommended) by default. Other ORMs may be
26
+ # available as additional gems.
27
+ require 'devise/orm/active_record'
28
+
29
+ # ==> Configuration for any authentication mechanism
30
+ # Configure which keys are used when authenticating a user. The default is
31
+ # just :email. You can configure it to use [:username, :subdomain], so for
32
+ # authenticating a user, both parameters are required. Remember that those
33
+ # parameters are used only when authenticating and not when retrieving from
34
+ # session. If you need permissions, you should implement that in a before filter.
35
+ # You can also supply a hash where the value is a boolean determining whether
36
+ # or not authentication should be aborted when the value is not present.
37
+ # config.authentication_keys = [ :email ]
38
+
39
+ # Configure parameters from the request object used for authentication. Each entry
40
+ # given should be a request method and it will automatically be passed to the
41
+ # find_for_authentication method and considered in your model lookup. For instance,
42
+ # if you set :request_keys to [:subdomain], :subdomain will be used on authentication.
43
+ # The same considerations mentioned for authentication_keys also apply to request_keys.
44
+ # config.request_keys = []
45
+
46
+ # Configure which authentication keys should be case-insensitive.
47
+ # These keys will be downcased upon creating or modifying a user and when used
48
+ # to authenticate or find a user. Default is :email.
49
+ config.case_insensitive_keys = [ :email ]
50
+
51
+ # Configure which authentication keys should have whitespace stripped.
52
+ # These keys will have whitespace before and after removed upon creating or
53
+ # modifying a user and when used to authenticate or find a user. Default is :email.
54
+ config.strip_whitespace_keys = [ :email ]
55
+
56
+ # Tell if authentication through request.params is enabled. True by default.
57
+ # It can be set to an array that will enable params authentication only for the
58
+ # given strategies, for example, `config.params_authenticatable = [:database]` will
59
+ # enable it only for database (email + password) authentication.
60
+ # config.params_authenticatable = true
61
+
62
+ # Tell if authentication through HTTP Auth is enabled. False by default.
63
+ # It can be set to an array that will enable http authentication only for the
64
+ # given strategies, for example, `config.http_authenticatable = [:database]` will
65
+ # enable it only for database authentication. The supported strategies are:
66
+ # :database = Support basic authentication with authentication key + password
67
+ # config.http_authenticatable = false
68
+
69
+ # If 401 status code should be returned for AJAX requests. True by default.
70
+ # config.http_authenticatable_on_xhr = true
71
+
72
+ # The realm used in Http Basic Authentication. 'Application' by default.
73
+ # config.http_authentication_realm = 'Application'
74
+
75
+ # It will change confirmation, password recovery and other workflows
76
+ # to behave the same regardless if the e-mail provided was right or wrong.
77
+ # Does not affect registerable.
78
+ # config.paranoid = true
79
+
80
+ # By default Devise will store the user in session. You can skip storage for
81
+ # particular strategies by setting this option.
82
+ # Notice that if you are skipping storage for all authentication paths, you
83
+ # may want to disable generating routes to Devise's sessions controller by
84
+ # passing skip: :sessions to `devise_for` in your config/routes.rb
85
+ config.skip_session_storage = [:http_auth]
86
+
87
+ # By default, Devise cleans up the CSRF token on authentication to
88
+ # avoid CSRF token fixation attacks. This means that, when using AJAX
89
+ # requests for sign in and sign up, you need to get a new CSRF token
90
+ # from the server. You can disable this option at your own risk.
91
+ # config.clean_up_csrf_token_on_authentication = true
92
+
93
+ # ==> Configuration for :database_authenticatable
94
+ # For bcrypt, this is the cost for hashing the password and defaults to 10. If
95
+ # using other encryptors, it sets how many times you want the password re-encrypted.
96
+ #
97
+ # Limiting the stretches to just one in testing will increase the performance of
98
+ # your test suite dramatically. However, it is STRONGLY RECOMMENDED to not use
99
+ # a value less than 10 in other environments. Note that, for bcrypt (the default
100
+ # encryptor), the cost increases exponentially with the number of stretches (e.g.
101
+ # a value of 20 is already extremely slow: approx. 60 seconds for 1 calculation).
102
+ config.stretches = Rails.env.test? ? 1 : 10
103
+
104
+ # Setup a pepper to generate the encrypted password.
105
+ # config.pepper = '0070067faf6611d9d72133ff9b9a50d9142b12bdb0d4620f69e4bc68f9ec44384727587d593285397bd083e97da1e830c9e464e33ec811e7e3a77c111780b1e5'
106
+
107
+ # ==> Configuration for :invitable
108
+ # The period the generated invitation token is valid, after
109
+ # this period, the invited resource won't be able to accept the invitation.
110
+ # When invite_for is 0 (the default), the invitation won't expire.
111
+ # config.invite_for = 2.weeks
112
+
113
+ # Number of invitations users can send.
114
+ # - If invitation_limit is nil, there is no limit for invitations, users can
115
+ # send unlimited invitations, invitation_limit column is not used.
116
+ # - If invitation_limit is 0, users can't send invitations by default.
117
+ # - If invitation_limit n > 0, users can send n invitations.
118
+ # You can change invitation_limit column for some users so they can send more
119
+ # or less invitations, even with global invitation_limit = 0
120
+ # Default: nil
121
+ # config.invitation_limit = 5
122
+
123
+ # The key to be used to check existing users when sending an invitation
124
+ # and the regexp used to test it when validate_on_invite is not set.
125
+ # config.invite_key = {:email => /\A[^@]+@[^@]+\z/}
126
+ # config.invite_key = {:email => /\A[^@]+@[^@]+\z/, :username => nil}
127
+
128
+ # Flag that force a record to be valid before being actually invited
129
+ # Default: false
130
+ # config.validate_on_invite = true
131
+
132
+ # Resend invitation if user with invited status is invited again
133
+ # Default: true
134
+ # config.resend_invitation = false
135
+
136
+ # The class name of the inviting model. If this is nil,
137
+ # the #invited_by association is declared to be polymorphic.
138
+ # Default: nil
139
+ # config.invited_by_class_name = 'User'
140
+
141
+ # The column name used for counter_cache column. If this is nil,
142
+ # the #invited_by association is declared without counter_cache.
143
+ # Default: nil
144
+ # config.invited_by_counter_cache = :invitations_count
145
+
146
+ # ==> Configuration for :confirmable
147
+ # A period that the user is allowed to access the website even without
148
+ # confirming their account. For instance, if set to 2.days, the user will be
149
+ # able to access the website for two days without confirming their account,
150
+ # access will be blocked just in the third day. Default is 0.days, meaning
151
+ # the user cannot access the website without confirming their account.
152
+ # config.allow_unconfirmed_access_for = 2.days
153
+
154
+ # A period that the user is allowed to confirm their account before their
155
+ # token becomes invalid. For example, if set to 3.days, the user can confirm
156
+ # their account within 3 days after the mail was sent, but on the fourth day
157
+ # their account can't be confirmed with the token any more.
158
+ # Default is nil, meaning there is no restriction on how long a user can take
159
+ # before confirming their account.
160
+ # config.confirm_within = 3.days
161
+
162
+ # If true, requires any email changes to be confirmed (exactly the same way as
163
+ # initial account confirmation) to be applied. Requires additional unconfirmed_email
164
+ # db field (see migrations). Until confirmed, new email is stored in
165
+ # unconfirmed_email column, and copied to email column on successful confirmation.
166
+ config.reconfirmable = true
167
+
168
+ # Defines which key will be used when confirming an account
169
+ # config.confirmation_keys = [ :email ]
170
+
171
+ # ==> Configuration for :rememberable
172
+ # The time the user will be remembered without asking for credentials again.
173
+ # config.remember_for = 2.weeks
174
+
175
+ # Invalidates all the remember me tokens when the user signs out.
176
+ config.expire_all_remember_me_on_sign_out = true
177
+
178
+ # If true, extends the user's remember period when remembered via cookie.
179
+ # config.extend_remember_period = false
180
+
181
+ # Options to be passed to the created cookie. For instance, you can set
182
+ # secure: true in order to force SSL only cookies.
183
+ # config.rememberable_options = {}
184
+
185
+ # ==> Configuration for :validatable
186
+ # Range for password length.
187
+ config.password_length = 8..128
188
+
189
+ #
190
+ # zxcvbnable provides strength
191
+ config.min_password_score = 0
192
+
193
+ # Email regex used to validate email formats. It simply asserts that
194
+ # one (and only one) @ exists in the given string. This is mainly
195
+ # to give user feedback and not to assert the e-mail validity.
196
+ # config.email_regexp = /\A[^@]+@[^@]+\z/
197
+
198
+ # ==> Configuration for :timeoutable
199
+ # The time you want to timeout the user session without activity. After this
200
+ # time the user will be asked for credentials again. Default is 30 minutes.
201
+ # config.timeout_in = 30.minutes
202
+
203
+ # If true, expires auth token on session timeout.
204
+ # config.expire_auth_token_on_timeout = false
205
+
206
+ # ==> Configuration for :lockable
207
+ # Defines which strategy will be used to lock an account.
208
+ # :failed_attempts = Locks an account after a number of failed attempts to sign in.
209
+ # :none = No lock strategy. You should handle locking by yourself.
210
+ # config.lock_strategy = :failed_attempts
211
+
212
+ # Defines which key will be used when locking and unlocking an account
213
+ # config.unlock_keys = [ :email ]
214
+
215
+ # Defines which strategy will be used to unlock an account.
216
+ # :email = Sends an unlock link to the user email
217
+ # :time = Re-enables login after a certain amount of time (see :unlock_in below)
218
+ # :both = Enables both strategies
219
+ # :none = No unlock strategy. You should handle unlocking by yourself.
220
+ # config.unlock_strategy = :both
221
+
222
+ # Number of authentication tries before locking an account if lock_strategy
223
+ # is failed attempts.
224
+ # config.maximum_attempts = 20
225
+
226
+ # Time interval to unlock the account if :time is enabled as unlock_strategy.
227
+ # config.unlock_in = 1.hour
228
+
229
+ # Warn on the last attempt before the account is locked.
230
+ # config.last_attempt_warning = true
231
+
232
+ # ==> Configuration for :recoverable
233
+ #
234
+ # Defines which key will be used when recovering the password for an account
235
+ # config.reset_password_keys = [ :email ]
236
+
237
+ # Time interval you can reset your password with a reset password key.
238
+ # Don't put a too small interval or your users won't have the time to
239
+ # change their passwords.
240
+ config.reset_password_within = 6.hours
241
+
242
+ # ==> Configuration for :encryptable
243
+ # Allow you to use another encryption algorithm besides bcrypt (default). You can use
244
+ # :sha1, :sha512 or encryptors from others authentication tools as :clearance_sha1,
245
+ # :authlogic_sha512 (then you should set stretches above to 20 for default behavior)
246
+ # and :restful_authentication_sha1 (then you should set stretches to 10, and copy
247
+ # REST_AUTH_SITE_KEY to pepper).
248
+ #
249
+ # Require the `devise-encryptable` gem when using anything other than bcrypt
250
+ # config.encryptor = :sha512
251
+
252
+ # ==> Scopes configuration
253
+ # Turn scoped views on. Before rendering "sessions/new", it will first check for
254
+ # "users/sessions/new". It's turned off by default because it's slower if you
255
+ # are using only default views.
256
+ # config.scoped_views = false
257
+
258
+ # Configure the default scope given to Warden. By default it's the first
259
+ # devise role declared in your routes (usually :user).
260
+ # config.default_scope = :user
261
+
262
+ # Set this configuration to false if you want /users/sign_out to sign out
263
+ # only the current scope. By default, Devise signs out all scopes.
264
+ # config.sign_out_all_scopes = true
265
+
266
+ # ==> Navigation configuration
267
+ # Lists the formats that should be treated as navigational. Formats like
268
+ # :html, should redirect to the sign in page when the user does not have
269
+ # access, but formats like :xml or :json, should return 401.
270
+ #
271
+ # If you have any extra navigational formats, like :iphone or :mobile, you
272
+ # should add them to the navigational formats lists.
273
+ #
274
+ # The "*/*" below is required to match Internet Explorer requests.
275
+ # config.navigational_formats = ['*/*', :html]
276
+
277
+ # The default HTTP method used to sign out a resource. Default is :delete.
278
+ config.sign_out_via = :delete
279
+
280
+ # ==> OmniAuth
281
+ # Add a new OmniAuth provider. Check the wiki for more information on setting
282
+ # up on your models and hooks.
283
+ # config.omniauth :github, 'APP_ID', 'APP_SECRET', scope: 'user,public_repo'
284
+
285
+ # ==> Warden configuration
286
+ # If you want to use other strategies, that are not supported by Devise, or
287
+ # change the failure app, you can configure them inside the config.warden block.
288
+ #
289
+ # config.warden do |manager|
290
+ # manager.intercept_401 = false
291
+ # manager.default_strategies(scope: :user).unshift :some_external_strategy
292
+ # end
293
+
294
+ # ==> Mountable engine configurations
295
+ # When using Devise inside an engine, let's call it `MyEngine`, and this engine
296
+ # is mountable, there are some extra configurations to be taken into account.
297
+ # The following options are available, assuming the engine is mounted as:
298
+ #
299
+ # mount MyEngine, at: '/my_engine'
300
+ #
301
+ # The router that invoked `devise_for`, in the example above, would be:
302
+ # config.router_name = :my_engine
303
+ #
304
+ # When using omniauth, Devise cannot automatically set Omniauth path,
305
+ # so you need to do it manually. For the users scope, it would be:
306
+ # config.omniauth_path_prefix = '/my_engine/users/auth'
307
+
308
+ # ==> CAS Authenticatable
309
+ # config.cas_base_url = "https://localhost:3100"
310
+
311
+ # you can override these if you need to, but cas_base_url is usually enough
312
+ # config.cas_login_url = "https://cas.myorganization.com/login"
313
+ # config.cas_logout_url = "https://cas.myorganization.com/logout"
314
+ # config.cas_validate_url = "https://cas.myorganization.com/serviceValidate"
315
+
316
+ # The CAS specification allows for the passing of a follow URL to be displayed when
317
+ # a user logs out on the CAS server. RubyCAS-Server also supports redirecting to a
318
+ # URL via the destination param. Set either of these urls and specify either nil,
319
+ # 'destination' or 'follow' as the logout_url_param. If the urls are blank but
320
+ # logout_url_param is set, a default will be detected for the service.
321
+ # config.cas_destination_url = 'https://cas.myorganization.com'
322
+ # config.cas_follow_url = 'https://cas.myorganization.com'
323
+ # config.cas_logout_url_param = nil
324
+
325
+ # You can specify the name of the destination argument with the following option.
326
+ # e.g. the following option will change it from 'destination' to 'url'
327
+ # config.cas_destination_logout_param_name = 'url'
328
+
329
+ # By default, devise_cas_authenticatable will create users. If you would rather
330
+ # require user records to already exist locally before they can authenticate via
331
+ # CAS, uncomment the following line.
332
+ # config.cas_create_user = false
333
+
334
+ # You can enable Single Sign Out, which by default is disabled.
335
+ # config.cas_enable_single_sign_out = true
336
+
337
+ # If you don't want to use the username returned from your CAS server as the unique
338
+ # identifier, but some other field passed in cas_extra_attributes, you can specify
339
+ # the field name here.
340
+ # config.cas_user_identifier = nil
341
+
342
+ # If you want to use the Devise Timeoutable module with single sign out,
343
+ # uncommenting this will redirect timeouts to the logout url, so that the CAS can
344
+ # take care of signing out the other serviced applocations. Note that each
345
+ # application manages timeouts independently, so one application timing out will
346
+ # kill the session on all applications serviced by the CAS.
347
+ # config.warden do |manager|
348
+ # manager.failure_app = DeviseCasAuthenticatable::SingleSignOut::WardenFailureApp
349
+ # end
350
+
351
+ # If you need to specify some extra configs for rubycas-client, you can do this via:
352
+ # config.cas_client_config_options = {
353
+ # logger: Rails.logger
354
+ # }
355
+
356
+
357
+
358
+
359
+
360
+ end
@@ -0,0 +1,17 @@
1
+ # module DevisePermittedParameters
2
+ # extend ActiveSupport::Concern
3
+ #
4
+ # included do
5
+ # before_filter :configure_permitted_parameters
6
+ # end
7
+ #
8
+ # protected
9
+ #
10
+ # def configure_permitted_parameters
11
+ # devise_parameter_sanitizer.for(:sign_up) << :name
12
+ # devise_parameter_sanitizer.for(:account_update) << :name
13
+ # end
14
+ #
15
+ # end
16
+ #
17
+ # DeviseController.send :include, DevisePermittedParameters
@@ -0,0 +1,58 @@
1
+ da:
2
+ devise:
3
+ confirmations:
4
+ confirmed: "Din konto er blevet bekræftet."
5
+ send_instructions: "Om få minutter vil du modtage en email med instruktioner om aktivering af din konto."
6
+ send_paranoid_instructions: "Hvis din e-mail adresse findes i vores database vil du modtage en e-mail med instruktioner om hvordan du kan aktivere din konto."
7
+ failure:
8
+ already_authenticated: "Du er allerede logget ind."
9
+ inactive: "Din konto er ikke bekræftet."
10
+ invalid: "Email eller password er ikke gyldig."
11
+ locked: "Din konto er låst."
12
+ last_attempt: "Du har et mere forsøg inden din konto vil blive låst."
13
+ not_found_in_database: "Email eller password er ikke gyldig."
14
+ timeout: "Din session er udløbet. Log ind igen for at kunne fortsætte."
15
+ unauthenticated: "Du skal logge ind for at kunne fortsætte."
16
+ unconfirmed: "Du skal bekræfte din konto for at kunne fortsætte."
17
+ mailer:
18
+ confirmation_instructions:
19
+ subject: "Bekræft din konto"
20
+ reset_password_instructions:
21
+ subject: "Nulstilling af password"
22
+ unlock_instructions:
23
+ subject: "Genåbning af konto"
24
+ omniauth_callbacks:
25
+ failure: "Du kunne ikke logges ind med din %{kind} konto: \"%{reason}\"."
26
+ success: "Du er nu logget ind med din %{kind} konto."
27
+ passwords:
28
+ no_token: "Du har kun adgang til denne side via link fra en email ang. nulstilling af password. Hvis du kommer fra denne email skal du sikre dig at du bruge hele URL'en."
29
+ send_instructions: "Du vil om et øjeblik modtage en email vedrørende nulstilling af password."
30
+ send_paranoid_instructions: "Hvis din e-mail adresse findes i vores database vil du modtage et link til hvor du kan nulstille dit password."
31
+ updated: "Dit password er ændret og du er nu logget ind."
32
+ updated_not_active: "Dit password er ændret."
33
+ registrations:
34
+ destroyed: "Farvel. Din konto er nu lukket."
35
+ signed_up: "Din registrering er godkendt."
36
+ signed_up_but_inactive: "Din registrering er godkendt, men vi kunne ikke logge dig ind, da din konto endnu ikke er blevet aktiveret."
37
+ signed_up_but_locked: "Din registrering er godkendt, men vi kunne ikke logge dig ind, da din konto er låst."
38
+ signed_up_but_unconfirmed: "En besked med bekræftelses link er blevet sendt til din email adresse. Åbn venligst linket for at aktivere din konto."
39
+ update_needs_confirmation: "Din konto er blevet opdateret, men vi er nødt til at bekræfte din nye email. Check venligst din mail og klik på bekræftelses linket for at bekræfte din nye email."
40
+ updated: "Din konto er opdateret."
41
+ sessions:
42
+ signed_in: "Du er nu logget ind."
43
+ signed_out: "Du er nu logget ud."
44
+ unlocks:
45
+ send_instructions: 'Om få minutter vil du modtage en email med instruktioner om genåbning af din konto.'
46
+ send_paranoid_instructions: 'Hvis din e-mail adresse findes i vores database vil du modtage in e-mail med instutioner om hvordan du kan låse din konto op.'
47
+ unlocked: 'Din konto er genåbnet og du er nu logget ind.'
48
+ errors:
49
+ messages:
50
+ weak_password: "er ikke stærk nok! Overvej at tilføje et ciffer, et symbol - eller flere bogstaver for at hærde det!"
51
+ already_confirmed: "er allerede bekræftet"
52
+ confirmation_period_expired: "skal bekræftes inden %{period}, anmod venligst om en ny"
53
+ expired: "er udløbet. Vær venlig at bede om en ny"
54
+ not_found: "ikke fundet"
55
+ not_locked: "var ikke låst"
56
+ not_saved:
57
+ one: "1 fejl medførte at denne %{resource} ikke kunne gemmes:"
58
+ other: "%{count} fejl medførte at denne %{resource} ikke kunne gemmes:"
@@ -0,0 +1,61 @@
1
+ # Additional translations at https://github.com/plataformatec/devise/wiki/I18n
2
+
3
+ en:
4
+ devise:
5
+ confirmations:
6
+ confirmed: "Your email address has been successfully confirmed."
7
+ send_instructions: "You will receive an email with instructions for how to confirm your email address in a few minutes."
8
+ send_paranoid_instructions: "If your email address exists in our database, you will receive an email with instructions for how to confirm your email address 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 %{authentication_keys} or password."
13
+ locked: "Your account is locked."
14
+ last_attempt: "You have one more attempt before your account is locked."
15
+ not_found_in_database: "Invalid %{authentication_keys} 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 email address 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 has been changed successfully. You are now signed in."
34
+ updated_not_active: "Your password has been changed successfully."
35
+ registrations:
36
+ destroyed: "Bye! Your account has been 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 follow 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 follow the confirm link to confirm your new email address."
42
+ updated: "Your account has been updated successfully."
43
+ sessions:
44
+ signed_in: "Signed in successfully."
45
+ signed_out: "Signed out successfully."
46
+ already_signed_out: "Signed out successfully."
47
+ unlocks:
48
+ send_instructions: "You will receive an email with instructions for how to unlock your account in a few minutes."
49
+ send_paranoid_instructions: "If your account exists, you will receive an email with instructions for how to unlock it in a few minutes."
50
+ unlocked: "Your account has been unlocked successfully. Please sign in to continue."
51
+ errors:
52
+ messages:
53
+ weak_password: "is not strong enough. Consider adding a number, symbols or more letters to make it stronger."
54
+ already_confirmed: "was already confirmed, please try signing in"
55
+ confirmation_period_expired: "needs to be confirmed within %{period}, please request a new one"
56
+ expired: "has expired, please request a new one"
57
+ not_found: "not found"
58
+ not_locked: "was not locked"
59
+ not_saved:
60
+ one: "1 error prohibited this %{resource} from being saved:"
61
+ other: "%{count} errors prohibited this %{resource} from being saved:"
@@ -0,0 +1,26 @@
1
+ da:
2
+ devise:
3
+ failure:
4
+ invited: "Du mangler at acceptere din invitation! Se den i din indbakke"
5
+ missing_data: "Du skal udfylde navn og email med korrekte oplysninger!"
6
+ invitations:
7
+ send_instructions: "En email med en invitation til at logge på er blevet sendt til %{email}."
8
+ invitation_token_invalid: "Du har anvendt en invitation som ikke er gyldig!"
9
+ updated: "Din adgangskode blev gemt korrekt! Du er nu logget ind!"
10
+ no_invitations_remaining: "No invitations remaining"
11
+ invitation_removed: "Your invitation was removed."
12
+ new:
13
+ header: "Send invitation"
14
+ submit_button: "Send an invitation"
15
+ edit:
16
+ title: "Invitation"
17
+ header: "Herligt at du tog imod invitationen!"
18
+ instructions: 'Nu mangler du bare at vælge en adgangskode for at du er igang!'
19
+ submit_button: "Gem"
20
+ mailer:
21
+ invitation_instructions:
22
+ subject: "Invitation instructions"
23
+ hello: "Hello %{email}"
24
+ someone_invited_you: "Someone has invited you to %{url}, you can accept it through the link below."
25
+ accept: "Accept invitation"
26
+ ignore: "If you don't want to accept the invitation, please ignore this email.<br />Your account won't be created until you access the link above and set your password."
@@ -0,0 +1,23 @@
1
+ en:
2
+ devise:
3
+ failure:
4
+ invited: "You have a pending invitation, accept it to finish creating your account."
5
+ invitations:
6
+ send_instructions: "An invitation email has been sent to %{email}."
7
+ invitation_token_invalid: "The invitation token provided is not valid!"
8
+ updated: "Your password was set successfully. You are now signed in."
9
+ no_invitations_remaining: "No invitations remaining"
10
+ invitation_removed: "Your invitation was removed."
11
+ new:
12
+ header: "Send invitation"
13
+ submit_button: "Send an invitation"
14
+ edit:
15
+ header: "Set your password"
16
+ submit_button: "Set my password"
17
+ mailer:
18
+ invitation_instructions:
19
+ subject: "Invitation instructions"
20
+ hello: "Hello %{email}"
21
+ someone_invited_you: "Someone has invited you to %{url}, you can accept it through the link below."
22
+ accept: "Accept invitation"
23
+ ignore: "If you don't want to accept the invitation, please ignore this email.<br />Your account won't be created until you access the link above and set your password."
data/config/routes.rb ADDED
@@ -0,0 +1,51 @@
1
+ Rails.application.routes.draw do
2
+
3
+ devise_for :users, :controllers => { :invitations => 'users/invitations' }
4
+
5
+
6
+ concern :printing do
7
+ member do
8
+ get 'print'
9
+ end
10
+ collection do
11
+ get 'print'
12
+ end
13
+ end
14
+
15
+ # prefer and defer elements (setting preferred true|false)
16
+ concern :preferring do
17
+ member do
18
+ get 'prefer'
19
+ get 'defer'
20
+ end
21
+ end
22
+
23
+ # attach and detach the route in question to its 'parent'
24
+ concern :attaching do
25
+ member do
26
+ get 'attach'
27
+ get 'detach'
28
+ end
29
+ end
30
+
31
+ # activate and passify the route in question
32
+ concern :activating do
33
+ member do
34
+ get 'activate'
35
+ get 'deactivate'
36
+ end
37
+ end
38
+
39
+
40
+ scope '/admin' do
41
+ resources :users, concerns: [:activating, :attaching, :printing] do
42
+ member do
43
+ get 'confirm'
44
+ end
45
+ resources :printers, concerns: [:preferring, :activating, :attaching, :printing]
46
+ end
47
+ end
48
+
49
+
50
+
51
+ end
@@ -0,0 +1,26 @@
1
+ require 'rails/generators'
2
+ require 'rails/generators/migration'
3
+
4
+ module OxenUser
5
+ module Generators
6
+ class AccountGenerator < Rails::Generators::Base
7
+ include Rails::Generators::Migration
8
+ def self.source_root
9
+ @source_root ||= File.join(File.dirname(__FILE__), 'templates')
10
+ end
11
+
12
+ def self.next_migration_number(dirname)
13
+ if ActiveRecord::Base.timestamped_migrations
14
+ Time.new.utc.strftime("%Y%m%d%H%M%S")
15
+ else
16
+ "%.3d" % (current_migration_number(dirname) + 1)
17
+ end
18
+ end
19
+
20
+ def create_migration_file
21
+ migration_template 'user.rb', 'db/migrate/create_users.rb'
22
+ migration_template 'user_permission.rb', 'db/migrate/create_user_permissions.rb'
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,10 @@
1
+ class CreateAccounts < ActiveRecord::Migration
2
+ def change
3
+ create_table :accounts do |t|
4
+ t.string :name
5
+ t.boolean :active
6
+
7
+ t.timestamps null: false
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,14 @@
1
+ class CreateUserPermissions < ActiveRecord::Migration
2
+ def change
3
+ create_table :user_permissions do |t|
4
+ t.references :account, index: true
5
+ t.references :user, index: true
6
+ t.string :email
7
+ t.string :permissions
8
+
9
+ t.timestamps null: false
10
+ end
11
+ add_foreign_key :user_permissions, :accounts
12
+ add_foreign_key :user_permissions, :users
13
+ end
14
+ end
@@ -0,0 +1,17 @@
1
+ module OxenUser
2
+ class Engine < ::Rails::Engine
3
+ config.generators do |g|
4
+ g.test_framework :rspec,
5
+ :fixture => false,
6
+ :fixtures => true,
7
+ :view_specs => false,
8
+ :helper_specs => false,
9
+ :routing_specs => false,
10
+ :controller_specs => true,
11
+ :request_specs => true
12
+ g.fixture_replacement :factory_girl, :dir => "spec/factories"
13
+ g.assets false
14
+ g.helper false
15
+ end
16
+ end
17
+ end