Skip to content
Browse files

Merge branch 'master' of github.com:fxposter/errbit

  • Loading branch information...
2 parents 6042525 + 0029a95 commit a3fb360ceee40b08d9bd3e753bbe605de1bc411b @fxposter fxposter committed Aug 11, 2011
View
50 README.md
@@ -100,58 +100,58 @@ for you. Checkout [Hoptoad](http://hoptoadapp.com) from the guys over at
**Configuring LDAP authentication:**
- 1. Add the following line to Errbit's Gemfile:
+ 1. In `config/config.yml`, set `user_has_username` to `true`
+ 2. Follow the instructions at https://github.com/cschiewek/devise_ldap_authenticatable
+ to set up the devise_ldap_authenticatable gem.
- gem "devise_ldap_authenticatable", :git => "git://github.com/cschiewek/devise_ldap_authenticatable.git"
+ 3. If you are authenticating by `username`, you will need to set the user's email
+ after authentication. You can do this by adding the following lines to `app/models/user.rb`:
- 2. Install new dependencies
-
- bundle install
-
- 3. Run the rails generator for `devise_ldap_authenticatable`
-
- rails generate devise_ldap_authenticatable:install --advanced
-
- 4. Configure your LDAP settings in `config/initializers/devise.rb`.
-
- 5. If you want to authenticate via `username`, then add the following lines to `app/models/user.rb`:
-
- field :username
- before_save :set_ldap_email
- def set_ldap_email
- self.email = Devise::LdapAdapter.get_ldap_param(self.username, "mail")
- end
-
-To learn more, please follow the instructions at https://github.com/cschiewek/devise_ldap_authenticatable
+ before_save :set_ldap_email
+ def set_ldap_email
+ self.email = Devise::LdapAdapter.get_ldap_param(self.username, "mail")
+ end
Upgrading
---------
-*Note*: If upgrading from a version of Errbit that used Notices embedded in Errs please run:
+*Note*: When upgrading Errbit, please run:
1. git pull origin master ( assuming origin is the github.com/jdpace/errbit repo )
2. rake db:migrate
-Lighthouseapp integration
+If we change the way that data is stored, this will run any migrations to bring your database up to date.
+
+
+Lighthouseapp Integration
-------------------------
* Account is the name of your subdomain, i.e. **litcafe** for project at http://litcafe.lighthouseapp.com/projects/73466-face/overview
* Errbit uses token-based authentication. Get your API Token or visit [http://help.lighthouseapp.com/kb/api/how-do-i-get-an-api-token](http://help.lighthouseapp.com/kb/api/how-do-i-get-an-api-token) to learn how to get it.
* Project id is number identifier of your project, i.e. **73466** for project at http://litcafe.lighthouseapp.com/projects/73466-face/overview
-Redmine integration
+Redmine Integration
-------------------------
* Account is the host of your redmine installation, i.e. **http://redmine.org**
* Errbit uses token-based authentication. Get your API Key or visit [http://www.redmine.org/projects/redmine/wiki/Rest_api#Authentication](http://www.redmine.org/projects/redmine/wiki/Rest_api#Authentication) to learn how to get it.
* Project id is an identifier of your project, i.e. **chilliproject** for project at http://www.redmine.org/projects/chilliproject
-Pivotal Tracker integration
+Pivotal Tracker Integration
-------------------------
* Errbit uses token-based authentication. Get your API Key or visit [http://www.pivotaltracker.com/help/api](http://www.pivotaltracker.com/help/api) to learn how to get it.
* Project id is an identifier of your project, i.e. **24324** for project at http://www.pivotaltracker.com/projects/24324
+Thoughtworks Mingle Integration
+-------------------------------
+
+* Account is the host of your mingle installation. i.e. **https://mingle.example.com** *note*: You should use SSL if possible.
+* Errbit uses 'sign-in name' & password authentication. You may want to set up an **errbit** user with limited rights.
+* Project id is the identifier of your project, i.e. **awesomeapp** for project at https://mingle.example.com/projects/awesomeapp
+* Card properties are comma separated key value pairs. You must specify a 'card_type', but anything else is optional. i.e. card_type = Defect, status = Open, priority = Essential
+
+
TODO
----
View
7 app/models/user.rb
@@ -7,6 +7,7 @@ class User
:recoverable, :rememberable, :trackable,
:validatable, :token_authenticatable
+ field :email
field :name
field :admin, :type => Boolean, :default => false
field :per_page, :type => Fixnum, :default => PER_PAGE
@@ -18,6 +19,11 @@ class User
attr_protected :admin
+ if Errbit::Config.user_has_username
+ field :username
+ validates_presence_of :username
+ end
+
# Mongoid doesn't seem to currently support
# referencing embedded documents
def watchers
@@ -45,3 +51,4 @@ def destroy_watchers
watchers.each(&:destroy)
end
end
+
View
2 app/views/errs/_table.html.haml
@@ -15,7 +15,7 @@
- if current_page?(:controller => 'errs')
%span.environment= link_to err.environment, errs_path(environment: err.environment)
- else
- %span.environment= link_to err.environment, app_path(environment: err.environment)
+ %span.environment= link_to err.environment, app_path(err.app, environment: err.environment)
%td.message
= link_to err.message, app_err_path(err.app, err)
%em= err.where
View
14 app/views/users/_fields.html.haml
@@ -3,24 +3,30 @@
.required
= f.label :name
= f.text_field :name
-
+
+- if Errbit::Config.user_has_username
+ .required
+ = f.label :username
+ = f.text_field :username
+
.required
= f.label :email
= f.text_field :email
.required
= f.label 'Entries per page'
= f.select :per_page, [10, 20, 30, 50, 75, 100]
-
+
.required
= f.label :password
= f.password_field :password
-
+
.required
= f.label :password_confirmation
= f.password_field :password_confirmation
- if current_user.admin?
.checkbox
= f.check_box :admin
- = f.label :admin, 'Admin?'
+ = f.label :admin, 'Admin?'
+
View
6 app/views/users/index.html.haml
@@ -6,13 +6,17 @@
%thead
%tr
%th Name
+ - if Errbit::Config.user_has_username
+ %th Username
%th.main Email
%th Admin?
%tbody
- @users.each do |user|
%tr
%td.nowrap= link_to user.name, user_path(user)
+ - if Errbit::Config.user_has_username
+ %td= user.username
%td= user.email
%td= user.admin? ? 'Y' : 'N'
= will_paginate @users, :previous_label => '« Previous', :next_label => 'Next »'
-
+
View
8 app/views/users/show.html.haml
@@ -1,15 +1,21 @@
- content_for :title, @user.name
- content_for :action_bar do
+ %span= link_to('Add a New User', new_user_path, :class => 'add')
= link_to 'edit', edit_user_path(@user), :class => 'button'
= link_to 'destroy', user_path(@user), :method => :delete, :confirm => 'Seriously?', :class => 'button'
%table.single_user
%tr
%th Email
%td.main= @user.email
+ - if Errbit::Config.user_has_username
+ %tr
+ %th Username
+ %td.main= @user.username
%tr
%th Admin?
%td= @user.admin? ? 'Y' : 'N'
%tr
%th Created
- %td= @user.created_at.to_s(:micro)
+ %td= @user.created_at.to_s(:micro)
+
View
11 config/config.example.yml
@@ -6,6 +6,7 @@
# be copied to shared/config on the server when
# `cap deploy:setup` is ran the first time. Be sure
# to place production specific settings there
+# You will need to restart the server after changing any settings.
# The host of your errbit server
host: errbit.example.com
@@ -14,13 +15,19 @@ host: errbit.example.com
# will be sent from.
email_from: errbit@example.com
-# if you turn on this option, email_at_notices will be configured on per app basis
-# at App edit page
+# If you turn on this option, email_at_notices can be
+# configured on a per app basis, at the App edit page
per_app_email_at_notices: false
# Configure when emails are sent for an error.
# [1,3,7] = 1st, 3rd, and 7th occurence triggers
# an email notification.
email_at_notices: [1, 10, 100]
+# Configure whether or not the user should be prompted before resolving an error.
confirm_resolve_err: true
+
+# Add an optional 'username' field to Users.
+# Helpful if you want to plug in your own authentication strategy.
+user_has_username: false
+
View
3 config/initializers/_load_config.rb
@@ -14,7 +14,8 @@
:domain => ENV['SENDGRID_DOMAIN']
}
else
- yaml = File.read(Rails.root.join('config','config.yml'))
+ config_file = Rails.env == "test" ? "config.example.yml" : "config.yml"
+ yaml = File.read(Rails.root.join('config', config_file))
config = YAML.load(yaml)
config.merge!(config.delete(Rails.env)) if config.has_key?(Rails.env)
View
3 config/initializers/devise.rb
@@ -20,7 +20,7 @@
# authenticating an user, both parameters are required. Remember that those
# parameters are used only when authenticating and not when retrieving from
# session. If you need permissions, you should implement that in a before filter.
- # config.authentication_keys = [ :email ]
+ config.authentication_keys = [ Errbit::Config.user_has_username ? :username : :email ]
# Tell if authentication through request.params is enabled. True by default.
# config.params_authenticatable = true
@@ -140,3 +140,4 @@
# manager.default_strategies(:scope => :user).unshift :twitter_oauth
# end
end
+
View
2 config/initializers/overrides.rb
@@ -1 +1,3 @@
require Rails.root.join('lib/overrides/mongoid/relations/builder.rb')
+require Rails.root.join('lib/overrides/devise/failure_app.rb')
+
View
3 config/initializers/secret_token.rb
@@ -4,4 +4,5 @@
# If you change this key, all old signed cookies will become invalid!
# Make sure the secret is at least 30 characters and all random,
# no regular words or you'll be exposed to dictionary attacks.
-Errbit::Application.config.secret_token = '41f6b3871b375769786c379a3e542d67a7a234926f926778ed634f40a9480ba6d7b0768993e9852aafcaa73d6b8ddd2ed3b46208b92305e8c21936574f74a9a4'
+Errbit::Application.config.secret_token = '6b74778101638fa9c156b3928c9492fb2481ab842538bea838d21f9c9993f649f5806449584266d413d0b2f1104162b3066a86512ed71ededd627cd41f939614'
+
View
6 config/locales/devise.en.yml
@@ -10,7 +10,10 @@ en:
unauthenticated: 'You need to sign in before continuing.'
unconfirmed: 'You have to confirm your account before continuing.'
locked: 'Your account is locked.'
- invalid: 'Invalid email or password.'
+ invalid: 'Invalid login details.'
+ user:
+ email_invalid: 'Invalid email or password.'
+ username_invalid: 'Invalid username or password.'
invalid_token: 'Invalid authentication token.'
timeout: 'Your session expired, please sign in again to continue.'
inactive: 'Your account was not activated yet.'
@@ -37,3 +40,4 @@ en:
subject: 'Reset password instructions'
unlock_instructions:
subject: 'Unlock Instructions'
+
View
4 db/seeds.rb
@@ -2,10 +2,12 @@
puts "-------------------------------"
# Create an initial Admin User
+admin_username = "errbit"
admin_email = "errbit@#{Errbit::Config.host}"
admin_pass = 'password'
puts "Creating an initial admin user:"
+puts "-- username: #{admin_username}" if Errbit::Config.user_has_username
puts "-- email: #{admin_email}"
puts "-- password: #{admin_pass}"
puts ""
@@ -16,6 +18,8 @@
:password => admin_pass,
:password_confirmation => admin_pass
})
+user.username = admin_username if Errbit::Config.user_has_username
user.admin = true
user.save!
+
View
15 lib/overrides/devise/failure_app.rb
@@ -0,0 +1,15 @@
+Devise::FailureApp.class_eval do
+ protected
+ # Handles both 'email_invalid' and 'username_invalid' messages.
+ def i18n_message(default = nil)
+ message = warden.message || warden_options[:message] || default || :unauthenticated
+
+ if message.is_a?(Symbol)
+ I18n.t(:"#{scope}.#{Devise.authentication_keys.first}_#{message}", :resource_name => scope,
+ :scope => "devise.failure", :default => [message, message.to_s])
+ else
+ message.to_s
+ end
+ end
+end
+
View
10 public/javascripts/form.js
@@ -66,12 +66,16 @@ function removeNestedItem() {
function activateTypeSelector(field_class, section_class) {
- section_class = section_class || field_class+"_params"; // section_class can be deduced if not given
+ var section_class = section_class || field_class+"_params"; // section_class can be deduced if not given
+ // disable all inactive tabs to avoid sending its values on server
+ $('div.'+field_class+' > div.'+section_class).not('.chosen').find('input')
+ .attr('disabled','disabled').val('');
+
$('div.'+field_class+' input[name*='+field_class+'_type]').live('click', function(){
var chosen = $(this).val();
var wrapper = $(this).closest('.nested');
- wrapper.find('div.chosen.'+section_class).removeClass('chosen');
- wrapper.find('div.'+section_class+'.'+chosen).addClass('chosen');
+ wrapper.find('div.chosen.'+section_class).removeClass('chosen').find('input').attr('disabled','disabled');
+ wrapper.find('div.'+section_class+'.'+chosen).addClass('chosen').find('input').removeAttr('disabled');
});
}
View
5 public/javascripts/notifier.js
@@ -6,7 +6,7 @@ var Errbit = {
<notifier>\
<name>errbit_notifier_js</name>\
<version>2.0</version>\
- <url>http://NOTIFIER_HOST</url>\
+ <url>https://github.com/jdpace/errbit</url>\
</notifier>\
<error>\
<class>EXCEPTION_CLASS</class>\
@@ -30,7 +30,7 @@ var Errbit = {
notify: function(error) {
var xml = escape(Errbit.generateXML(error));
var host = Errbit.host || 'github.com/jdpace/errbit';
- var url = '//' + host + '/notifier_api/v2/notices?data=' + xml;
+ var url = '//' + host + '/notifier_api/v2/notices.xml?data=' + xml;
var request = document.createElement('iframe');
request.style.width = '1px';
@@ -103,7 +103,6 @@ var Errbit = {
}
xml = xml.replace('</request>', data + '</request>')
- .replace('NOTIFIER_HOST', host)
.replace('REQUEST_URL', url)
.replace('REQUEST_ACTION', action)
.replace('REQUEST_COMPONENT', component);

0 comments on commit a3fb360

Please sign in to comment.
Something went wrong with that request. Please try again.