polivalente 0.2.0 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9f64f29b6f512a3d0a252d028648066293adf4ed36a56c4b2b19924e8f529e89
4
- data.tar.gz: 044f17f768a0c1132c182257dfc7a6ea6b5a825b22df8772751f82f5227e6984
3
+ metadata.gz: 55ce917df3ed0705a4fee15d90e46ed49968d603b0345169248eb839b6f2b5d1
4
+ data.tar.gz: c27b1c1ccd2252a77574802618ea0e1ef796b09b40bd992908b7a114ec4b4d46
5
5
  SHA512:
6
- metadata.gz: b20d5aca11a7dfe9445df9256f86e9ff7cc7b7e7f4e8b5dc2c0ba2cc163adfc68f9ba9d396eee704c9102d777351dde8a403d7d13595cb06a0bfdbdf3fddb9ec
7
- data.tar.gz: c609c2b70bce6a1448dc8b69b923c0424eef481d6214922bef626276cccf571464162bd65080ee6136726dc9dd0270faa8c8543e314e253bb82f44cca6501605
6
+ metadata.gz: 3d9bc8fc6774a833c6ecb8c3da88bc0b6afd155bfd5a19887569963945a0d6944b791429a5ad0610c58b7bf2d54a906f63582509f44e254fbe480f103c6b09ff
7
+ data.tar.gz: 0fe5a86a732c6857dea84f17614dc4431e69e1ff31f3be5ca0d1794192695b8fe24cbec6a2736743a5a5978317d05c2fdad15a42dcf72ebf006a8cd130d50feb
data/README.md CHANGED
@@ -1,5 +1,5 @@
1
1
  # Polivalente
2
- Short description and motivation.
2
+ Reusable generic features for Rails applications
3
3
 
4
4
  ## Usage
5
5
  How to use my plugin.
@@ -21,11 +21,30 @@ Or install it yourself as:
21
21
  $ gem install polivalente
22
22
  ```
23
23
 
24
- Copy migrations:
24
+ Installation (copies migrations and [initializer](lib/generators/polivalente/polivalente.rb)):
25
25
  ```bash
26
26
  $ rails g polivalente:install
27
27
  ```
28
28
 
29
+ Copy default `User` model:
30
+ ```bash
31
+ $ rails g polivalente:user
32
+ ```
33
+
34
+ Alternatively, set the `user_class` in `config`:
35
+ ```ruby
36
+ Polivalente.configure do |config|
37
+ # ...
38
+ config.user_class = "MyUser"
39
+ end
40
+ ```
41
+
42
+ Setup `devise`:
43
+ ```bash
44
+ $ rails g devise:install
45
+ ```
46
+
47
+
29
48
  ## Contributing
30
49
  Contribution directions go here.
31
50
 
@@ -1,7 +1,4 @@
1
1
  module Polivalente
2
- class ApplicationController < ActionController::Base
3
- before_action do
4
- ActiveStorage::Current.url_options = { host: "localhost:3000" }
5
- end
2
+ class ApplicationController < Polivalente.config.base_controller.constantize
6
3
  end
7
4
  end
@@ -8,7 +8,9 @@ module Polivalente
8
8
  end
9
9
 
10
10
  def users
11
- @users = User.all.latest
11
+ user_class = Polivalente.config.user_class.constantize
12
+
13
+ @users = user_class.all.latest
12
14
  render json: @users, status: 200
13
15
  end
14
16
 
@@ -1,5 +1,5 @@
1
1
  module Polivalente
2
- class PingController < ActionController::Base
2
+ class PingController < ApplicationController
3
3
  def index
4
4
  render json: { status: 'OK' }, status: :ok
5
5
  end
@@ -10,7 +10,7 @@ module Polivalente
10
10
  self.table_name = :trash
11
11
 
12
12
  # Stale records are those that have been in the trash for `T` amount of time
13
- scope :stale, -> { where("created_at <= ?", Time.zone.now - Polivalente::trash_ttl) }
13
+ scope :stale, -> { where("created_at <= ?", Time.zone.now - Polivalente.config.trash_ttl) }
14
14
 
15
15
  def self.clean_stale!
16
16
  stale.destroy_all
@@ -25,7 +25,7 @@ module Polivalente
25
25
  # Schedule the deletion of this and parent record
26
26
  def schedule_deletion
27
27
  CleanTrashJob
28
- .set(wait_until: Polivalente::trash_ttl.from_now)
28
+ .set(wait_until: Polivalente.config.trash_ttl.from_now)
29
29
  .perform_later(self)
30
30
  end
31
31
  end
@@ -0,0 +1,79 @@
1
+ en:
2
+ devise:
3
+ confirmations:
4
+ confirmed: "Your email address has been successfully confirmed."
5
+ send_instructions: "You will receive an email with instructions for how to confirm your email address in a few minutes."
6
+ 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."
7
+ failure:
8
+ already_authenticated: "You are already signed in."
9
+ inactive: "Your account is not activated yet."
10
+ invalid: "Invalid %{authentication_keys} or password."
11
+ locked: "Your account is locked."
12
+ last_attempt: "You have one more attempt before your account is locked."
13
+ not_found_in_database: "Invalid %{authentication_keys} or password."
14
+ timeout: "Your session expired. Please sign in again to continue."
15
+ unauthenticated: "You need to sign in or sign up before continuing."
16
+ unconfirmed: "You have to confirm your email address before continuing."
17
+ mailer:
18
+ confirmation_instructions:
19
+ subject: "Confirmation instructions"
20
+ reset_password_instructions:
21
+ subject: "Reset password instructions"
22
+ unlock_instructions:
23
+ subject: "Unlock instructions"
24
+ email_changed:
25
+ subject: "Email Changed"
26
+ password_change:
27
+ subject: "Password Changed"
28
+ omniauth_callbacks:
29
+ failure: "Could not authenticate you from %{kind} because \"%{reason}\"."
30
+ success: "Successfully authenticated from %{kind} account."
31
+ passwords:
32
+ 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."
33
+ send_instructions: "You will receive an email with instructions on how to reset your password in a few minutes."
34
+ 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."
35
+ updated: "Your password has been changed successfully. You are now signed in."
36
+ updated_not_active: "Your password has been changed successfully."
37
+ registrations:
38
+ destroyed: "Bye! Your account has been successfully cancelled. We hope to see you again soon."
39
+ signed_up: "Welcome! You have signed up successfully."
40
+ signed_up_but_inactive: "You have signed up successfully. However, we could not sign you in because your account is not yet activated."
41
+ signed_up_but_locked: "You have signed up successfully. However, we could not sign you in because your account is locked."
42
+ 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."
43
+ update_needs_confirmation: "You updated your account successfully, but we need to verify your new email address. Please check your email and follow the confirmation link to confirm your new email address."
44
+ updated: "Your account has been updated successfully."
45
+ updated_but_not_signed_in: "Your account has been updated successfully, but since your password was changed, you need to sign in again."
46
+ sessions:
47
+ signed_in: "Signed in successfully."
48
+ signed_out: "Signed out successfully."
49
+ already_signed_out: "Signed out successfully."
50
+ shared:
51
+ links:
52
+ back:
53
+ didn_t_receive_confirmation_instructions: Didn't receive confirmation instructions?
54
+ didn_t_receive_unlock_instructions: Didn't receive unlock instructions?
55
+ forgot_your_password: Forgot your password?
56
+ sign_in: Sign in
57
+ sign_in_with_provider: Sign in with %{provider}
58
+ sign_up: Sign up
59
+ unlocks:
60
+ send_instructions: "You will receive an email with instructions for how to unlock your account in a few minutes."
61
+ send_paranoid_instructions: "If your account exists, you will receive an email with instructions for how to unlock it in a few minutes."
62
+ unlocked: "Your account has been unlocked successfully. Please sign in to continue."
63
+ errors:
64
+ messages:
65
+ already_confirmed: "was already confirmed, please try signing in"
66
+ confirmation_period_expired: "needs to be confirmed within %{period}, please request a new one"
67
+ expired: "has expired, please request a new one"
68
+ not_found: "not found"
69
+ not_locked: "was not locked"
70
+ not_saved:
71
+ one: "1 error prohibited this %{resource} from being saved:"
72
+ other: "%{count} errors prohibited this %{resource} from being saved:"
73
+ configuration: "Application Settings"
74
+ current_locale: "Current Locale"
75
+ available_locales: "Available locales"
76
+ trash:
77
+ time_to_live: "Trash TTL"
78
+ key: "key"
79
+ value: "value"
@@ -0,0 +1,111 @@
1
+ es:
2
+ devise:
3
+ confirmations:
4
+ confirmed: Tu cuenta ha sido confirmada satisfactoriamente.
5
+ new:
6
+ resend_confirmation_instructions: Reenviar instrucciones de confirmación
7
+ send_instructions: Vas a recibir un correo con instrucciones sobre cómo confirmar tu cuenta en unos minutos.
8
+ send_paranoid_instructions: Si tu correo existe en nuestra base de datos, en unos minutos recibirás un correo con instrucciones sobre cómo confirmar tu cuenta.
9
+ failure:
10
+ already_authenticated: Ya has iniciado sesión.
11
+ inactive: Tu cuenta aún no ha sido activada.
12
+ invalid: Email o contraseña no válidos.
13
+ last_attempt: Tienes un intento más antes de que tu cuenta sea bloqueada.
14
+ locked: Tu cuenta está bloqueada.
15
+ not_found_in_database: Email o contraseña no válidos.
16
+ timeout: Tu sesión expiró. Por favor, inicia sesión nuevamente para continuar.
17
+ unauthenticated: Tienes que iniciar sesión o registrarte para poder continuar.
18
+ unconfirmed: Tienes que confirmar tu cuenta para poder continuar.
19
+ mailer:
20
+ confirmation_instructions:
21
+ action: Confirmar mi cuenta
22
+ greeting: "¡Bienvenido %{recipient}!"
23
+ instruction: 'Usted puede confirmar el correo electrónico de su cuenta a través de este enlace:'
24
+ subject: Instrucciones de confirmación
25
+ reset_password_instructions:
26
+ action: Cambiar mi contraseña
27
+ greeting: "¡Hola %{recipient}!"
28
+ instruction: Alguien ha solicitado un enlace para cambiar su contraseña, lo que se puede realizar a través del siguiente enlace.
29
+ instruction_2: Si usted no lo ha solicitado, por favor ignore este correo electrónico.
30
+ instruction_3: Su contraseña no será cambiada hasta que usted acceda el enlace y cree uno nuevo.
31
+ subject: Instrucciones de recuperación de contraseña
32
+ unlock_instructions:
33
+ action: Desbloquear mi cuenta
34
+ greeting: "¡Hola %{recipient}!"
35
+ instruction: 'Haga click en el siguiente enlace para desbloquear su cuenta:'
36
+ message: Su cuenta ha sido bloqueada debido a una cantidad excesiva de intentos infructuosos para ingresar.
37
+ subject: Instrucciones para desbloquear
38
+ omniauth_callbacks:
39
+ failure: No has sido autorizado en la cuenta %{kind} porque "%{reason}".
40
+ success: Has sido autorizado satisfactoriamente en la cuenta %{kind}.
41
+ passwords:
42
+ edit:
43
+ change_my_password: Cambiar mi contraseña
44
+ change_your_password: Cambie su contraseña
45
+ confirm_new_password: Confirme la nueva contraseña
46
+ new_password: Nueva contraseña
47
+ new:
48
+ forgot_your_password: "¿Ha olvidado su contraseña?"
49
+ send_me_reset_password_instructions: Envíeme las instrucciones para resetear mi contraseña
50
+ no_token: No puedes acceder a esta página si no es a través de un enlace para resetear tu contraseña. Si has llegado hasta aquí desde el email para resetear tu contraseña, por favor asegúrate de que la URL introducida está completa.
51
+ send_instructions: Recibirás un correo con instrucciones sobre cómo resetear tu contraseña en unos pocos minutos.
52
+ send_paranoid_instructions: Si tu correo existe en nuestra base de datos, recibirás un correo con instrucciones sobre cómo resetear tu contraseña en tu bandeja de entrada.
53
+ updated: Se ha cambiado tu contraseña. Ya iniciaste sesión.
54
+ updated_not_active: Tu contraseña fue cambiada.
55
+ registrations:
56
+ destroyed: Fue grato tenerte con nosotros. Tu cuenta fue cancelada.
57
+ edit:
58
+ are_you_sure: "¿Está usted seguro?"
59
+ cancel_my_account: Anular mi cuenta
60
+ currently_waiting_confirmation_for_email: 'Actualmente esperando la confirmacion de: %{email} '
61
+ leave_blank_if_you_don_t_want_to_change_it: dejar en blanco si no desea cambiarlo
62
+ title: Editar %{resource}
63
+ unhappy: Infeliz
64
+ update: Actualizar
65
+ we_need_your_current_password_to_confirm_your_changes: necesitamos su contraseña actual para confirmar los cambios
66
+ new:
67
+ sign_up: Registrarse
68
+ signed_up: Bienvenido. Tu cuenta fue creada.
69
+ signed_up_but_inactive: Tu cuenta ha sido creada correctamente. Sin embargo, no hemos podido iniciar la sesión porque tu cuenta aún no está activada.
70
+ signed_up_but_locked: Tu cuenta ha sido creada correctamente. Sin embargo, no hemos podido iniciar la sesión porque que tu cuenta está bloqueada.
71
+ signed_up_but_unconfirmed: Se ha enviado un mensaje con un enlace de confirmación a tu correo electrónico. Abre el enlace para activar tu cuenta.
72
+ update_needs_confirmation: Has actualizado tu cuenta correctamente, pero es necesario confirmar tu nuevo correo electrónico. Por favor, comprueba tu correo y sigue el enlace de confirmación para finalizar la comprobación del nuevo correo eletrónico.
73
+ updated: Tu cuenta se ha actualizada.
74
+ sessions:
75
+ already_signed_out: Sesión finalizada.
76
+ new:
77
+ sign_in: Iniciar sesión
78
+ signed_in: Sesión iniciada.
79
+ signed_out: Sesión finalizada.
80
+ shared:
81
+ links:
82
+ back: Atrás
83
+ didn_t_receive_confirmation_instructions: "¿No ha recibido las instrucciones de confirmación?"
84
+ didn_t_receive_unlock_instructions: "¿No ha recibido instrucciones para desbloquear?"
85
+ forgot_your_password: "¿Ha olvidado su contraseña?"
86
+ sign_in: Iniciar sesión
87
+ sign_in_with_provider: Iniciar sesión con %{provider}
88
+ sign_up: Registrarse
89
+ unlocks:
90
+ new:
91
+ resend_unlock_instructions: Reenviar instrucciones para desbloquear
92
+ send_instructions: Vas a recibir instrucciones para desbloquear tu cuenta en unos pocos minutos.
93
+ send_paranoid_instructions: Si tu cuenta existe, vas a recibir instrucciones para desbloquear tu cuenta en unos pocos minutos.
94
+ unlocked: Tu cuenta ha sido desbloqueada. Ya puedes iniciar sesión.
95
+ errors:
96
+ messages:
97
+ already_confirmed: ya ha sido confirmada, por favor intenta iniciar sesión
98
+ confirmation_period_expired: necesita confirmarse dentro de %{period}, por favor solicita una nueva
99
+ expired: ha expirado, por favor solicita una nueva
100
+ not_found: no se ha encontrado
101
+ not_locked: no estaba bloqueada
102
+ not_saved:
103
+ one: 'Ocurrió un error al tratar de guardar %{resource}:'
104
+ other: 'Ocurrieron %{count} errores al tratar de guardar %{resource}:'
105
+ configuration: "Configuración"
106
+ current_locale: "Local atual"
107
+ available_locales: "Locales disponibles"
108
+ trash:
109
+ time_to_live: "Duración de basura"
110
+ key: "llave"
111
+ value: "valor"
@@ -0,0 +1,111 @@
1
+ fr:
2
+ devise:
3
+ confirmations:
4
+ confirmed: Votre compte a été confirmé avec succès.
5
+ new:
6
+ resend_confirmation_instructions: Renvoyer les instructions de confirmation
7
+ send_instructions: Vous allez recevoir sous quelques minutes un email comportant des instructions pour confirmer votre compte.
8
+ send_paranoid_instructions: Si votre email existe sur notre base de données, vous recevrez sous quelques minutes un message avec des instructions pour confirmer votre compte.
9
+ failure:
10
+ already_authenticated: Vous êtes déjà connecté(e).
11
+ inactive: Votre compte n’est pas encore activé.
12
+ invalid: Email ou mot de passe incorrect.
13
+ last_attempt: Il vous reste une chance avant que votre compte soit bloqué.
14
+ locked: Votre compte est verrouillé.
15
+ not_found_in_database: Email ou mot de passe incorrect.
16
+ timeout: Votre session est périmée, veuillez vous reconnecter pour continuer.
17
+ unauthenticated: Vous devez vous connecter ou vous enregistrer pour continuer.
18
+ unconfirmed: Vous devez confirmer votre compte par email.
19
+ mailer:
20
+ confirmation_instructions:
21
+ action: Confirmer mon email
22
+ greeting: Bienvenue %{recipient}!
23
+ instruction: 'Vous pouvez confirmer votre email grâce au lien ci-dessous:'
24
+ subject: Instructions de confirmation
25
+ reset_password_instructions:
26
+ action: Changer mon mot de passe
27
+ greeting: Bonjour %{recipient}!
28
+ instruction: "Quelqu'un a demandé un lien pour changer votre mot de passe, le voici :"
29
+ instruction_2: "Si vous n'avez pas émis cette demande, merci d'ignorer ce email."
30
+ instruction_3: Votre mot de passe ne changera pas tant que vous n'aurez pas cliqué sur ce lien et renseigné un nouveau mot de passe.
31
+ subject: Instructions pour changer de mot de passe
32
+ unlock_instructions:
33
+ action: Débloquer mon compte
34
+ greeting: Bonjour %{recipient}!
35
+ instruction: 'Suivez ce lien pour débloquer votre compte:'
36
+ message: Votre compte a été bloqué suite à un nombre d'essais de connexions manquées trop important
37
+ subject: Instructions pour déverrouiller le compte
38
+ omniauth_callbacks:
39
+ failure: 'Nous ne pouvons pas vous authentifier depuis %{kind} pour la raison suivante : ''%{reason}''.'
40
+ success: Autorisé avec succès par votre compte %{kind}.
41
+ passwords:
42
+ edit:
43
+ change_my_password: Changer mon mot de passe
44
+ change_your_password: Changer votre mot de passe
45
+ confirm_new_password: Confirmez votre nouveau mot de passe
46
+ new_password: Nouveau mot de passe
47
+ new:
48
+ forgot_your_password: Mot de passe oublié ?
49
+ send_me_reset_password_instructions: Envoyez-moi des instructions pour réinitialiser mon mot de passe
50
+ no_token: "Vous ne pouvez pas accéder à cette page si vous n’y accédez pas depuis un email de réinitialisation de mot de passe. Si vous venez en effet d’un tel email, vérifiez que vous avez copié l’adresse URL en entier."
51
+ send_instructions: Vous allez recevoir sous quelques minutes un email vous indiquant comment réinitialiser votre mot de passe.
52
+ send_paranoid_instructions: Si votre email existe dans notre base de données, vous recevrez un lien vous permettant de récupérer votre mot de passe.
53
+ updated: Votre mot de passe a été modifié avec succès. Vous êtes maintenant connecté(e).
54
+ updated_not_active: Votre mot de passe a été modifié avec succès.
55
+ registrations:
56
+ destroyed: Au revoir ! Votre compte a été supprimé avec succès. Nous espérons vous revoir bientôt.
57
+ edit:
58
+ are_you_sure: "Êtes-vous sûr ?"
59
+ cancel_my_account: Supprimer mon compte
60
+ currently_waiting_confirmation_for_email: 'Confirmation en attente pour: %{email}'
61
+ leave_blank_if_you_don_t_want_to_change_it: laissez ce champ vide pour le laisser inchangé
62
+ title: "Éditer %{resource}"
63
+ unhappy: 'Pas content '
64
+ update: Modifier
65
+ we_need_your_current_password_to_confirm_your_changes: nous avons besoin de votre mot de passe actuel pour valider ces modifications
66
+ new:
67
+ sign_up: Inscription
68
+ signed_up: Bienvenue ! Vous vous êtes enregistré(e) avec succès.
69
+ signed_up_but_inactive: "Vous vous êtes enregistré(e) avec succès. Cependant, nous n’avons pas pu vous connecter car votre compte n’a pas encore été activé."
70
+ signed_up_but_locked: "Vous vous êtes enregistré(e) avec succès. Cependant, nous n’avons pas pu vous connecter car votre compte est verrouillé."
71
+ signed_up_but_unconfirmed: "Un message avec un lien de confirmation vous a été envoyé par mail. Veuillez suivre ce lien pour activer votre compte."
72
+ update_needs_confirmation: "Vous avez modifié votre compte avec succès, mais nous devons vérifier votre nouvelle adresse de email. Veuillez consulter vos emails et cliquer sur le lien de confirmation pour confirmer votre nouvelle adresse."
73
+ updated: Votre compte a été modifié avec succès.
74
+ sessions:
75
+ already_signed_out: Déconnecté(e).
76
+ new:
77
+ sign_in: Connexion
78
+ signed_in: Connecté(e) avec succès.
79
+ signed_out: Déconnecté(e) avec succès.
80
+ shared:
81
+ links:
82
+ back: Retour
83
+ didn_t_receive_confirmation_instructions: Vous n'avez pas reçu le email de confirmation ?
84
+ didn_t_receive_unlock_instructions: Vous n'avez pas reçu le email de déblocage ?
85
+ forgot_your_password: Mot de passe oublié ?
86
+ sign_in: Connexion
87
+ sign_in_with_provider: Connexion avec %{provider}
88
+ sign_up: Inscription
89
+ unlocks:
90
+ new:
91
+ resend_unlock_instructions: Renvoyer les instructions de déblocage
92
+ send_instructions: Vous allez recevoir sous quelques minutes un email comportant des instructions pour déverrouiller votre compte.
93
+ send_paranoid_instructions: Si votre email existe sur notre base de données, vous recevrez sous quelques minutes un message avec des instructions pour déverrouiller votre compte.
94
+ unlocked: Votre compte a été déverrouillé avec succès. Veuillez vous connecter.
95
+ errors:
96
+ messages:
97
+ already_confirmed: a déjà été confirmé(e)
98
+ confirmation_period_expired: doit être confirmé(e) en %{period}, veuillez en demander un(e) autre
99
+ expired: est périmé, veuillez en demander un autre
100
+ not_found: n’a pas été trouvé(e)
101
+ not_locked: n’était pas verrouillé(e)
102
+ not_saved:
103
+ one: 'une erreur a empêché ce (cet ou cette) %{resource} d’être enregistré(e) :'
104
+ other: "%{count} erreurs ont empêché ce (cet ou cette) %{resource} d’être enregistré(e) :"
105
+ configuration: "Reglages"
106
+ current_locale: "Local"
107
+ available_locales: "Locales disponibles"
108
+ trash:
109
+ time_to_live: "Duration de poubelle"
110
+ key: "clé"
111
+ value: "valeur"
@@ -0,0 +1,111 @@
1
+ pt:
2
+ devise:
3
+ confirmations:
4
+ confirmed: A sua conta foi confirmada com sucesso.
5
+ new:
6
+ resend_confirmation_instructions: Reenviar instruções de confirmação
7
+ send_instructions: Dentro de alguns minutos irá receber um email com instruções para confirmar a sua conta.
8
+ send_paranoid_instructions: Se o seu email existir na nossa base de dados, irá receber dentro de alguns minutos um email com instruções para confirmar a sua conta.
9
+ failure:
10
+ already_authenticated: Já se encontra autenticado.
11
+ inactive: A sua conta ainda não foi activada.
12
+ invalid: O endereço de email ou a palavra-passe são inválidos.
13
+ last_attempt: Tem mais uma tentativa antes da sua conta ser bloqueada.
14
+ locked: A sua conta está bloqueada.
15
+ not_found_in_database: O endereço de email ou a palavra-passe são inválidos.
16
+ timeout: A sua sessão expirou, por favor autentique-se novamente para continuar.
17
+ unauthenticated: Antes de continuar tem de se autenticar ou efectuar um registo.
18
+ unconfirmed: Tem de confirmar a sua conta antes de continuar.
19
+ mailer:
20
+ confirmation_instructions:
21
+ action: Confirmar a minha conta
22
+ greeting: Bem-vindo %{recipient}!
23
+ instruction: 'Pode confirmar a sua conta através do link:'
24
+ subject: Instruções de confirmação
25
+ reset_password_instructions:
26
+ action: Repor a minha senha
27
+ greeting: Olá %{recipient}!
28
+ instruction: Foi efectuado um pedido para repor a sua palavra-passe. Para o fazer click no link abaixo.
29
+ instruction_2: Se não fez este pedido, por favor ignore este e-mail.
30
+ instruction_3: A sua palavra-passe só será alterada quando aceder ao link abaixo para a alterar.
31
+ subject: Instruções de recuperação de palavra-passe
32
+ unlock_instructions:
33
+ action: Desbloquear a minha conta
34
+ greeting: Olá %{recipient}!
35
+ instruction: 'Clique no seguinte link para desbloquear a sua conta:'
36
+ message: A sua conta foi bloqueada devido a um número excessivo de tentativas de acesso inválidas.
37
+ subject: Instruções de desbloqueio
38
+ omniauth_callbacks:
39
+ failure: Não foi possível autenticar a sua conta por %{kind} porque "%{reason}".
40
+ success: A sua conta foi autenticada por %{kind} com sucesso.
41
+ passwords:
42
+ edit:
43
+ change_my_password:
44
+ change_your_password:
45
+ confirm_new_password:
46
+ new_password:
47
+ new:
48
+ forgot_your_password: Esqueceu a sua senha?
49
+ send_me_reset_password_instructions: Enviar-me instruções para repor a senha
50
+ no_token: Não pode aceder a esta página sem vir do email de redefinição da senha. Se vem dum email para redefinir a senha, por favor certifique-se que usou o URL completo que foi enviado.
51
+ send_instructions: Dentro de alguns minutos irá receber um email com instruções de reinicialização da palavra-passe.
52
+ send_paranoid_instructions: Se o seu e-mail existir na nossa base de dados, irá receber dentro de alguns minutos um e-mail com instruções para recuperar a sua senha.
53
+ updated: A sua palavra-passe foi alterada com sucesso. Agora está autenticado.
54
+ updated_not_active: A sua password foi alterada com sucesso.
55
+ registrations:
56
+ destroyed: A sua conta foi cancelada com sucesso.
57
+ edit:
58
+ are_you_sure: Tem a certeza?
59
+ cancel_my_account: Cancelar a minha conta
60
+ currently_waiting_confirmation_for_email:
61
+ leave_blank_if_you_don_t_want_to_change_it: deixe em branco caso não queira alterar
62
+ title: Editar %{resource}
63
+ unhappy:
64
+ update:
65
+ we_need_your_current_password_to_confirm_your_changes: precisamos da sua senha actual para confirmar as alterações
66
+ new:
67
+ sign_up: Criar Conta
68
+ signed_up: Bemvindo! A autenticação foi efectuada com sucesso.
69
+ signed_up_but_inactive: Registou-se com sucesso. No entanto, não podemos iniciar a sua sessão porque ainda não confirmou a sua conta.
70
+ signed_up_but_locked: Registou-se com sucesso. No entanto, não podemos iniciar a sua sessão porque a sua conta encontra-se bloqueada.
71
+ signed_up_but_unconfirmed: Foi enviado um email com um link para confirmar o seu email. Por favor abra o link para activar a sua conta.
72
+ update_needs_confirmation: A sua conta foi actualizada com sucesso, mas precisamos de confirmar o seu email. Por favor veja o seu email e clique no link para finalizar a confirmação do seu email.
73
+ updated: A sua conta foi actualizada com sucesso.
74
+ sessions:
75
+ already_signed_out: Sessão terminada com sucesso.
76
+ new:
77
+ sign_in: Entrar
78
+ signed_in: Autenticação efectuada com sucesso.
79
+ signed_out: Saiu da sessão com sucesso.
80
+ shared:
81
+ links:
82
+ back:
83
+ didn_t_receive_confirmation_instructions: Não recebeu instruções de confirmação?
84
+ didn_t_receive_unlock_instructions: Não recebeu instruções de desbloqueio?
85
+ forgot_your_password: Equeceu a palavra-passe?
86
+ sign_in: Login
87
+ sign_in_with_provider: Entrar com %{provider}
88
+ sign_up: Criar conta
89
+ unlocks:
90
+ new:
91
+ resend_unlock_instructions: Renviar instruções de desbloqueio
92
+ send_instructions: Dentro de alguns minutos irá receber um email com as instruções para desbloquear a sua conta.
93
+ send_paranoid_instructions: Se a sua conta existir, irá receber dentro de alguns minutos um email com instruções para a desbloquear.
94
+ unlocked: A sua conta foi desbloqueada com sucesso. Por favor autentique-se para continuar.
95
+ errors:
96
+ messages:
97
+ already_confirmed: já foi confirmado, por favor tente efectuar a autenticação
98
+ confirmation_period_expired: necessitava de confirmação até %{period}, por favor faça um novo pedido
99
+ expired: expirou, por favor solicite um novo
100
+ not_found: não foi encontrado
101
+ not_locked: não foi bloqueado
102
+ not_saved:
103
+ one: '1 erro impediu %{resource} de ser gravado:'
104
+ other: "%{count} erros impediram %{resource} de ser gravado:"
105
+ configuration: "Configuração"
106
+ current_locale: "Locação atual"
107
+ available_locales: "Locações disponíveis"
108
+ trash:
109
+ time_to_live: "Duração de lixeira"
110
+ key: "chave"
111
+ value: "valor"
data/config/routes.rb CHANGED
@@ -2,8 +2,6 @@ Polivalente::Engine.routes.draw do
2
2
  # Health check
3
3
  resources :ping, only: [:index]
4
4
 
5
- devise_for :users, class_name: "Polivalente::User"
6
-
7
5
  namespace :autocomplete, defaults: { format: :json } do
8
6
  get 'tags', as: :tag_completion
9
7
  get 'users', as: :user_completion
@@ -1,10 +1,10 @@
1
1
  class CreateUsers < ActiveRecord::Migration[7.0]
2
2
  def change
3
3
  create_table :users do |t|
4
- t.string :first_name, null: false, index: true
5
- t.string :last_name, null: false, index: true
6
- t.boolean :is_admin, null: false, index: true, default: false
7
- t.boolean :is_verified, null: false, index: true, default: false
4
+ t.string :first_name, null: false, index: true
5
+ t.string :last_name, null: false, index: true
6
+ t.boolean :is_admin, null: false, index: true, default: false
7
+ t.boolean :is_verified, null: false, index: true, default: false
8
8
 
9
9
  ## Devise::DatabaseAuthenticatable
10
10
  t.string :email, null: false, default: "", index: { unique: true }
@@ -25,9 +25,10 @@ class CreateUsers < ActiveRecord::Migration[7.0]
25
25
  t.string :last_sign_in_ip
26
26
 
27
27
  ## Devise::Confirmable
28
- t.string :confirmation_token, unique: true
28
+ t.string :confirmation_token, index: { unique: true }
29
29
  t.datetime :confirmed_at
30
30
  t.datetime :confirmation_sent_at
31
+ t.string :unconfirmed_email # Only if using reconfirmable
31
32
 
32
33
  ## Devise::Lockable
33
34
  t.integer :failed_attempts, default: 0, null: false
@@ -1,9 +1,37 @@
1
1
  module Polivalente
2
2
  module Generators
3
3
  class InstallGenerator < ::Rails::Generators::Base
4
+ source_root File.expand_path("../../templates", __FILE__)
5
+
4
6
  def copy_migrations
5
7
  rails_command "railties:install:migrations FROM=polivalente", inline: true
6
8
  end
9
+
10
+ def copy_locales
11
+ copy_file "../../../../config/locales/en.yml", "config/locales/en.yml"
12
+ copy_file "../../../../config/locales/es.yml", "config/locales/es.yml"
13
+ copy_file "../../../../config/locales/fr.yml", "config/locales/fr.yml"
14
+ copy_file "../../../../config/locales/pt.yml", "config/locales/pt.yml"
15
+ end
16
+
17
+ def copy_initializer
18
+ template "polivalente.rb", "config/initializers/polivalente.rb"
19
+ end
20
+
21
+ def copy_initializer
22
+ template "active_model_serializers.rb", "config/initializers/active_model_serializers.rb"
23
+ end
24
+
25
+ def add_route
26
+ devise_class = Polivalente.config.user_class.constantize
27
+
28
+ route "mount Polivalente::Engine => ''"
29
+ route "devise_for :users, path: 'auth'"
30
+ end
31
+
32
+ def show_readme
33
+ readme "README" if behavior == :invoke
34
+ end
7
35
  end
8
36
  end
9
37
  end
@@ -0,0 +1,10 @@
1
+ ===============================================================================
2
+
3
+ Now that you've installed the Polivalente, run `rails g polivalente:user` to
4
+ copy the default user model or set the `user_class` attribute in
5
+ the gem's initializer.
6
+
7
+ Then, proceed to run the installer for Devise.
8
+
9
+ For help, please check this gem's README on GitHub. Available at:
10
+ https://github.com/oleoneto/polivalente
@@ -0,0 +1 @@
1
+ ActiveModelSerializers.config.adapter = :json_api
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ Polivalente.configure do |config|
4
+ # ==> User configuration
5
+ config.user_class = "::User"
6
+
7
+ # ==> Controller configuration
8
+ config.base_controller = "::ApplicationController"
9
+ config.base_api_controller = "::ApplicationController"
10
+
11
+ # ==> Account configuration
12
+ config.inactive_account_ttl = 60.days
13
+ config.spam_account_ttl = 4.days
14
+
15
+ # ==> Locales configuration
16
+ config.supported_locales = [:en]
17
+
18
+ # ==> Trash configuration
19
+ config.trash_ttl = 30.days
20
+ end
@@ -0,0 +1,61 @@
1
+ # frozen_string_literal: true
2
+
3
+ class User < ApplicationRecord
4
+ include Polivalente::Archiver
5
+ include Polivalente::Commentator
6
+ include Polivalente::Reactor
7
+ include Polivalente::Sortable
8
+ include Polivalente::Trasher
9
+
10
+ # Include default devise modules. Others available are:
11
+ # :registerable, :validatable,
12
+ # :timeoutable, and :omniauthable
13
+
14
+ devise :database_authenticatable,
15
+ :confirmable,
16
+ :rememberable,
17
+ :recoverable,
18
+ :lockable,
19
+ :trackable
20
+
21
+ has_one_attached :photo
22
+
23
+ validates_length_of :first_name, minimum: 2, maximum: 20
24
+ validates_length_of :last_name, minimum: 2, maximum: 20
25
+ validates :email, format: { with: URI::MailTo::EMAIL_REGEXP }
26
+ validates_uniqueness_of :email
27
+ validates_length_of :password, minimum: 8
28
+
29
+ # A user account is considered spam/abandoned if:
30
+ # - The account has existed for at least N days
31
+ # - The account was never confirmed/activated
32
+ # - The the user never signed in to their account
33
+ #
34
+ # These records should be deleted from the database periodically
35
+ scope :spam, -> {
36
+ where("created_at <= ? AND sign_in_count <= 1 AND confirmed_at IS NULL", Time.zone.now - spam_account_ttl)
37
+ }
38
+
39
+ # A user account is inactive if:
40
+ # - The account has not been signed in to for more than X days
41
+ # These users should be notified about their account state
42
+ scope :inactive, -> {
43
+ where("current_sign_in_at <= ?", Time.zone.now - inactive_account_ttl)
44
+ }
45
+
46
+ scope :unconfirmed, -> { where(:confirmed_at => nil)}
47
+
48
+ def name
49
+ "#{first_name} #{last_name}"
50
+ end
51
+
52
+ module ClassMethods
53
+ def inactive_account_ttl
54
+ Polivalente.config.inactive_account_ttl.days
55
+ end
56
+
57
+ def spam_account_ttl
58
+ Polivalente.config.spam_account_ttl.days
59
+ end
60
+ end
61
+ end
@@ -0,0 +1,11 @@
1
+ module Polivalente
2
+ module Generators
3
+ class UserGenerator < ::Rails::Generators::Base
4
+ source_root File.expand_path("../../templates", __FILE__)
5
+
6
+ def copy_user_model
7
+ template "user.rb", "app/models/user.rb"
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,11 @@
1
+ module Polivalente
2
+ class Configuration
3
+ attr_accessor :base_controller
4
+ attr_accessor :base_api_controller
5
+ attr_accessor :inactive_account_ttl
6
+ attr_accessor :spam_account_ttl
7
+ attr_accessor :supported_locales
8
+ attr_accessor :trash_ttl
9
+ attr_accessor :user_class
10
+ end
11
+ end
@@ -10,12 +10,15 @@ module Polivalente
10
10
  g.factory_bot dir: "spec/factories"
11
11
  end
12
12
 
13
- initializer "polivalente.factories", after: "factory_bot.set_factory_paths" do
14
- FactoryBot.definition_file_paths << File.expand_path('../../../spec/factories', __FILE__) if defined?(FactoryBot)
13
+ # Loads engine helpers in main application
14
+ initializer "local_helper.action_controller" do
15
+ ActiveSupport.on_load :action_controller do
16
+ helper Polivalente::Engine.helpers
17
+ end
15
18
  end
16
- end
17
19
 
18
- # Do not prefix table names with `polivantente_`
19
- def self.table_name_prefix
20
+ # Do not prefix table names with `polivantente_`
21
+ def self.table_name_prefix
22
+ end
20
23
  end
21
24
  end
@@ -1,3 +1,3 @@
1
1
  module Polivalente
2
- VERSION = "0.2.0"
2
+ VERSION = "0.4.0"
3
3
  end
data/lib/polivalente.rb CHANGED
@@ -1,25 +1,24 @@
1
1
  require "polivalente/version"
2
2
  require "polivalente/railtie"
3
3
  require "polivalente/engine"
4
+ require "polivalente/configuration"
4
5
 
5
6
  # Third-party
6
7
 
7
8
  require "active_model_serializers"
8
9
  require "devise"
9
10
  require "discard"
10
- require "factory_bot_rails"
11
11
 
12
12
  module Polivalente
13
- # Attributes
14
- mattr_accessor :inactive_account_ttl
15
- mattr_accessor :spam_account_ttl
16
- mattr_accessor :supported_locales
17
- mattr_accessor :trash_ttl
13
+ class << self
14
+ attr_reader :config
18
15
 
19
- self.inactive_account_ttl = 60.days
20
- self.spam_account_ttl = 4.days
21
- self.supported_locales = [:en]
22
- self.trash_ttl = 30.days
16
+ def configure
17
+ @config = Configuration.new
18
+ yield config
19
+ end
20
+ end
21
+
23
22
 
24
23
  # Modules
25
24
  autoload :UserLocale, "polivalente/user_locale"
@@ -29,8 +28,4 @@ module Polivalente
29
28
  # do not prefix table names with `polivantente_`
30
29
  def self.table_name_prefix
31
30
  end
32
-
33
- def self.setup
34
- yield self
35
- end
36
31
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: polivalente
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Leo Neto
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-02-07 00:00:00.000000000 Z
11
+ date: 2022-02-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -114,7 +114,7 @@ dependencies:
114
114
  - - "~>"
115
115
  - !ruby/object:Gem::Version
116
116
  version: '5.0'
117
- description: Reusable generic features extracted out of our Rails apps
117
+ description: Reusable generic features for Rails applications
118
118
  email:
119
119
  - leo@ekletik.com
120
120
  executables: []
@@ -158,15 +158,17 @@ files:
158
158
  - app/models/polivalente/tag.rb
159
159
  - app/models/polivalente/tagging.rb
160
160
  - app/models/polivalente/trash.rb
161
- - app/models/polivalente/user.rb
162
161
  - app/serializers/polivalente/comment_serializer.rb
163
162
  - app/serializers/polivalente/reaction_serializer.rb
164
163
  - app/serializers/polivalente/tag_serializer.rb
165
164
  - app/serializers/polivalente/tagging_serializer.rb
166
165
  - app/serializers/polivalente/user_serializer.rb
167
166
  - app/views/layouts/polivalente/application.html.erb
168
- - config/initializers/devise.rb
169
167
  - config/locales/devise.en.yml
168
+ - config/locales/en.yml
169
+ - config/locales/es.yml
170
+ - config/locales/fr.yml
171
+ - config/locales/pt.yml
170
172
  - config/routes.rb
171
173
  - db/migrate/20220124153504_create_users.rb
172
174
  - db/migrate/20220125040905_create_tags.rb
@@ -179,6 +181,11 @@ files:
179
181
  - db/migrate/20220125144342_create_trash.rb
180
182
  - db/migrate/20220130033524_create_archives.rb
181
183
  - lib/generators/polivalente/install/install_generator.rb
184
+ - lib/generators/polivalente/templates/README
185
+ - lib/generators/polivalente/templates/active_model_serializers.rb
186
+ - lib/generators/polivalente/templates/polivalente.rb
187
+ - lib/generators/polivalente/templates/user.rb
188
+ - lib/generators/polivalente/user/user_generator.rb
182
189
  - lib/generators/rails/concern/USAGE
183
190
  - lib/generators/rails/concern/concern_generator.rb
184
191
  - lib/generators/rails/concern/templates/concern.rb
@@ -189,6 +196,7 @@ files:
189
196
  - lib/generators/rails/validator/templates/validator.rb
190
197
  - lib/generators/rails/validator/validator_generator.rb
191
198
  - lib/polivalente.rb
199
+ - lib/polivalente/configuration.rb
192
200
  - lib/polivalente/engine.rb
193
201
  - lib/polivalente/railtie.rb
194
202
  - lib/polivalente/user_locale.rb
@@ -200,7 +208,7 @@ licenses:
200
208
  metadata:
201
209
  homepage_uri: https://github.com/oleoneto/polivalente
202
210
  source_code_uri: https://github.com/oleoneto/polivalente
203
- changelog_uri: https://github.com/oleoneto/polivalente/blob/master/CHANGELOG.md
211
+ changelog_uri: https://github.com/oleoneto/polivalente/blob/main/CHANGELOG.md
204
212
  post_install_message:
205
213
  rdoc_options: []
206
214
  require_paths:
@@ -1,47 +0,0 @@
1
- module Polivalente
2
- class User < ApplicationRecord
3
- include Sortable
4
-
5
- # Include default devise modules. Others available are:
6
- # :registerable, :validatable,
7
- # :timeoutable, and :omniauthable
8
-
9
- devise :database_authenticatable,
10
- :confirmable,
11
- :rememberable,
12
- :recoverable,
13
- :lockable,
14
- :trackable
15
-
16
- has_one_attached :photo
17
-
18
- validates_length_of :first_name, minimum: 2, maximum: 20
19
- validates_length_of :last_name, minimum: 2, maximum: 20
20
- validates :email, format: { with: URI::MailTo::EMAIL_REGEXP }
21
- validates_uniqueness_of :email
22
- validates_length_of :password, minimum: 8
23
-
24
- # A user account is considered spam/abandoned if:
25
- # - The account has existed for at least N days
26
- # - The account was never confirmed/activated
27
- # - The the user never signed in to their account
28
- #
29
- # These records should be deleted from the database periodically
30
- scope :spam, -> {
31
- where("created_at <= ? AND sign_in_count <= 1 AND confirmed_at IS NULL", Time.zone.now - Polivalente::spam_account_ttl.days)
32
- }
33
-
34
- # A user account is inactive if:
35
- # - The account has not been signed in to for more than X days
36
- # These users should be notified about their account state
37
- scope :inactive, -> {
38
- where("current_sign_in_at <= ?", Time.zone.now - Polivalente::inactive_account_ttl.days)
39
- }
40
-
41
- scope :unconfirmed, -> { where(:confirmed_at => nil)}
42
-
43
- def name
44
- "#{first_name} #{last_name}"
45
- end
46
- end
47
- end
@@ -1,311 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # Assuming you have not yet modified this file, each configuration option below
4
- # is set to its default value. Note that some are commented out while others
5
- # are not: uncommented lines are intended to protect your configuration from
6
- # breaking changes in upgrades (i.e., in the event that future versions of
7
- # Devise change the default values for those options).
8
- #
9
- # Use this hook to configure devise mailer, warden hooks and so forth.
10
- # Many of these configuration options can be set straight in your model.
11
- Devise.setup do |config|
12
- # The secret key used by Devise. Devise uses this key to generate
13
- # random tokens. Changing this key will render invalid all existing
14
- # confirmation, reset password and unlock tokens in the database.
15
- # Devise will use the `secret_key_base` as its `secret_key`
16
- # by default. You can change it below and use your own secret key.
17
- # config.secret_key = '477d1e9788582224fae2eca50353a8b3b9e545784f4b622672c14f52b492b856a68e6fe634c0e548cd141f920e3622ad1a1afc131e6a40fce645d38f57390d70'
18
-
19
- # ==> Controller configuration
20
- # Configure the parent class to the devise controllers.
21
- config.parent_controller = 'Polivalente::ApplicationController'
22
-
23
- # ==> Mailer Configuration
24
- # Configure the e-mail address which will be shown in Devise::Mailer,
25
- # note that it will be overwritten if you use your own mailer class
26
- # with default "from" parameter.
27
- config.mailer_sender = 'please-change-me-at-config-initializers-devise@example.com'
28
-
29
- # Configure the class responsible to send e-mails.
30
- # config.mailer = 'Devise::Mailer'
31
-
32
- # Configure the parent class responsible to send e-mails.
33
- # config.parent_mailer = 'ActionMailer::Base'
34
-
35
- # ==> ORM configuration
36
- # Load and configure the ORM. Supports :active_record (default) and
37
- # :mongoid (bson_ext recommended) by default. Other ORMs may be
38
- # available as additional gems.
39
- require 'devise/orm/active_record'
40
-
41
- # ==> Configuration for any authentication mechanism
42
- # Configure which keys are used when authenticating a user. The default is
43
- # just :email. You can configure it to use [:username, :subdomain], so for
44
- # authenticating a user, both parameters are required. Remember that those
45
- # parameters are used only when authenticating and not when retrieving from
46
- # session. If you need permissions, you should implement that in a before filter.
47
- # You can also supply a hash where the value is a boolean determining whether
48
- # or not authentication should be aborted when the value is not present.
49
- # config.authentication_keys = [:email]
50
-
51
- # Configure parameters from the request object used for authentication. Each entry
52
- # given should be a request method and it will automatically be passed to the
53
- # find_for_authentication method and considered in your model lookup. For instance,
54
- # if you set :request_keys to [:subdomain], :subdomain will be used on authentication.
55
- # The same considerations mentioned for authentication_keys also apply to request_keys.
56
- # config.request_keys = []
57
-
58
- # Configure which authentication keys should be case-insensitive.
59
- # These keys will be downcased upon creating or modifying a user and when used
60
- # to authenticate or find a user. Default is :email.
61
- config.case_insensitive_keys = [:email]
62
-
63
- # Configure which authentication keys should have whitespace stripped.
64
- # These keys will have whitespace before and after removed upon creating or
65
- # modifying a user and when used to authenticate or find a user. Default is :email.
66
- config.strip_whitespace_keys = [:email]
67
-
68
- # Tell if authentication through request.params is enabled. True by default.
69
- # It can be set to an array that will enable params authentication only for the
70
- # given strategies, for example, `config.params_authenticatable = [:database]` will
71
- # enable it only for database (email + password) authentication.
72
- # config.params_authenticatable = true
73
-
74
- # Tell if authentication through HTTP Auth is enabled. False by default.
75
- # It can be set to an array that will enable http authentication only for the
76
- # given strategies, for example, `config.http_authenticatable = [:database]` will
77
- # enable it only for database authentication.
78
- # For API-only applications to support authentication "out-of-the-box", you will likely want to
79
- # enable this with :database unless you are using a custom strategy.
80
- # The supported strategies are:
81
- # :database = Support basic authentication with authentication key + password
82
- # config.http_authenticatable = false
83
-
84
- # If 401 status code should be returned for AJAX requests. True by default.
85
- # config.http_authenticatable_on_xhr = true
86
-
87
- # The realm used in Http Basic Authentication. 'Application' by default.
88
- # config.http_authentication_realm = 'Application'
89
-
90
- # It will change confirmation, password recovery and other workflows
91
- # to behave the same regardless if the e-mail provided was right or wrong.
92
- # Does not affect registerable.
93
- # config.paranoid = true
94
-
95
- # By default Devise will store the user in session. You can skip storage for
96
- # particular strategies by setting this option.
97
- # Notice that if you are skipping storage for all authentication paths, you
98
- # may want to disable generating routes to Devise's sessions controller by
99
- # passing skip: :sessions to `devise_for` in your config/routes.rb
100
- config.skip_session_storage = [:http_auth]
101
-
102
- # By default, Devise cleans up the CSRF token on authentication to
103
- # avoid CSRF token fixation attacks. This means that, when using AJAX
104
- # requests for sign in and sign up, you need to get a new CSRF token
105
- # from the server. You can disable this option at your own risk.
106
- # config.clean_up_csrf_token_on_authentication = true
107
-
108
- # When false, Devise will not attempt to reload routes on eager load.
109
- # This can reduce the time taken to boot the app but if your application
110
- # requires the Devise mappings to be loaded during boot time the application
111
- # won't boot properly.
112
- # config.reload_routes = true
113
-
114
- # ==> Configuration for :database_authenticatable
115
- # For bcrypt, this is the cost for hashing the password and defaults to 12. If
116
- # using other algorithms, it sets how many times you want the password to be hashed.
117
- # The number of stretches used for generating the hashed password are stored
118
- # with the hashed password. This allows you to change the stretches without
119
- # invalidating existing passwords.
120
- #
121
- # Limiting the stretches to just one in testing will increase the performance of
122
- # your test suite dramatically. However, it is STRONGLY RECOMMENDED to not use
123
- # a value less than 10 in other environments. Note that, for bcrypt (the default
124
- # algorithm), the cost increases exponentially with the number of stretches (e.g.
125
- # a value of 20 is already extremely slow: approx. 60 seconds for 1 calculation).
126
- config.stretches = Rails.env.test? ? 1 : 12
127
-
128
- # Set up a pepper to generate the hashed password.
129
- # config.pepper = 'bd2f03383b3db4ea48c803b0a54e6daa3326e31257a4ccf18354299b418242e104059e1ef48e9ba91a84d066306b38a7cc57b27a595021cd050ed400ed01d3ab'
130
-
131
- # Send a notification to the original email when the user's email is changed.
132
- # config.send_email_changed_notification = false
133
-
134
- # Send a notification email when the user's password is changed.
135
- # config.send_password_change_notification = false
136
-
137
- # ==> Configuration for :confirmable
138
- # A period that the user is allowed to access the website even without
139
- # confirming their account. For instance, if set to 2.days, the user will be
140
- # able to access the website for two days without confirming their account,
141
- # access will be blocked just in the third day.
142
- # You can also set it to nil, which will allow the user to access the website
143
- # without confirming their account.
144
- # Default is 0.days, meaning the user cannot access the website without
145
- # confirming their account.
146
- # config.allow_unconfirmed_access_for = 2.days
147
-
148
- # A period that the user is allowed to confirm their account before their
149
- # token becomes invalid. For example, if set to 3.days, the user can confirm
150
- # their account within 3 days after the mail was sent, but on the fourth day
151
- # their account can't be confirmed with the token any more.
152
- # Default is nil, meaning there is no restriction on how long a user can take
153
- # before confirming their account.
154
- # config.confirm_within = 3.days
155
-
156
- # If true, requires any email changes to be confirmed (exactly the same way as
157
- # initial account confirmation) to be applied. Requires additional unconfirmed_email
158
- # db field (see migrations). Until confirmed, new email is stored in
159
- # unconfirmed_email column, and copied to email column on successful confirmation.
160
- config.reconfirmable = true
161
-
162
- # Defines which key will be used when confirming an account
163
- # config.confirmation_keys = [:email]
164
-
165
- # ==> Configuration for :rememberable
166
- # The time the user will be remembered without asking for credentials again.
167
- # config.remember_for = 2.weeks
168
-
169
- # Invalidates all the remember me tokens when the user signs out.
170
- config.expire_all_remember_me_on_sign_out = true
171
-
172
- # If true, extends the user's remember period when remembered via cookie.
173
- # config.extend_remember_period = false
174
-
175
- # Options to be passed to the created cookie. For instance, you can set
176
- # secure: true in order to force SSL only cookies.
177
- # config.rememberable_options = {}
178
-
179
- # ==> Configuration for :validatable
180
- # Range for password length.
181
- config.password_length = 6..128
182
-
183
- # Email regex used to validate email formats. It simply asserts that
184
- # one (and only one) @ exists in the given string. This is mainly
185
- # to give user feedback and not to assert the e-mail validity.
186
- config.email_regexp = /\A[^@\s]+@[^@\s]+\z/
187
-
188
- # ==> Configuration for :timeoutable
189
- # The time you want to timeout the user session without activity. After this
190
- # time the user will be asked for credentials again. Default is 30 minutes.
191
- # config.timeout_in = 30.minutes
192
-
193
- # ==> Configuration for :lockable
194
- # Defines which strategy will be used to lock an account.
195
- # :failed_attempts = Locks an account after a number of failed attempts to sign in.
196
- # :none = No lock strategy. You should handle locking by yourself.
197
- # config.lock_strategy = :failed_attempts
198
-
199
- # Defines which key will be used when locking and unlocking an account
200
- # config.unlock_keys = [:email]
201
-
202
- # Defines which strategy will be used to unlock an account.
203
- # :email = Sends an unlock link to the user email
204
- # :time = Re-enables login after a certain amount of time (see :unlock_in below)
205
- # :both = Enables both strategies
206
- # :none = No unlock strategy. You should handle unlocking by yourself.
207
- # config.unlock_strategy = :both
208
-
209
- # Number of authentication tries before locking an account if lock_strategy
210
- # is failed attempts.
211
- # config.maximum_attempts = 20
212
-
213
- # Time interval to unlock the account if :time is enabled as unlock_strategy.
214
- # config.unlock_in = 1.hour
215
-
216
- # Warn on the last attempt before the account is locked.
217
- # config.last_attempt_warning = true
218
-
219
- # ==> Configuration for :recoverable
220
- #
221
- # Defines which key will be used when recovering the password for an account
222
- # config.reset_password_keys = [:email]
223
-
224
- # Time interval you can reset your password with a reset password key.
225
- # Don't put a too small interval or your users won't have the time to
226
- # change their passwords.
227
- config.reset_password_within = 6.hours
228
-
229
- # When set to false, does not sign a user in automatically after their password is
230
- # reset. Defaults to true, so a user is signed in automatically after a reset.
231
- # config.sign_in_after_reset_password = true
232
-
233
- # ==> Configuration for :encryptable
234
- # Allow you to use another hashing or encryption algorithm besides bcrypt (default).
235
- # You can use :sha1, :sha512 or algorithms from others authentication tools as
236
- # :clearance_sha1, :authlogic_sha512 (then you should set stretches above to 20
237
- # for default behavior) and :restful_authentication_sha1 (then you should set
238
- # stretches to 10, and copy REST_AUTH_SITE_KEY to pepper).
239
- #
240
- # Require the `devise-encryptable` gem when using anything other than bcrypt
241
- # config.encryptor = :sha512
242
-
243
- # ==> Scopes configuration
244
- # Turn scoped views on. Before rendering "sessions/new", it will first check for
245
- # "users/sessions/new". It's turned off by default because it's slower if you
246
- # are using only default views.
247
- # config.scoped_views = false
248
-
249
- # Configure the default scope given to Warden. By default it's the first
250
- # devise role declared in your routes (usually :user).
251
- # config.default_scope = :user
252
-
253
- # Set this configuration to false if you want /users/sign_out to sign out
254
- # only the current scope. By default, Devise signs out all scopes.
255
- # config.sign_out_all_scopes = true
256
-
257
- # ==> Navigation configuration
258
- # Lists the formats that should be treated as navigational. Formats like
259
- # :html, should redirect to the sign in page when the user does not have
260
- # access, but formats like :xml or :json, should return 401.
261
- #
262
- # If you have any extra navigational formats, like :iphone or :mobile, you
263
- # should add them to the navigational formats lists.
264
- #
265
- # The "*/*" below is required to match Internet Explorer requests.
266
- # config.navigational_formats = ['*/*', :html]
267
-
268
- # The default HTTP method used to sign out a resource. Default is :delete.
269
- config.sign_out_via = :delete
270
-
271
- # ==> OmniAuth
272
- # Add a new OmniAuth provider. Check the wiki for more information on setting
273
- # up on your models and hooks.
274
- # config.omniauth :github, 'APP_ID', 'APP_SECRET', scope: 'user,public_repo'
275
-
276
- # ==> Warden configuration
277
- # If you want to use other strategies, that are not supported by Devise, or
278
- # change the failure app, you can configure them inside the config.warden block.
279
- #
280
- # config.warden do |manager|
281
- # manager.intercept_401 = false
282
- # manager.default_strategies(scope: :user).unshift :some_external_strategy
283
- # end
284
-
285
- # ==> Mountable engine configurations
286
- # When using Devise inside an engine, let's call it `MyEngine`, and this engine
287
- # is mountable, there are some extra configurations to be taken into account.
288
- # The following options are available, assuming the engine is mounted as:
289
- #
290
- # mount MyEngine, at: '/my_engine'
291
- #
292
- # The router that invoked `devise_for`, in the example above, would be:
293
- config.router_name = :polivalente
294
- #
295
- # When using OmniAuth, Devise cannot automatically set OmniAuth path,
296
- # so you need to do it manually. For the users scope, it would be:
297
- # config.omniauth_path_prefix = '/my_engine/users/auth'
298
-
299
- # ==> Turbolinks configuration
300
- # If your app is using Turbolinks, Turbolinks::Controller needs to be included to make redirection work correctly:
301
- #
302
- # ActiveSupport.on_load(:devise_failure_app) do
303
- # include Turbolinks::Controller
304
- # end
305
-
306
- # ==> Configuration for :registerable
307
-
308
- # When set to false, does not sign a user in automatically after their password is
309
- # changed. Defaults to true, so a user is signed in automatically after changing a password.
310
- # config.sign_in_after_change_password = true
311
- end