iugusdk 1.0.0.alpha.2 → 1.0.0.alpha.3
Sign up to get free protection for your applications and to get access to all the features.
- data/app/controllers/iugu/account_controller.rb +3 -1
- data/app/controllers/iugu/account_domains_controller.rb +3 -2
- data/app/controllers/iugu/account_users_controller.rb +7 -3
- data/app/controllers/iugu/confirmations_controller.rb +2 -0
- data/app/controllers/iugu/omniauth_callbacks_controller.rb +1 -1
- data/app/controllers/iugu/passwords_controller.rb +2 -0
- data/app/controllers/iugu/profile_controller.rb +24 -2
- data/app/controllers/iugu/registrations_controller.rb +17 -7
- data/app/controllers/iugu/sessions_controller.rb +2 -0
- data/app/controllers/iugu/unlocks_controller.rb +1 -0
- data/app/mailers/iugu_mailer.rb +7 -0
- data/app/models/account.rb +8 -1
- data/app/models/account_domain.rb +7 -1
- data/app/models/account_role.rb +2 -0
- data/app/models/account_user.rb +2 -0
- data/app/models/available_language.rb +27 -2
- data/app/models/user.rb +44 -3
- data/app/models/user_invitation.rb +1 -1
- data/app/views/iugu/account_domains/index.html.haml +3 -1
- data/app/views/iugu/account_roles/edit.html.haml +2 -2
- data/app/views/iugu/account_users/index.html.haml +4 -1
- data/app/views/iugu/confirmations/new.html.haml +3 -2
- data/app/views/iugu/invitations/new.html.haml +3 -3
- data/app/views/iugu/mailer/confirmation_instructions.html.haml +4 -2
- data/app/views/iugu/mailer/reset_password_instructions.html.haml +6 -4
- data/app/views/iugu/mailer/welcome.html.haml +2 -0
- data/app/views/iugu/passwords/edit.html.haml +5 -4
- data/app/views/iugu/passwords/new.html.haml +3 -2
- data/app/views/iugu/registrations/edit.html.haml +10 -7
- data/app/views/iugu/registrations/new.html.haml +11 -5
- data/app/views/iugu/sessions/new.html.haml +6 -5
- data/app/views/iugu/settings/account.html.haml +23 -13
- data/app/views/iugu/settings/accounts.html.haml +2 -2
- data/app/views/iugu/settings/profile.html.haml +92 -61
- data/app/views/iugu/shared/_links.haml +6 -6
- data/{spec/dummy/tmp/restart.txt → app/views/iugu/shared/_signup_fields.haml} +0 -0
- data/app/views/layouts/settings.html.haml +2 -2
- data/config/initializers/devise.rb +1 -1
- data/config/locales/iugu.en.yml +39 -0
- data/config/locales/iugu.pt-BR.yml +43 -4
- data/config/routes.rb +2 -1
- data/lib/iugusdk.rb +29 -12
- data/lib/iugusdk/controllers/helpers.rb +4 -0
- data/lib/iugusdk/engine.rb +1 -1
- data/lib/iugusdk/iugusdk_base_controller.rb +11 -3
- data/lib/iugusdk/root_tenancy_url.rb +4 -0
- data/lib/iugusdk/version.rb +1 -1
- data/spec/controllers/account_controller_spec.rb +3 -3
- data/spec/controllers/account_domains_controller_spec.rb +6 -6
- data/spec/controllers/account_users_controller_spec.rb +15 -3
- data/spec/controllers/profile_controller_spec.rb +35 -0
- data/spec/controllers/registration_controller_spec.rb +22 -5
- data/spec/dummy/config/initializers/iugusdk.rb +1 -0
- data/spec/dummy/config/social_accounts.yml +2 -0
- data/spec/dummy/db/schema.rb +6 -6
- data/spec/fabricators/user_fabricator.rb +1 -0
- data/spec/models/account_domain_spec.rb +5 -3
- data/spec/models/account_spec.rb +14 -1
- data/spec/models/available_language_spec.rb +26 -0
- data/spec/models/user_spec.rb +80 -5
- data/spec/requests/account_domain_spec.rb +4 -4
- data/spec/requests/account_spec.rb +26 -5
- data/spec/requests/account_users_spec.rb +6 -5
- data/spec/requests/user_spec.rb +14 -0
- metadata +427 -372
- data/spec/dummy/log/development.log +0 -1683
- data/spec/dummy/log/test.log +0 -13269
- data/spec/dummy/tmp/cache/assets/C91/3F0/sprockets%2Fcd844928d19e586b4146833b720e7d29 +0 -0
- data/spec/dummy/tmp/cache/assets/CAA/190/sprockets%2Fee7298fdc707d359368983e09687c627 +0 -0
- data/spec/dummy/tmp/cache/assets/CD8/370/sprockets%2F357970feca3ac29060c1e3861e2c0953 +0 -0
- data/spec/dummy/tmp/cache/assets/CE6/A00/sprockets%2F583256e44957e430e1eca9ba1739b6b6 +0 -0
- data/spec/dummy/tmp/cache/assets/CE7/4B0/sprockets%2Fd3774b9099289a36db44caec70813a19 +0 -0
- data/spec/dummy/tmp/cache/assets/CF1/A70/sprockets%2F368a631d9662bcc4891c91f739b7be37 +0 -0
- data/spec/dummy/tmp/cache/assets/CF6/A50/sprockets%2Ff434c1ed5d55916f790cf698832f76b1 +0 -0
- data/spec/dummy/tmp/cache/assets/CFB/F30/sprockets%2F84131db318a2faf415628c1075c32bdd +0 -0
- data/spec/dummy/tmp/cache/assets/D1A/F20/sprockets%2F102cc77ec78847746b1c164edcb9b639 +0 -0
- data/spec/dummy/tmp/cache/assets/D32/A10/sprockets%2F13fe41fee1fe35b49d145bcc06610705 +0 -0
- data/spec/dummy/tmp/cache/assets/D3A/D70/sprockets%2Fa3bc2dd9e66062ea36222fc6154827ee +0 -0
- data/spec/dummy/tmp/cache/assets/D46/E20/sprockets%2F1de16fe0c12f9988664ed66a835a6ab0 +0 -0
- data/spec/dummy/tmp/cache/assets/D4E/1B0/sprockets%2Ff7cbd26ba1d28d48de824f0e94586655 +0 -0
- data/spec/dummy/tmp/cache/assets/D5A/EA0/sprockets%2Fd771ace226fc8215a3572e0aa35bb0d6 +0 -0
- data/spec/dummy/tmp/cache/assets/D64/F60/sprockets%2F4755d7f5deef0f3212cb7ae30172a33e +0 -0
- data/spec/dummy/tmp/cache/assets/D69/850/sprockets%2F5c160a5a6d1068a17af57ab38affd379 +0 -0
- data/spec/dummy/tmp/cache/assets/D77/1A0/sprockets%2Ff3864fc006a0674b4c977ff5ca5c7d2e +0 -0
- data/spec/dummy/tmp/cache/assets/D77/920/sprockets%2Faf0e746c541e6cf4540db92c87da579c +0 -0
- data/spec/dummy/tmp/cache/assets/D7A/850/sprockets%2Fd1e5bf9f64829d062ed7314af28a4e7e +0 -0
- data/spec/dummy/tmp/cache/assets/D86/3F0/sprockets%2F8f648e11dfcec044b2997b98f619cfa6 +0 -0
- data/spec/dummy/tmp/cache/assets/DA5/130/sprockets%2F7d741fa9ebe86e96fb2bd116ca91234e +0 -0
- data/spec/dummy/tmp/cache/assets/DDC/400/sprockets%2Fcffd775d018f68ce5dba1ee0d951a994 +0 -0
- data/spec/dummy/tmp/cache/assets/DF2/910/sprockets%2F02db4a9e6f91b47261fa5b0eece2ab8b +0 -0
- data/spec/dummy/tmp/cache/assets/E04/890/sprockets%2F2f5173deea6c795b8fdde723bb4b63af +0 -0
- data/spec/dummy/tmp/cache/assets/E25/5A0/sprockets%2F795f5759cf9bc7cde9f8acf8c0ca479f +0 -0
- data/spec/dummy/tmp/cache/assets/E35/0E0/sprockets%2F9f57eaeefd4c9d5efb41c9801e3f1c1a +0 -0
- data/spec/dummy/tmp/cache/sass/1f198e4a81e57d6c86c6fff1f0e13592b233ebc2/prettify.cssc +0 -0
- data/spec/dummy/tmp/cache/sass/40796b6ca2cf9112b889007328d8a4c5fdc634d8/_css3.scssc +0 -0
- data/spec/dummy/tmp/cache/sass/40796b6ca2cf9112b889007328d8a4c5fdc634d8/_support.scssc +0 -0
- data/spec/dummy/tmp/cache/sass/589e829967f8e21bd017e2d6a46ea53360f10fe0/components.sassc +0 -0
- data/spec/dummy/tmp/cache/sass/589e829967f8e21bd017e2d6a46ea53360f10fe0/iugu-ux.sassc +0 -0
- data/spec/dummy/tmp/cache/sass/589e829967f8e21bd017e2d6a46ea53360f10fe0/mixins.sassc +0 -0
- data/spec/dummy/tmp/cache/sass/589e829967f8e21bd017e2d6a46ea53360f10fe0/reset.sassc +0 -0
- data/spec/dummy/tmp/cache/sass/589e829967f8e21bd017e2d6a46ea53360f10fe0/typography.sassc +0 -0
- data/spec/dummy/tmp/cache/sass/589e829967f8e21bd017e2d6a46ea53360f10fe0/utilities.sassc +0 -0
- data/spec/dummy/tmp/cache/sass/589e829967f8e21bd017e2d6a46ea53360f10fe0/variables.sassc +0 -0
- data/spec/dummy/tmp/cache/sass/7694fbc0853be2496915aae45b37e2d934ffc111/_appearance.scssc +0 -0
- data/spec/dummy/tmp/cache/sass/7694fbc0853be2496915aae45b37e2d934ffc111/_background-clip.scssc +0 -0
- data/spec/dummy/tmp/cache/sass/7694fbc0853be2496915aae45b37e2d934ffc111/_background-origin.scssc +0 -0
- data/spec/dummy/tmp/cache/sass/7694fbc0853be2496915aae45b37e2d934ffc111/_background-size.scssc +0 -0
- data/spec/dummy/tmp/cache/sass/7694fbc0853be2496915aae45b37e2d934ffc111/_border-radius.scssc +0 -0
- data/spec/dummy/tmp/cache/sass/7694fbc0853be2496915aae45b37e2d934ffc111/_box-shadow.scssc +0 -0
- data/spec/dummy/tmp/cache/sass/7694fbc0853be2496915aae45b37e2d934ffc111/_box-sizing.scssc +0 -0
- data/spec/dummy/tmp/cache/sass/7694fbc0853be2496915aae45b37e2d934ffc111/_box.scssc +0 -0
- data/spec/dummy/tmp/cache/sass/7694fbc0853be2496915aae45b37e2d934ffc111/_columns.scssc +0 -0
- data/spec/dummy/tmp/cache/sass/7694fbc0853be2496915aae45b37e2d934ffc111/_font-face.scssc +0 -0
- data/spec/dummy/tmp/cache/sass/7694fbc0853be2496915aae45b37e2d934ffc111/_images.scssc +0 -0
- data/spec/dummy/tmp/cache/sass/7694fbc0853be2496915aae45b37e2d934ffc111/_inline-block.scssc +0 -0
- data/spec/dummy/tmp/cache/sass/7694fbc0853be2496915aae45b37e2d934ffc111/_opacity.scssc +0 -0
- data/spec/dummy/tmp/cache/sass/7694fbc0853be2496915aae45b37e2d934ffc111/_shared.scssc +0 -0
- data/spec/dummy/tmp/cache/sass/7694fbc0853be2496915aae45b37e2d934ffc111/_text-shadow.scssc +0 -0
- data/spec/dummy/tmp/cache/sass/7694fbc0853be2496915aae45b37e2d934ffc111/_transform.scssc +0 -0
- data/spec/dummy/tmp/cache/sass/7694fbc0853be2496915aae45b37e2d934ffc111/_transition.scssc +0 -0
- data/spec/dummy/tmp/cache/sass/9da4e62a062dae83baa33f29455be2ba30cf5dce/_sprites.scssc +0 -0
- data/spec/dummy/tmp/cache/sass/db2a23483187bf5625185da2d6f47de2a6de4989/_base.scssc +0 -0
- data/spec/dummy/tmp/cache/sass/db2a23483187bf5625185da2d6f47de2a6de4989/_sprite-img.scssc +0 -0
- data/spec/dummy/tmp/cache/sass/e5be18dde92936a4632e65289dad5788ed73dd60/base_settings.sassc +0 -0
- data/spec/dummy/tmp/cache/sass/e5be18dde92936a4632e65289dad5788ed73dd60/settings.sassc +0 -0
- data/spec/dummy/tmp/cache/sass/e764476e9a85279ad82622591ce49983ed21c149/application.sassc +0 -0
- data/spec/dummy/tmp/cache/sass/e764476e9a85279ad82622591ce49983ed21c149/base_settings.sassc +0 -0
- data/spec/dummy/tmp/cache/sass/e764476e9a85279ad82622591ce49983ed21c149/default.sassc +0 -0
- data/spec/dummy/tmp/cache/sass/eab9c0816f626278a6731ce2928de6fdbe99322b/_hacks.scssc +0 -0
@@ -213,7 +213,7 @@ Devise.setup do |config|
|
|
213
213
|
# config.omniauth :github, 'APP_ID', 'APP_SECRET', :scope => 'user,public_repo'
|
214
214
|
|
215
215
|
SOCIAL_ACCOUNTS.keys.each do |provider_name|
|
216
|
-
config.omniauth provider_name.to_sym, SOCIAL_ACCOUNTS[provider_name]['token'], SOCIAL_ACCOUNTS[provider_name]['secret']
|
216
|
+
config.omniauth provider_name.to_sym, SOCIAL_ACCOUNTS[provider_name]['token'], SOCIAL_ACCOUNTS[provider_name]['secret'], :scope => SOCIAL_ACCOUNTS[provider_name]['scope']
|
217
217
|
end
|
218
218
|
|
219
219
|
|
data/config/locales/iugu.en.yml
CHANGED
@@ -6,6 +6,10 @@ en:
|
|
6
6
|
only_social_and_no_email: "You need email and password to unlink this Social Account"
|
7
7
|
email_already_in_use: "This email is already in use"
|
8
8
|
iugu:
|
9
|
+
welcome: "Welcome"
|
10
|
+
edit: "Edit"
|
11
|
+
update: "Update"
|
12
|
+
unhappy?: "Unhappy?"
|
9
13
|
try_first: "Try first"
|
10
14
|
generate_new_token: "Generate new token"
|
11
15
|
create_account: "Create Account"
|
@@ -13,6 +17,7 @@ en:
|
|
13
17
|
active: "Active"
|
14
18
|
unnamed: "Unnamed"
|
15
19
|
back_to: "Back to"
|
20
|
+
back: "Back"
|
16
21
|
save: "Save"
|
17
22
|
invited_by: "Invited by"
|
18
23
|
accept: "Accept"
|
@@ -39,12 +44,14 @@ en:
|
|
39
44
|
remove_user: "Remove User"
|
40
45
|
removing: "Removing..."
|
41
46
|
cancel_account: "Cancel Account"
|
47
|
+
cancel_my_account: "Cancel my account"
|
42
48
|
undo: "Undo"
|
43
49
|
signed_in: "You are signed in as"
|
44
50
|
settings: "Settings"
|
45
51
|
in_your_settings_form: "in your settings form"
|
46
52
|
sign_out: "Sign out"
|
47
53
|
sign_in: "Sign in"
|
54
|
+
sign_in_with: "Sign in with"
|
48
55
|
sign_up: "Sign up"
|
49
56
|
profile: "Profile"
|
50
57
|
profile_settings: "Profile Settings"
|
@@ -52,6 +59,11 @@ en:
|
|
52
59
|
account_number: "Account Number"
|
53
60
|
account_roles: "User roles on account"
|
54
61
|
change_password: "Change password"
|
62
|
+
change_your_password: "Change your password"
|
63
|
+
change_my_password: "Change my password"
|
64
|
+
forgot_your_password?: "Forgot your password?"
|
65
|
+
new_password: "New password"
|
66
|
+
confirm_your_new_password: "Confirm your new password"
|
55
67
|
change: "Change"
|
56
68
|
manage: "Manage"
|
57
69
|
social_account: "Social network accounts"
|
@@ -63,7 +75,23 @@ en:
|
|
63
75
|
verify_domain: "Verify Domain"
|
64
76
|
verify_later: "Verify later"
|
65
77
|
instructions: "Instructions"
|
78
|
+
resend_confirmation_instructions: "Resend confirmation instructions"
|
79
|
+
confirm_email_through_link_below: "You can confirm your account email through the link below"
|
80
|
+
send_me_reset_password_instructions: "Send me reset password instructions"
|
81
|
+
leave_it_blank_if_dont_wanna_change_it: "leave it blank if you don't want to change it"
|
82
|
+
we_need_your_current_password_to_confirm_changes: "we need your current password to confirm your changes"
|
83
|
+
did_not_receive_confirmation_instructions?: "Didn't receive confirmation instructions?"
|
84
|
+
plan_name: "Plan name"
|
85
|
+
custom_domains: "Custom domains"
|
86
|
+
api_token: "Api token"
|
87
|
+
i_dont_have_any_accounts: "I don't have any accounts"
|
88
|
+
owner: "owner"
|
89
|
+
admin: "admin"
|
90
|
+
user: "user"
|
91
|
+
guest: "guest"
|
92
|
+
become_user: "Become an User"
|
66
93
|
notices:
|
94
|
+
congrats_for_becoming_user: "Congratulations for becoming an user"
|
67
95
|
guest_login: "Guest successfully login"
|
68
96
|
subdomain_updated: "Subdomain successfully updated"
|
69
97
|
you_are_already_member_of_this_account: "You already member of this account"
|
@@ -80,4 +108,15 @@ en:
|
|
80
108
|
domain_verified: "Domain successfully verified"
|
81
109
|
domain_not_verified: "Domain could not be verified"
|
82
110
|
domain_set_primary: "Domain successfully set as primary"
|
111
|
+
|
112
|
+
activerecord:
|
113
|
+
models:
|
114
|
+
user: "User"
|
115
|
+
attributes:
|
116
|
+
password: "Password"
|
117
|
+
password_confirmation: "Password confirmation"
|
118
|
+
name: "Name"
|
119
|
+
birthdate: "Birthdate"
|
120
|
+
locale: "Locale"
|
121
|
+
remember_me: "Remember me"
|
83
122
|
|
@@ -6,6 +6,10 @@ pt-BR:
|
|
6
6
|
only_social_and_no_email: "Você precisa de um email para poder apagar essa rede social"
|
7
7
|
email_already_in_use: "Esse email já foi utilizado"
|
8
8
|
iugu:
|
9
|
+
welcome: "Bem vindo"
|
10
|
+
edit: "Editar"
|
11
|
+
update: "Atualizar"
|
12
|
+
unhappy?: "Infeliz?"
|
9
13
|
try_first: "Testar Primeiro"
|
10
14
|
generate_new_token: "Gerar novo token"
|
11
15
|
create_account: "Criar Conta"
|
@@ -13,6 +17,7 @@ pt-BR:
|
|
13
17
|
active: "Ativa"
|
14
18
|
unnamed: "Sem nome"
|
15
19
|
back_to: "Voltar para"
|
20
|
+
back: "Voltar"
|
16
21
|
save: "Salvar"
|
17
22
|
invited_by: "Convidado por"
|
18
23
|
accept: "Aceitar"
|
@@ -37,7 +42,8 @@ pt-BR:
|
|
37
42
|
are_you_sure?: "Tem certeza disso?"
|
38
43
|
remove: "Excluir"
|
39
44
|
remove_user: "Remover Usuário"
|
40
|
-
cancel_account: "Cancelar
|
45
|
+
cancel_account: "Cancelar conta"
|
46
|
+
cancel_my_account: "Cancelar minha conta"
|
41
47
|
removing: "Excluindo..."
|
42
48
|
undo: "Desfazer"
|
43
49
|
signed_in: "Você está logado como"
|
@@ -45,13 +51,19 @@ pt-BR:
|
|
45
51
|
in_your_settings_form: "no seu formulario de configurações"
|
46
52
|
sign_out: "Deslogar"
|
47
53
|
sign_in: "Logar"
|
54
|
+
sign_in_with: "Logar-se com"
|
48
55
|
sign_up: "Cadastro"
|
49
56
|
profile: "Perfil"
|
50
57
|
profile_settings: "Configurações de Perfil"
|
51
|
-
account_settings: "
|
52
|
-
account_number: "
|
53
|
-
account_roles: "
|
58
|
+
account_settings: "Configurações de conta"
|
59
|
+
account_number: "Número de conta"
|
60
|
+
account_roles: "Papeis de usúarios na conta"
|
54
61
|
change_password: "Mudar senha"
|
62
|
+
change_your_password: "Mude sua senha"
|
63
|
+
change_my_password: "Mudar minha senha"
|
64
|
+
forgot_your_password?: "Esqueceu sua senha?"
|
65
|
+
new_password: "Nova senha"
|
66
|
+
confirm_your_new_password: "Confirme sua nova senha"
|
55
67
|
change: "Alterar"
|
56
68
|
manage: "Manejar"
|
57
69
|
social_account: "Redes sociais"
|
@@ -63,7 +75,23 @@ pt-BR:
|
|
63
75
|
verify_domain: "Verificar Dominio"
|
64
76
|
verify_later: "Verificar depois"
|
65
77
|
instructions: "Instruções"
|
78
|
+
resend_confirmation_instructions: "Instruções para re-envio de confirmação"
|
79
|
+
confirm_email_through_link_below: "Você pode confirmar o email da sua conta no link abaixo"
|
80
|
+
send_me_reset_password_instructions: "Me envie instruções para reset de senha"
|
81
|
+
leave_it_blank_if_dont_wanna_change_it: "Deixa em branco se não quiser alterar"
|
82
|
+
we_need_your_current_password_to_confirm_changes: "Nos precisamos da sua senha atual para confirmar as mudanças"
|
83
|
+
did_not_receive_confirmation_instructions?: "Não recebeu as instruções para confirmação?"
|
84
|
+
plan_name: "Nome do Plano"
|
85
|
+
custom_domains: "Dominios customizados"
|
86
|
+
api_token: "Token da api"
|
87
|
+
i_dont_have_any_accounts: "Eu não tenho nenhuma conta"
|
88
|
+
owner: "dono"
|
89
|
+
admin: "administrador"
|
90
|
+
user: "usuário"
|
91
|
+
guest: "convidado"
|
92
|
+
become_user: "Tornar-se um usuário"
|
66
93
|
notices:
|
94
|
+
congrats_for_becoming_user: "Parabens por se tornar um usuário!"
|
67
95
|
guest_login: "Convidado logado com sucesso"
|
68
96
|
subdomain_updated: "Subdominio atualizado com sucesso"
|
69
97
|
you_are_already_member_of_this_account: "Você já é membro dessa conta"
|
@@ -80,4 +108,15 @@ pt-BR:
|
|
80
108
|
domain_verified: "Dominio verificado"
|
81
109
|
domain_not_verified: "Não foi possivel verificar o dominio"
|
82
110
|
domain_set_primary: "O dominio foi configurado como primario"
|
111
|
+
|
112
|
+
activerecord:
|
113
|
+
models:
|
114
|
+
user: "Usuário"
|
115
|
+
attributes:
|
116
|
+
password: "Senha"
|
117
|
+
password_confirmation: "Confirmação de senha"
|
118
|
+
name: "Nome"
|
119
|
+
birthdate: "Data de nascimento"
|
120
|
+
locale: "Localidade"
|
121
|
+
remember_me: "Lembre-me"
|
83
122
|
|
data/config/routes.rb
CHANGED
@@ -33,6 +33,7 @@ Rails.application.routes.draw do
|
|
33
33
|
get "settings/profile/cancel_destruction" => "iugu/profile#cancel_destruction", :as => "profile_cancel_destruction"
|
34
34
|
post "settings/profile" => "iugu/profile#update", :as => "profile_update"
|
35
35
|
get "settings/profile/social/destroy" => "iugu/profile#destroy_social", :as => "social_destroy"
|
36
|
+
post 'become_user' => 'iugu/profile#become_user', :as => 'become_user'
|
36
37
|
|
37
38
|
get '/settings/account/:account_id/invite' => 'iugu/invitations#new', :as => 'new_invite'
|
38
39
|
post '/settings/account/:account_id/invite' => 'iugu/invitations#create', :as => 'create_invite'
|
@@ -54,7 +55,7 @@ Rails.application.routes.draw do
|
|
54
55
|
delete 'logout' => 'iugu/sessions#destroy', :as => 'destroy_user_session'
|
55
56
|
|
56
57
|
# Registration Stuff
|
57
|
-
|
58
|
+
if IuguSDK::enable_signup_form
|
58
59
|
get 'signup' => 'iugu/registrations#new', :as => 'new_user_registration'
|
59
60
|
post 'signup' => 'iugu/registrations#create', :as => 'user_registration'
|
60
61
|
get 'cancel_signup' => 'iugu/registrations#cancel', :as => 'cancel_user_registration'
|
data/lib/iugusdk.rb
CHANGED
@@ -13,6 +13,7 @@ require 'omniauth-twitter'
|
|
13
13
|
require 'omniauth-facebook'
|
14
14
|
require 'delayed_job'
|
15
15
|
require 'delayed_job_active_record'
|
16
|
+
require 'koala'
|
16
17
|
# TODO: ALE - Acho q vai precisar disto
|
17
18
|
# require 'oauth2'
|
18
19
|
|
@@ -21,16 +22,15 @@ module IuguSDK
|
|
21
22
|
mattr_accessor :app_root
|
22
23
|
|
23
24
|
mattr_accessor :application_title
|
24
|
-
mattr_accessor :no_signup_form
|
25
25
|
mattr_accessor :app_main_url
|
26
26
|
mattr_accessor :app_root_url
|
27
27
|
mattr_accessor :default_subscription_name
|
28
28
|
mattr_accessor :guest_user_prefix
|
29
|
-
mattr_accessor :multiple_accounts_per_user
|
30
29
|
mattr_accessor :default_layout
|
30
|
+
mattr_accessor :alternative_layout
|
31
31
|
|
32
32
|
mattr_accessor :enable_multiple_accounts
|
33
|
-
self.enable_multiple_accounts =
|
33
|
+
self.enable_multiple_accounts = false
|
34
34
|
|
35
35
|
mattr_accessor :application_main_host
|
36
36
|
self.application_main_host = "iugusdk.dev"
|
@@ -50,20 +50,23 @@ module IuguSDK
|
|
50
50
|
mattr_accessor :delay_user_exclusion
|
51
51
|
self.delay_user_exclusion = 0
|
52
52
|
|
53
|
-
mattr_accessor :
|
54
|
-
self.
|
53
|
+
mattr_accessor :destroy_guest_in
|
54
|
+
self.destroy_guest_in = 7
|
55
|
+
|
56
|
+
mattr_accessor :enable_account_alias
|
57
|
+
self.enable_account_alias = false
|
55
58
|
|
56
59
|
mattr_accessor :enable_custom_domain
|
57
60
|
self.enable_custom_domain = false
|
58
61
|
|
59
|
-
mattr_accessor :
|
60
|
-
self.
|
62
|
+
mattr_accessor :enable_account_api
|
63
|
+
self.enable_account_api = false
|
61
64
|
|
62
65
|
mattr_accessor :enable_social_login
|
63
66
|
self.enable_social_login = false
|
64
67
|
|
65
68
|
mattr_accessor :enable_social_linking
|
66
|
-
self.enable_social_linking =
|
69
|
+
self.enable_social_linking = true
|
67
70
|
|
68
71
|
mattr_accessor :enable_user_confirmation
|
69
72
|
self.enable_user_confirmation = false
|
@@ -74,19 +77,33 @@ module IuguSDK
|
|
74
77
|
mattr_accessor :enable_subscription_features
|
75
78
|
self.enable_subscription_features = false
|
76
79
|
|
77
|
-
mattr_accessor :
|
78
|
-
self.
|
80
|
+
mattr_accessor :enable_signup_form
|
81
|
+
self.enable_signup_form = true
|
82
|
+
|
83
|
+
mattr_accessor :enable_guest_user
|
84
|
+
self.enable_guest_user = false
|
85
|
+
|
86
|
+
mattr_accessor :account_alias_prefix
|
87
|
+
self.account_alias_prefix = 'account'
|
88
|
+
|
89
|
+
mattr_accessor :enable_alias_on_signup
|
90
|
+
self.enable_alias_on_signup = false
|
91
|
+
|
92
|
+
mattr_accessor :enable_multiple_users_per_account
|
93
|
+
self.enable_multiple_users_per_account = false
|
94
|
+
|
95
|
+
mattr_accessor :enable_welcome_mail
|
96
|
+
self.enable_welcome_mail = false
|
79
97
|
|
80
98
|
self.application_title = 'Application Name'
|
81
99
|
|
82
|
-
self.no_signup_form = false
|
83
100
|
self.app_main_url = '/'
|
84
101
|
self.app_root_url = '/'
|
85
102
|
self.default_subscription_name = 'free'
|
86
103
|
self.guest_user_prefix = 'appuser'
|
87
|
-
self.multiple_accounts_per_user = false
|
88
104
|
|
89
105
|
self.default_layout = "settings"
|
106
|
+
self.alternative_layout = "application"
|
90
107
|
|
91
108
|
def initialize
|
92
109
|
end
|
@@ -12,6 +12,10 @@ module IuguSDK
|
|
12
12
|
@current_user_account ||= search_user_account( session[:current_account_id] )
|
13
13
|
end
|
14
14
|
|
15
|
+
def current_account
|
16
|
+
current_user_account.try(:account)
|
17
|
+
end
|
18
|
+
|
15
19
|
def set_account( resource, account_id=nil )
|
16
20
|
if account_id == nil
|
17
21
|
account_id = cookies[:last_used_account_id] if cookies[:last_used_account_id]
|
data/lib/iugusdk/engine.rb
CHANGED
@@ -4,7 +4,7 @@ module IuguSDK
|
|
4
4
|
initializer 'iugusdk.action_controller' do |app|
|
5
5
|
ActiveSupport.on_load(:action_controller) do
|
6
6
|
include IuguSDK::Controllers::Helpers
|
7
|
-
helper_method "search_user_account", "current_user_account", "is_active?", "body_classes"
|
7
|
+
helper_method "search_user_account", "current_user_account", "is_active?", "body_classes", "current_account"
|
8
8
|
ActionController::Base.send(:include, IuguSDKBaseController)
|
9
9
|
end
|
10
10
|
end
|
@@ -5,13 +5,21 @@ module IuguSDKBaseController
|
|
5
5
|
end
|
6
6
|
|
7
7
|
def select_account
|
8
|
-
Rails.logger.info "SELECT ACCOUNT"
|
9
8
|
set_account(current_user) if current_user
|
10
9
|
end
|
11
10
|
|
12
11
|
def configure_locale
|
13
|
-
@matched_locale_from_browser = request.preferred_language_from(AvailableLanguage.all)
|
14
|
-
|
12
|
+
@matched_locale_from_browser = request.preferred_language_from(AvailableLanguage.all.values)
|
13
|
+
if signed_in?
|
14
|
+
if current_user.locale.blank?
|
15
|
+
locale = "en"
|
16
|
+
else
|
17
|
+
locale = current_user.locale
|
18
|
+
end
|
19
|
+
else
|
20
|
+
locale = @matched_locale_from_browser
|
21
|
+
end
|
22
|
+
I18n.locale = locale
|
15
23
|
end
|
16
24
|
|
17
25
|
end
|
@@ -15,6 +15,10 @@ module IuguSDK
|
|
15
15
|
def self.matches?(request)
|
16
16
|
application_domain = IuguSDK::application_main_host
|
17
17
|
valids = [ application_domain, ['www.',application_domain].join ]
|
18
|
+
unless Rails.env.production?
|
19
|
+
first_part_uri = application_domain.gsub('.dev','')
|
20
|
+
return true if request.host.match("#{first_part_uri}\.[^\.]+\.[^\.]+\.[^\.]+\.[^\.]+\.xip.io")
|
21
|
+
end
|
18
22
|
valids.include?( request.host )
|
19
23
|
end
|
20
24
|
|
data/lib/iugusdk/version.rb
CHANGED
@@ -115,7 +115,7 @@ describe Iugu::AccountController do
|
|
115
115
|
context "generate_new_token" do
|
116
116
|
login_as_user
|
117
117
|
before(:each) do
|
118
|
-
IuguSDK::
|
118
|
+
IuguSDK::enable_account_api = true
|
119
119
|
@account = @user.accounts.last
|
120
120
|
post :generate_new_token, :account_id => @account.id
|
121
121
|
end
|
@@ -124,9 +124,9 @@ describe Iugu::AccountController do
|
|
124
124
|
|
125
125
|
it { flash.now[:notice].should == I18n.t("iugu.notices.new_token_generated") }
|
126
126
|
|
127
|
-
context "when
|
127
|
+
context "when enable_account_api == false" do
|
128
128
|
before(:each) do
|
129
|
-
IuguSDK::
|
129
|
+
IuguSDK::enable_account_api = false
|
130
130
|
end
|
131
131
|
|
132
132
|
it 'should raise RoutingError' do
|
@@ -179,9 +179,9 @@ describe Iugu::AccountDomainsController do
|
|
179
179
|
@account = @user.accounts.first
|
180
180
|
end
|
181
181
|
|
182
|
-
context "when
|
182
|
+
context "when enable_account_alias == true" do
|
183
183
|
before(:each) do
|
184
|
-
IuguSDK::
|
184
|
+
IuguSDK::enable_account_alias = true
|
185
185
|
put :update_subdomain, :account_id => @account.id, :account => {:subdomain => "subdomain"}
|
186
186
|
end
|
187
187
|
|
@@ -200,9 +200,9 @@ describe Iugu::AccountDomainsController do
|
|
200
200
|
end
|
201
201
|
end
|
202
202
|
|
203
|
-
context "when
|
203
|
+
context "when enable_account_alias == false" do
|
204
204
|
before(:each) do
|
205
|
-
IuguSDK::
|
205
|
+
IuguSDK::enable_account_alias = false
|
206
206
|
end
|
207
207
|
|
208
208
|
it 'should raise RoutingError' do
|
@@ -234,12 +234,12 @@ describe Iugu::AccountDomainsController do
|
|
234
234
|
|
235
235
|
end
|
236
236
|
|
237
|
-
context "when enable_custom_domain == false &&
|
237
|
+
context "when enable_custom_domain == false && enable_account_alias == false" do
|
238
238
|
login_as_user
|
239
239
|
before(:each) do
|
240
240
|
@account = @user.accounts.first
|
241
241
|
IuguSDK::enable_custom_domain = false
|
242
|
-
IuguSDK::
|
242
|
+
IuguSDK::enable_account_alias = false
|
243
243
|
end
|
244
244
|
|
245
245
|
it 'index method should raise RoutingError' do
|
@@ -4,10 +4,22 @@ describe Iugu::AccountUsersController do
|
|
4
4
|
context "index" do
|
5
5
|
login_as_user
|
6
6
|
before(:each) do
|
7
|
+
IuguSDK::enable_multiple_users_per_account = true
|
7
8
|
get :index, :account_id => @user.accounts.first.id
|
8
9
|
end
|
9
10
|
|
10
11
|
it { response.should render_template 'iugu/account_users/index' }
|
12
|
+
|
13
|
+
context "when enable_multiple_users_per_account == false" do
|
14
|
+
before(:each) do
|
15
|
+
IuguSDK::enable_multiple_users_per_account = false
|
16
|
+
end
|
17
|
+
it 'should raise routing error' do
|
18
|
+
lambda{
|
19
|
+
get :index, :account_id => @user.accounts.first.id
|
20
|
+
}.should raise_error ActionController::RoutingError
|
21
|
+
end
|
22
|
+
end
|
11
23
|
|
12
24
|
end
|
13
25
|
|
@@ -31,9 +43,9 @@ describe Iugu::AccountUsersController do
|
|
31
43
|
|
32
44
|
before(:each) do
|
33
45
|
@target_user = Fabricate(:user) do
|
34
|
-
email '
|
46
|
+
email 'targetdestroy@teste.teste'
|
35
47
|
end
|
36
|
-
@account.account_users << @account_user = AccountUser.create(:
|
48
|
+
@account.account_users << @account_user = AccountUser.create(:user => @target_user)
|
37
49
|
end
|
38
50
|
|
39
51
|
it 'should raise routing error if account_id is invalid' do
|
@@ -96,7 +108,7 @@ describe Iugu::AccountUsersController do
|
|
96
108
|
@target_user = Fabricate(:user) do
|
97
109
|
email 'target@test.test'
|
98
110
|
end
|
99
|
-
@account.account_users << @account_user = AccountUser.create(:
|
111
|
+
@account.account_users << @account_user = AccountUser.create(:user => @target_user)
|
100
112
|
@account_user.set_roles ["user"]
|
101
113
|
@account_user.destroy
|
102
114
|
end
|