iugusdk 1.0.0.alpha.0
Sign up to get free protection for your applications and to get access to all the features.
- data/MIT-LICENSE +20 -0
- data/README.rdoc +3 -0
- data/Rakefile +39 -0
- data/app/assets/images/application_logo.png +0 -0
- data/app/assets/javascripts/settings.js +10 -0
- data/app/assets/javascripts/settings_code.js.coffee.erb +0 -0
- data/app/assets/stylesheets/settings.sass +120 -0
- data/app/controllers/iugu/account_controller.rb +63 -0
- data/app/controllers/iugu/account_domains_controller.rb +64 -0
- data/app/controllers/iugu/account_roles_controller.rb +20 -0
- data/app/controllers/iugu/account_settings_controller.rb +17 -0
- data/app/controllers/iugu/account_users_controller.rb +43 -0
- data/app/controllers/iugu/application_domain_controller.rb +11 -0
- data/app/controllers/iugu/confirmations_controller.rb +2 -0
- data/app/controllers/iugu/invitations_controller.rb +49 -0
- data/app/controllers/iugu/omniauth_callbacks_controller.rb +23 -0
- data/app/controllers/iugu/passwords_controller.rb +2 -0
- data/app/controllers/iugu/profile_controller.rb +44 -0
- data/app/controllers/iugu/registrations_controller.rb +3 -0
- data/app/controllers/iugu/sessions_controller.rb +2 -0
- data/app/controllers/iugu/settings_controller.rb +11 -0
- data/app/controllers/iugu/unlocks_controller.rb +2 -0
- data/app/mailers/iugu_mailer.rb +16 -0
- data/app/models/account.rb +53 -0
- data/app/models/account_domain.rb +69 -0
- data/app/models/account_role.rb +24 -0
- data/app/models/account_user.rb +55 -0
- data/app/models/available_language.rb +10 -0
- data/app/models/social_account.rb +14 -0
- data/app/models/user.rb +107 -0
- data/app/models/user_invitation.rb +39 -0
- data/app/validators/email_validator.rb +17 -0
- data/app/views/iugu-old/account_settings.html.haml +17 -0
- data/app/views/iugu-old/login.html.haml +28 -0
- data/app/views/iugu-old/mails/confirmation_instructions.html.erb +5 -0
- data/app/views/iugu-old/mails/reset_password_instructions.html.erb +8 -0
- data/app/views/iugu-old/mails/unlock_instructions.html.erb +7 -0
- data/app/views/iugu-old/profile_settings.html.haml +76 -0
- data/app/views/iugu-old/signup.html.haml +36 -0
- data/app/views/iugu/account_domains/index.html.haml +33 -0
- data/app/views/iugu/account_domains/instructions.html.haml +0 -0
- data/app/views/iugu/account_roles/edit.html.haml +17 -0
- data/app/views/iugu/account_roles/update.html.haml +0 -0
- data/app/views/iugu/account_users/index.html.haml +23 -0
- data/app/views/iugu/account_users/view.html.haml +0 -0
- data/app/views/iugu/confirmations/new.html.haml +8 -0
- data/app/views/iugu/invitations/edit.html.haml +8 -0
- data/app/views/iugu/invitations/new.html.haml +13 -0
- data/app/views/iugu/mailer/confirmation_instructions.html.haml +4 -0
- data/app/views/iugu/mailer/invitation.html.haml +1 -0
- data/app/views/iugu/mailer/reset_password_instructions.html.haml +4 -0
- data/app/views/iugu/mailer/unlock_instructions.html.haml +5 -0
- data/app/views/iugu/passwords/edit.html.haml +11 -0
- data/app/views/iugu/passwords/new.html.haml +8 -0
- data/app/views/iugu/registrations/edit.html.haml +15 -0
- data/app/views/iugu/registrations/new.html.haml +11 -0
- data/app/views/iugu/sessions/new.html.haml +9 -0
- data/app/views/iugu/settings/account.html.haml +48 -0
- data/app/views/iugu/settings/accounts.html.haml +33 -0
- data/app/views/iugu/settings/profile.html.haml +96 -0
- data/app/views/iugu/shared/_links.haml +19 -0
- data/app/views/iugu/unlocks/new.html.haml +8 -0
- data/app/views/layouts/settings.html.haml +46 -0
- data/config/initializers/account_roles.rb +5 -0
- data/config/initializers/devise.rb +242 -0
- data/config/initializers/social_accounts.rb +16 -0
- data/config/locales/devise.en.yml +57 -0
- data/config/locales/devise.pt-BR.yml +55 -0
- data/config/locales/iugu.en.yml +73 -0
- data/config/locales/iugu.pt-BR.yml +73 -0
- data/config/routes.rb +77 -0
- data/db/migrate/20120528164634_create_account.rb +11 -0
- data/db/migrate/20120529134109_add_devise_to_users.rb +53 -0
- data/db/migrate/20120529162901_add_birthdate_and_name_to_user.rb +12 -0
- data/db/migrate/20120529174755_add_name_and_subscription_id_and_user_id_to_account.rb +13 -0
- data/db/migrate/20120529180814_create_account_users.rb +12 -0
- data/db/migrate/20120530114709_remove_user_id_from_accounts.rb +9 -0
- data/db/migrate/20120531171438_create_account_roles.rb +12 -0
- data/db/migrate/20120604131034_add_locale_to_user.rb +9 -0
- data/db/migrate/20120605142527_create_social_account.rb +15 -0
- data/db/migrate/20120612141130_set_locale.rb +6 -0
- data/db/migrate/20120613173114_remove_unique_from_user_email.rb +11 -0
- data/db/migrate/20120615180728_create_delayed_jobs.rb +22 -0
- data/db/migrate/20120629154429_create_user_invitations.rb +14 -0
- data/db/migrate/20120629195345_add_token_to_user_invitations.rb +8 -0
- data/db/migrate/20120705202827_add_roles_to_user_invitations.rb +8 -0
- data/db/migrate/20120716145846_create_account_domain.rb +14 -0
- data/db/migrate/20120719162426_add_subdomain_to_account.rb +9 -0
- data/lib/iugusdk.rb +73 -0
- data/lib/iugusdk/controllers/helpers.rb +45 -0
- data/lib/iugusdk/engine.rb +13 -0
- data/lib/iugusdk/locale_filter.rb +12 -0
- data/lib/iugusdk/root_tenancy_url.rb +22 -0
- data/lib/iugusdk/valid_tenancy_urls.rb +27 -0
- data/lib/iugusdk/version.rb +3 -0
- data/lib/tasks/iugusdk_tasks.rake +4 -0
- data/spec/controller_macros.rb +41 -0
- data/spec/controllers/account_controller_spec.rb +155 -0
- data/spec/controllers/account_domains_controller_spec.rb +173 -0
- data/spec/controllers/account_roles_controller_spec.rb +48 -0
- data/spec/controllers/account_settings_controller_spec.rb +42 -0
- data/spec/controllers/account_users_controller_spec.rb +145 -0
- data/spec/controllers/application_domain_controller_spec.rb +29 -0
- data/spec/controllers/invitations_controller_spec.rb +102 -0
- data/spec/controllers/profile_controller_spec.rb +125 -0
- data/spec/controllers/settings_controller_spec.rb +14 -0
- data/spec/dummy/Rakefile +7 -0
- data/spec/dummy/app/assets/javascripts/application.js +9 -0
- data/spec/dummy/app/assets/stylesheets/application.css +7 -0
- data/spec/dummy/app/assets/stylesheets/default.sass +111 -0
- data/spec/dummy/app/controllers/application_controller.rb +3 -0
- data/spec/dummy/app/controllers/dashboard_controller.rb +8 -0
- data/spec/dummy/app/controllers/my_dummy_controller.rb +9 -0
- data/spec/dummy/app/helpers/application_helper.rb +2 -0
- data/spec/dummy/app/views/dashboard/index.html.haml +5 -0
- data/spec/dummy/app/views/dashboard/splash.html.haml +10 -0
- data/spec/dummy/app/views/layouts/application.html.erb +29 -0
- data/spec/dummy/app/views/layouts/dummy.html.erb +22 -0
- data/spec/dummy/app/views/my_dummy/index.html.haml +5 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/dummy/config/account_roles.yml +3 -0
- data/spec/dummy/config/application.rb +66 -0
- data/spec/dummy/config/boot.rb +10 -0
- data/spec/dummy/config/database.yml +37 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/development.rb +37 -0
- data/spec/dummy/config/environments/production.rb +60 -0
- data/spec/dummy/config/environments/test.rb +40 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/inflections.rb +10 -0
- data/spec/dummy/config/initializers/iugusdk.rb +4 -0
- data/spec/dummy/config/initializers/mime_types.rb +5 -0
- data/spec/dummy/config/initializers/secret_token.rb +7 -0
- data/spec/dummy/config/initializers/session_store.rb +8 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/spec/dummy/config/locales/en.yml +5 -0
- data/spec/dummy/config/routes.rb +69 -0
- data/spec/dummy/config/social_accounts.yml +6 -0
- data/spec/dummy/db/schema.rb +95 -0
- data/spec/dummy/public/404.html +26 -0
- data/spec/dummy/public/422.html +26 -0
- data/spec/dummy/public/500.html +26 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/dummy/script/rails +6 -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
- data/spec/dummy/tmp/restart.txt +0 -0
- data/spec/fabricators/account_domain_fabricator.rb +4 -0
- data/spec/fabricators/account_fabricator.rb +4 -0
- data/spec/fabricators/account_role_fabricator.rb +3 -0
- data/spec/fabricators/account_user_fabricator.rb +4 -0
- data/spec/fabricators/social_account_fabricator.rb +10 -0
- data/spec/fabricators/user_fabricator.rb +10 -0
- data/spec/fabricators/user_invitation_fabricator.rb +4 -0
- data/spec/mailers/iugu_mailer_spec.rb +22 -0
- data/spec/models/account_domain_spec.rb +111 -0
- data/spec/models/account_role_spec.rb +24 -0
- data/spec/models/account_spec.rb +155 -0
- data/spec/models/account_user_spec.rb +158 -0
- data/spec/models/social_account_spec.rb +36 -0
- data/spec/models/user_invitation_spec.rb +92 -0
- data/spec/models/user_spec.rb +187 -0
- data/spec/requests/account_domain_spec.rb +77 -0
- data/spec/requests/account_roles_spec.rb +45 -0
- data/spec/requests/account_spec.rb +97 -0
- data/spec/requests/account_users_spec.rb +129 -0
- data/spec/requests/omniauth_spec.rb +79 -0
- data/spec/requests/settings_spec.rb +53 -0
- data/spec/requests/user_invitation_spec.rb +40 -0
- data/spec/requests/user_spec.rb +34 -0
- data/spec/spec_helper.rb +116 -0
- data/spec/validators/email_validator_spec.rb +21 -0
- metadata +729 -0
@@ -0,0 +1,39 @@
|
|
1
|
+
class UserInvitation < ActiveRecord::Base
|
2
|
+
validates :email, :email => true, :presence => true
|
3
|
+
before_save :set_token
|
4
|
+
before_create :set_sent_at
|
5
|
+
after_create :send_email
|
6
|
+
|
7
|
+
def self.find_by_invitation_token(invitation_token)
|
8
|
+
begin
|
9
|
+
user_invitation = UserInvitation.find(id = invitation_token.gsub(/.{27}$/, ''))
|
10
|
+
if user_invitation.token == invitation_token.gsub(/^#{id}/, '')
|
11
|
+
return user_invitation
|
12
|
+
else
|
13
|
+
return nil
|
14
|
+
end
|
15
|
+
rescue
|
16
|
+
return nil
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def accept(user)
|
21
|
+
Account.find(account_id).account_users << account_user = AccountUser.create(:user_id => user.id)
|
22
|
+
account_user.set_roles(roles.split(',')) if roles
|
23
|
+
end
|
24
|
+
|
25
|
+
private
|
26
|
+
|
27
|
+
def set_token
|
28
|
+
self.token = SecureRandom.urlsafe_base64(20) unless token
|
29
|
+
end
|
30
|
+
|
31
|
+
def set_sent_at
|
32
|
+
self.sent_at = Time.now
|
33
|
+
end
|
34
|
+
|
35
|
+
def send_email
|
36
|
+
IuguMailer.invitation(self).deliver
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'mail'
|
2
|
+
|
3
|
+
class EmailValidator < ActiveModel::EachValidator
|
4
|
+
|
5
|
+
def validate_each(record,attribute,value)
|
6
|
+
begin
|
7
|
+
m = Mail::Address.new(value)
|
8
|
+
r = m.domain && m.address == value
|
9
|
+
t = m.__send__(:tree)
|
10
|
+
r &&= (t.domain.dot_atom_text.elements.size > 1)
|
11
|
+
rescue Exception => e
|
12
|
+
r = false
|
13
|
+
end
|
14
|
+
record.errors[attribute] << (options[:message] || I18n.t( :invalid, :scope => [:activerecord, :errors, :messages] ) ) unless r
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
- content_for :title do "Account Settings" end
|
2
|
+
|
3
|
+
%h3
|
4
|
+
= I18n.t "iugu.account_settings"
|
5
|
+
|
6
|
+
- if current_user_account
|
7
|
+
%div
|
8
|
+
= I18n.t "iugu.account_number"
|
9
|
+
= "#"
|
10
|
+
= current_user_account.id
|
11
|
+
%div
|
12
|
+
= I18n.t "iugu.account_roles"
|
13
|
+
= current_user_account.roles.map(&:name).to_s
|
14
|
+
|
15
|
+
- if current_user
|
16
|
+
%div
|
17
|
+
= current_user.id
|
@@ -0,0 +1,28 @@
|
|
1
|
+
- if user_signed_in?
|
2
|
+
|
3
|
+
= I18n.t "iugu.signed_id"
|
4
|
+
= current_user.email
|
5
|
+
= link_to I18n.t("iugu.settings"), settings_path
|
6
|
+
= ' | '
|
7
|
+
= link_to I18n.t("iugu.sign_out"), logout_path, :method => :delete
|
8
|
+
|
9
|
+
- else
|
10
|
+
|
11
|
+
= form_for @user, :url => login_path do |f|
|
12
|
+
%div
|
13
|
+
= f.label :email
|
14
|
+
= f.email_field :email
|
15
|
+
%div
|
16
|
+
= f.label :password
|
17
|
+
= f.password_field :password
|
18
|
+
%div
|
19
|
+
= f.check_box :remember_me
|
20
|
+
= f.label :remember_me
|
21
|
+
%div
|
22
|
+
= f.submit I18n.t("iugu.sign_in")
|
23
|
+
|
24
|
+
- SOCIAL_ACCOUNTS.keys.each do |provider|
|
25
|
+
%div
|
26
|
+
= link_to "Sign in with #{provider.capitalize}", "/login/using/#{provider}"
|
27
|
+
|
28
|
+
|
@@ -0,0 +1,8 @@
|
|
1
|
+
<p>Hello <%= @resource.email %>!</p>
|
2
|
+
|
3
|
+
<p>Someone has requested a link to change your password, and you can do this through the link below.</p>
|
4
|
+
|
5
|
+
<p><%= link_to 'Change my password', edit_password_url(@resource, :reset_password_token => @resource.reset_password_token) %></p>
|
6
|
+
|
7
|
+
<p>If you didn't request this, please ignore this email.</p>
|
8
|
+
<p>Your password won't change until you access the link above and create a new one.</p>
|
@@ -0,0 +1,7 @@
|
|
1
|
+
<p>Hello <%= @resource.email %>!</p>
|
2
|
+
|
3
|
+
<p>Your account has been locked due to an excessive amount of unsuccessful sign in attempts.</p>
|
4
|
+
|
5
|
+
<p>Click the link below to unlock your account:</p>
|
6
|
+
|
7
|
+
<p><%= link_to 'Unlock my account', unlock_url(@resource, :unlock_token => @resource.unlock_token) %></p>
|
@@ -0,0 +1,76 @@
|
|
1
|
+
- content_for :title do "Profile Settings" end
|
2
|
+
%div
|
3
|
+
%h3
|
4
|
+
= I18n.t "iugu.profile_settings"
|
5
|
+
|
6
|
+
= simple_form_for @user, :url => profile_update_path, :method => :post do |f|
|
7
|
+
- if @user.errors.any?
|
8
|
+
#error_explanation{ :style => "margin-bottom: 15px" }
|
9
|
+
%h2
|
10
|
+
= pluralize(@user.errors.count, "error")
|
11
|
+
in your settings form
|
12
|
+
|
13
|
+
%ul
|
14
|
+
- @user.errors.full_messages.each do |msg|
|
15
|
+
%li
|
16
|
+
= msg
|
17
|
+
|
18
|
+
%div
|
19
|
+
= f.label :name
|
20
|
+
= f.text_field :name
|
21
|
+
|
22
|
+
%div
|
23
|
+
= f.label :email
|
24
|
+
= f.email_field :email
|
25
|
+
|
26
|
+
%div
|
27
|
+
= f.input :birthdate, :as => :date, :start_year => Date.today.year - 100, :end_year => Date.today.year - 5, :order => [:day, :month, :year]
|
28
|
+
|
29
|
+
%div
|
30
|
+
= f.input :locale, :collection => AvailableLanguage.all
|
31
|
+
|
32
|
+
%div
|
33
|
+
= f.submit "OK"
|
34
|
+
|
35
|
+
%div
|
36
|
+
%h3
|
37
|
+
= I18n.t "iugu.change_password"
|
38
|
+
|
39
|
+
= simple_form_for @user, :url => profile_update_path, :method => :post do |f|
|
40
|
+
|
41
|
+
%div
|
42
|
+
= f.label :password
|
43
|
+
= f.password_field :password
|
44
|
+
|
45
|
+
%div
|
46
|
+
= f.label :password_confirmation
|
47
|
+
= f.password_field :password_confirmation
|
48
|
+
|
49
|
+
%div
|
50
|
+
= f.submit "OK", :id => "new_password_submit"
|
51
|
+
|
52
|
+
%div
|
53
|
+
%h3
|
54
|
+
= I18n.t "iugu.social_account"
|
55
|
+
|
56
|
+
- @social_accounts.each do |social_account|
|
57
|
+
|
58
|
+
%div
|
59
|
+
= social_account.provider.capitalize
|
60
|
+
UID:
|
61
|
+
= social_account.social_id
|
62
|
+
= link_to "Remove", social_destroy_path(:id => social_account.id)
|
63
|
+
|
64
|
+
- SOCIAL_ACCOUNTS.keys.each do |provider|
|
65
|
+
|
66
|
+
- unless @social_accounts.where(:provider => provider).first
|
67
|
+
%div
|
68
|
+
= link_to "Sign in with #{provider.capitalize}", "/login/using/#{provider}"
|
69
|
+
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
|
74
|
+
|
75
|
+
|
76
|
+
|
@@ -0,0 +1,36 @@
|
|
1
|
+
%h2
|
2
|
+
= I18n.t "iugu.sign_up"
|
3
|
+
|
4
|
+
- @user = User.new unless @user
|
5
|
+
= form_for @user, :url => signup_path do |f|
|
6
|
+
|
7
|
+
- if @user.errors.any?
|
8
|
+
#error_explanation{ :style => "margin-bottom: 15px" }
|
9
|
+
%h2
|
10
|
+
= pluralize(@user.errors.count, "error")
|
11
|
+
in your signup form
|
12
|
+
|
13
|
+
%ul
|
14
|
+
- @user.errors.full_messages.each do |msg|
|
15
|
+
%li
|
16
|
+
= msg
|
17
|
+
|
18
|
+
%div
|
19
|
+
= f.label :email
|
20
|
+
= f.email_field :email
|
21
|
+
|
22
|
+
%div
|
23
|
+
= f.label :password
|
24
|
+
= f.password_field :password
|
25
|
+
|
26
|
+
%div
|
27
|
+
= f.label :password_confirmation
|
28
|
+
= f.password_field :password_confirmation
|
29
|
+
|
30
|
+
%div
|
31
|
+
= f.submit I18n.t "iugu.sign_up"
|
32
|
+
|
33
|
+
- SOCIAL_ACCOUNTS.keys.each do |provider|
|
34
|
+
%div
|
35
|
+
= link_to "Sign in with #{provider.capitalize}", "/login/using/#{provider}"
|
36
|
+
|
@@ -0,0 +1,33 @@
|
|
1
|
+
%h2
|
2
|
+
= I18n.t("iugu.account_domains") + " (##{@account.id})"
|
3
|
+
|
4
|
+
%div
|
5
|
+
= simple_form_for @account_domain, :url => create_domain_path(@account.id) do |f|
|
6
|
+
= f.text_field :url
|
7
|
+
= f.submit I18n.t("iugu.add")
|
8
|
+
%br
|
9
|
+
%div
|
10
|
+
- @account_domains.each do |domain|
|
11
|
+
%div
|
12
|
+
|
13
|
+
= domain.url
|
14
|
+
|
15
|
+
|
|
16
|
+
- if domain.primary
|
17
|
+
= I18n.t("iugu.primary")
|
18
|
+
- else
|
19
|
+
= link_to I18n.t("iugu.set_primary"), primary_domain_path(:account_id => @account.id, :domain_id => domain.id), :method => :post
|
20
|
+
|
21
|
+
|
|
22
|
+
- if domain.verified
|
23
|
+
= I18n.t("iugu.verified")
|
24
|
+
- else
|
25
|
+
= I18n.t("iugu.not_verified")
|
26
|
+
= link_to I18n.t("iugu.instructions"), account_domains_instructions_path(:account_id => @account.id, :domain_id => domain.id)
|
27
|
+
|
28
|
+
- if current_user.is?(:owner, @account)
|
29
|
+
|
|
30
|
+
= link_to I18n.t("iugu.remove"), account_domains_destroy_path(:account_id => @account.id, :domain_id => domain.id), :method => :delete
|
31
|
+
|
32
|
+
|
33
|
+
|
File without changes
|
@@ -0,0 +1,17 @@
|
|
1
|
+
= form_tag(account_roles_update_path(:id => @account.id, :user_id => @account_user.user_id)) do
|
2
|
+
|
3
|
+
- if current_user.is?(:owner, @account)
|
4
|
+
- APP_ROLES['roles'].each do |role|
|
5
|
+
%div
|
6
|
+
= check_box_tag "roles[]", role, @account_user.is?(role), :id => "#{role}_checkbox"
|
7
|
+
= label_tag "#{role}_checkbox", role
|
8
|
+
|
9
|
+
- elsif current_user.is?(:admin, @account)
|
10
|
+
- APP_ROLES['roles'].each do |role|
|
11
|
+
- unless role == APP_ROLES['owner_role'] || role == APP_ROLES['admin_role']
|
12
|
+
%div
|
13
|
+
= check_box_tag "roles[]", role, @account_user.is?(role), :id => "#{role}_checkbox"
|
14
|
+
= label_tag "#{role}_checkbox", role
|
15
|
+
|
16
|
+
%div
|
17
|
+
= submit_tag I18n.t("iugu.save")
|
File without changes
|
@@ -0,0 +1,23 @@
|
|
1
|
+
- content_for :title do "Account Users" end
|
2
|
+
|
3
|
+
- @account_users.each do |account_user|
|
4
|
+
%div
|
5
|
+
= account_user.user.name || account_user.user.email
|
6
|
+
- if current_user.is?(:owner, @account) || current_user.is?(:admin, @account)
|
7
|
+
|
|
8
|
+
= link_to I18n.t("iugu.permissions"), account_roles_edit_path(:id => @account.id, :user_id => account_user.user_id)
|
9
|
+
- unless account_user.destroying?
|
10
|
+
- unless account_user.is?(:owner) || account_user.user_id == current_user.id
|
11
|
+
|
|
12
|
+
= link_to I18n.t("iugu.remove"), account_users_destroy_path(:account_id => account_user.account_id, :user_id => account_user.user_id), :method => 'delete'
|
13
|
+
- else
|
14
|
+
|
|
15
|
+
- if IuguSDK::delay_account_user_exclusion == 0
|
16
|
+
= I18n.t("iugu.removing")
|
17
|
+
- else
|
18
|
+
= link_to I18n.t("iugu.undo"), account_users_cancel_destruction_path(:account_id => account_user.account_id, :user_id => account_user.user_id), :method => 'delete'
|
19
|
+
|
20
|
+
%br
|
21
|
+
%br
|
22
|
+
%div
|
23
|
+
= link_to I18n.t("iugu.invite"), new_invite_path(:account_id => @account.id)
|
File without changes
|
@@ -0,0 +1,8 @@
|
|
1
|
+
%h2 Resend confirmation instructions
|
2
|
+
= simple_form_for(resource, :as => resource_name, :url => confirmation_path(resource_name), :html => { :method => :post }) do |f|
|
3
|
+
= f.error_notification
|
4
|
+
.inputs
|
5
|
+
= f.input :email, :required => true
|
6
|
+
.actions
|
7
|
+
= f.button :submit, "Resend confirmation instructions"
|
8
|
+
= render :partial => "devise/shared/links"
|
@@ -0,0 +1,8 @@
|
|
1
|
+
%div
|
2
|
+
= I18n.t("iugu.invited_by")
|
3
|
+
= @inviter.name
|
4
|
+
%div
|
5
|
+
= I18n.t("iugu.account")
|
6
|
+
= @user_invitation.account_id
|
7
|
+
%div
|
8
|
+
= link_to I18n.t("iugu.accept"), update_invite_path(:invitation_token => @user_invitation.id.to_s + @user_invitation.token), :method => :post
|
@@ -0,0 +1,13 @@
|
|
1
|
+
= simple_form_for @user_invitation, :url => create_invite_path(:account_id => @account_id), :method => :post do |f|
|
2
|
+
|
3
|
+
%div
|
4
|
+
= f.label :email
|
5
|
+
= f.email_field :email
|
6
|
+
- APP_ROLES['roles'].each do |role|
|
7
|
+
%div
|
8
|
+
= check_box_tag "user_invitation[roles][]", role, false, :id => "#{role}_checkbox"
|
9
|
+
= label_tag "#{role}_checkbox", role
|
10
|
+
|
11
|
+
%div
|
12
|
+
= f.submit I18n.t("iugu.invite")
|
13
|
+
|
@@ -0,0 +1 @@
|
|
1
|
+
= link_to edit_invite_url(:invitation_token => @user_invitation.id.to_s + @user_invitation.token), edit_invite_url(:invitation_token => @user_invitation.id.to_s + @user_invitation.token)
|
@@ -0,0 +1,5 @@
|
|
1
|
+
%p
|
2
|
+
Hello #{@resource.email}!
|
3
|
+
%p Your account has been locked due to an excessive amount of unsuccessful sign in attempts.
|
4
|
+
%p Click the link below to unlock your account:
|
5
|
+
%p= link_to 'Unlock my account', unlock_url(@resource, :unlock_token => @resource.unlock_token)
|
@@ -0,0 +1,11 @@
|
|
1
|
+
%h2 Change your password
|
2
|
+
= simple_form_for(resource, :as => resource_name, :url => password_path(resource_name), :html => { :method => :put }) do |f|
|
3
|
+
= f.error_notification
|
4
|
+
= f.input :reset_password_token, :as => :hidden
|
5
|
+
= f.full_error :reset_password_token
|
6
|
+
.inputs
|
7
|
+
= f.input :password, :label => "New password", :required => true
|
8
|
+
= f.input :password_confirmation, :label => "Confirm your new password", :required => true
|
9
|
+
.actions
|
10
|
+
= f.button :submit, "Change my password"
|
11
|
+
= render :partial => "devise/shared/links"
|
@@ -0,0 +1,8 @@
|
|
1
|
+
%h2 Forgot your password?
|
2
|
+
= simple_form_for(resource, :as => resource_name, :url => password_path(resource_name), :html => { :method => :post }) do |f|
|
3
|
+
= f.error_notification
|
4
|
+
.inputs
|
5
|
+
= f.input :email, :required => true
|
6
|
+
.actions
|
7
|
+
= f.button :submit, "Send me reset password instructions"
|
8
|
+
= render :partial => "devise/shared/links"
|
@@ -0,0 +1,15 @@
|
|
1
|
+
%h2
|
2
|
+
Edit #{resource_name.to_s.humanize}
|
3
|
+
= simple_form_for(resource, :as => resource_name, :url => registration_path(resource_name), :html => { :method => :put }) do |f|
|
4
|
+
= f.error_notification
|
5
|
+
.inputs
|
6
|
+
= f.input :email, :required => true, :autofocus => true
|
7
|
+
= f.input :password, :autocomplete => "off", :hint => "leave it blank if you don't want to change it", :required => false
|
8
|
+
= f.input :password_confirmation, :required => false
|
9
|
+
= f.input :current_password, :hint => "we need your current password to confirm your changes", :required => true
|
10
|
+
.actions
|
11
|
+
= f.button :submit, "Update"
|
12
|
+
%h3 Cancel my account
|
13
|
+
%p
|
14
|
+
Unhappy? #{link_to "Cancel my account", registration_path(resource_name), :confirm => "Are you sure?", :method => :delete}.
|
15
|
+
= link_to "Back", :back
|
@@ -0,0 +1,11 @@
|
|
1
|
+
%h2 Sign up
|
2
|
+
= simple_form_for(resource, :as => resource_name, :url => registration_path(resource_name)) do |f|
|
3
|
+
= f.error_notification
|
4
|
+
.inputs
|
5
|
+
= f.input :email, :required => true, :autofocus => true
|
6
|
+
= f.input :password, :required => true
|
7
|
+
= f.input :password_confirmation, :required => true
|
8
|
+
= f.hidden_field :locale, :value => @matched_locale_from_browser
|
9
|
+
.actions
|
10
|
+
= f.button :submit, "Sign up"
|
11
|
+
= render :partial => "devise/shared/links"
|
@@ -0,0 +1,9 @@
|
|
1
|
+
%h2 Sign in
|
2
|
+
= simple_form_for(resource, :as => resource_name, :url => session_path(resource_name)) do |f|
|
3
|
+
.inputs
|
4
|
+
= f.input :email, :required => false, :autofocus => true
|
5
|
+
= f.input :password, :required => false
|
6
|
+
= f.input :remember_me, :as => :boolean if devise_mapping.rememberable?
|
7
|
+
.actions
|
8
|
+
= f.button :submit, "Sign in"
|
9
|
+
= render :partial => "devise/shared/links"
|