Add mobile signup page captcha. Add test for user.sign_up method. Rewrite simple_captcha views to haml. Revert .rvmrc, fix indentation in config examp$
This commit is contained in:
parent
c17a474142
commit
db71c9c50b
12 changed files with 81 additions and 27 deletions
23
.rvmrc
23
.rvmrc
|
|
@ -1,2 +1,21 @@
|
||||||
rvm use 1.9.3-p484
|
#!/bin/sh
|
||||||
rvm gemset use diaspora
|
|
||||||
|
rvm rvmrc warning ignore
|
||||||
|
|
||||||
|
. ./script/env/ruby_env
|
||||||
|
|
||||||
|
if [ -e '.rvmrc.local' ]; then
|
||||||
|
. ./.rvmrc.local;
|
||||||
|
elif [ -e '.rvmrc_custom' ] ; then
|
||||||
|
. ./.rvmrc_custom;
|
||||||
|
else
|
||||||
|
if rvm list strings | grep -q "$ruby_version" ; then
|
||||||
|
rvm --create use "$ruby_version@$gemset"
|
||||||
|
else
|
||||||
|
printf "\e[00;31mPLEASE INSTALL RUBY $ruby_version WITH \`rvm install $ruby_version\`\n"
|
||||||
|
printf "Don't forget to run \`cd .. && cd -\` afterwards!\e[00m\n"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
. ./script/env/ensure_right_rubygems
|
||||||
|
|
|
||||||
|
|
@ -76,6 +76,7 @@ For more details see https://wiki.diasporafoundation.org/Updating
|
||||||
* Add actions on aspects on the contact page [#4570](https://github.com/diaspora/diaspora/pull/4570)
|
* Add actions on aspects on the contact page [#4570](https://github.com/diaspora/diaspora/pull/4570)
|
||||||
* Added a statistics route with general pod information, and if enabled in pod settings, total user, half year/monthly active users and local post counts [#4602](https://github.com/diaspora/diaspora/pull/4602)
|
* Added a statistics route with general pod information, and if enabled in pod settings, total user, half year/monthly active users and local post counts [#4602](https://github.com/diaspora/diaspora/pull/4602)
|
||||||
* Add indication about markdown formatting in the publisher [#4589](https://github.com/diaspora/diaspora/pull/4589)
|
* Add indication about markdown formatting in the publisher [#4589](https://github.com/diaspora/diaspora/pull/4589)
|
||||||
|
* Add captcha to signup form [#4659](https://github.com/diaspora/diaspora/pull/4659)
|
||||||
|
|
||||||
## Gem updates
|
## Gem updates
|
||||||
* selenium-webdriver 2.34.0 -> 2.39.0
|
* selenium-webdriver 2.34.0 -> 2.39.0
|
||||||
|
|
|
||||||
2
Gemfile
2
Gemfile
|
|
@ -17,7 +17,7 @@ gem 'devise', '3.0.2'
|
||||||
|
|
||||||
# Captcha
|
# Captcha
|
||||||
|
|
||||||
gem 'galetahub-simple_captcha', :require => 'simple_captcha'
|
gem 'galetahub-simple_captcha', '0.1.5', :require => 'simple_captcha'
|
||||||
|
|
||||||
# Background processing
|
# Background processing
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -449,7 +449,7 @@ DEPENDENCIES
|
||||||
foreigner (= 1.4.2)
|
foreigner (= 1.4.2)
|
||||||
foreman (= 0.62)
|
foreman (= 0.62)
|
||||||
fuubar (= 1.1.1)
|
fuubar (= 1.1.1)
|
||||||
galetahub-simple_captcha
|
galetahub-simple_captcha (= 0.1.5)
|
||||||
gon (= 4.1.1)
|
gon (= 4.1.1)
|
||||||
guard-cucumber (= 1.4.0)
|
guard-cucumber (= 1.4.0)
|
||||||
guard-rspec (= 3.0.2)
|
guard-rspec (= 3.0.2)
|
||||||
|
|
|
||||||
|
|
@ -485,6 +485,7 @@ class User < ActiveRecord::Base
|
||||||
save
|
save
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
def clearable_fields
|
def clearable_fields
|
||||||
self.attributes.keys - ["id", "username", "encrypted_password",
|
self.attributes.keys - ["id", "username", "encrypted_password",
|
||||||
|
|
|
||||||
|
|
@ -44,6 +44,9 @@
|
||||||
.controls
|
.controls
|
||||||
= f.password_field :password_confirmation, :placeholder => "••••••••"
|
= f.password_field :password_confirmation, :placeholder => "••••••••"
|
||||||
|
|
||||||
|
- if AppConfig.settings.captcha.enable?
|
||||||
|
= show_simple_captcha(:object => 'user', :code_type => 'numeric')
|
||||||
|
|
||||||
.controls
|
.controls
|
||||||
= f.submit t('registrations.new.create_my_account'), :class => 'btn primary', :disable_with => t('registrations.new.submitting')
|
= f.submit t('registrations.new.create_my_account'), :class => 'btn primary', :disable_with => t('registrations.new.submitting')
|
||||||
= link_to t('devise.sessions.new.sign_in'), new_user_session_path(), :class => 'btn primary', :style => "float: right;"
|
= link_to t('devise.sessions.new.sign_in'), new_user_session_path(), :class => 'btn primary', :style => "float: right;"
|
||||||
|
|
|
||||||
|
|
@ -1,8 +0,0 @@
|
||||||
<div class='control-label'>
|
|
||||||
<%= simple_captcha_options[:image] %>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class='controls'>
|
|
||||||
<%= simple_captcha_options[:field] %>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
4
app/views/simple_captcha/_simple_captcha.haml
Normal file
4
app/views/simple_captcha/_simple_captcha.haml
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
.control-label
|
||||||
|
= simple_captcha_options[:image]
|
||||||
|
.controls
|
||||||
|
= simple_captcha_options[:field]
|
||||||
4
app/views/simple_captcha/_simple_captcha.mobile.haml
Normal file
4
app/views/simple_captcha/_simple_captcha.mobile.haml
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
.control-group#captcha
|
||||||
|
= simple_captcha_options[:image]
|
||||||
|
.controls
|
||||||
|
= simple_captcha_options[:field]
|
||||||
|
|
@ -227,24 +227,24 @@ configuration: ## Section
|
||||||
## Settings about captcha
|
## Settings about captcha
|
||||||
captcha: ## Section
|
captcha: ## Section
|
||||||
|
|
||||||
## Set this to false if you don't want to use captcha for signup process
|
## Set this to false if you don't want to use captcha for signup process
|
||||||
#enable: true
|
#enable: true
|
||||||
|
|
||||||
## Change this value to use different captcha image size
|
## Change this value to use different captcha image size
|
||||||
#image_size: '120x20'
|
#image_size: '120x20'
|
||||||
|
|
||||||
## Length of captcha text. Default value is 5
|
## Length of captcha text. Default value is 5
|
||||||
#captcha_length: 5
|
#captcha_length: 5
|
||||||
|
|
||||||
## Change this value to use various image style.
|
## Change this value to use various image style.
|
||||||
## Available options are: 'simply_blue', 'simply_red'
|
## Available options are: 'simply_blue', 'simply_red'
|
||||||
## 'simply_green', 'charcoal_grey', 'embosed_silver', 'all_black',
|
## 'simply_green', 'charcoal_grey', 'embosed_silver', 'all_black',
|
||||||
## 'distorted_black', 'almost_invisible', 'random'
|
## 'distorted_black', 'almost_invisible', 'random'
|
||||||
#image_style: 'simply_green'
|
#image_style: 'simply_green'
|
||||||
|
|
||||||
## Set this value to use various level of distortion
|
## Set this value to use various level of distortion
|
||||||
## Available options are: 'low', 'medium', 'high', 'random'
|
## Available options are: 'low', 'medium', 'high', 'random'
|
||||||
#distortion: 'low'
|
#distortion: 'low'
|
||||||
|
|
||||||
## Settings about invitations
|
## Settings about invitations
|
||||||
invitations: ## Section
|
invitations: ## Section
|
||||||
|
|
|
||||||
|
|
@ -316,8 +316,8 @@ ActiveRecord::Schema.define(:version => 20131213171804) do
|
||||||
t.boolean "favorite", :default => false
|
t.boolean "favorite", :default => false
|
||||||
t.string "facebook_id"
|
t.string "facebook_id"
|
||||||
t.string "tweet_id"
|
t.string "tweet_id"
|
||||||
t.integer "open_graph_cache_id"
|
|
||||||
t.text "tumblr_ids"
|
t.text "tumblr_ids"
|
||||||
|
t.integer "open_graph_cache_id"
|
||||||
end
|
end
|
||||||
|
|
||||||
add_index "posts", ["author_id", "root_guid"], :name => "index_posts_on_author_id_and_root_guid", :unique => true
|
add_index "posts", ["author_id", "root_guid"], :name => "index_posts_on_author_id_and_root_guid", :unique => true
|
||||||
|
|
|
||||||
|
|
@ -1018,4 +1018,34 @@ describe User do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe "sign up" do
|
||||||
|
before do
|
||||||
|
params = {:username => "ohai",
|
||||||
|
:email => "ohai@example.com",
|
||||||
|
:password => "password",
|
||||||
|
:password_confirmation => "password",
|
||||||
|
:captcha => "12345",
|
||||||
|
|
||||||
|
:person =>
|
||||||
|
{:profile =>
|
||||||
|
{:first_name => "O",
|
||||||
|
:last_name => "Hai"}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@user = User.build(params)
|
||||||
|
end
|
||||||
|
|
||||||
|
it "saves with captcha off" do
|
||||||
|
AppConfig.settings.captcha.enable = false
|
||||||
|
@user.should_receive(:save).and_return(true)
|
||||||
|
@user.sign_up
|
||||||
|
end
|
||||||
|
|
||||||
|
it "saves with captcha on" do
|
||||||
|
AppConfig.settings.captcha.enable = true
|
||||||
|
@user.should_receive(:save_with_captcha).and_return(true)
|
||||||
|
@user.sign_up
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue