Skip to content

Commit

Permalink
Merge pull request diaspora#3647 from marpo60/3636-adds-password-conf…
Browse files Browse the repository at this point in the history
…irmation-field

adds password_confirmation field to registration page
  • Loading branch information
jhass committed Oct 13, 2012
2 parents d979ac4 + 0b21153 commit 83c2458
Show file tree
Hide file tree
Showing 9 changed files with 37 additions and 9 deletions.
1 change: 1 addition & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# 0.0.2.0pre

Add password_confirmation field to registration page
Fix error with open/close registrations.
Fix javascripts error in invitations facebox.
Fix css overflow problem in aspect dropdown on welcome page.
Expand Down
14 changes: 13 additions & 1 deletion app/assets/stylesheets/new_styles/_registration.scss
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,16 @@

max-width : 95%;
}
}

form {
.control-label,
.controls {
margin-left : auto;
width : auto;
}

.controls {
float : right;
}
}
}
6 changes: 3 additions & 3 deletions app/controllers/registrations_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ def create
Rails.logger.info("event=registration status=successful user=#{@user.diaspora_handle}")
else
@user.errors.delete(:person)

flash[:error] = @user.errors.full_messages.join(" - ")
Rails.logger.info("event=registration status=failure errors='#{@user.errors.full_messages.join(', ')}'")
render :new
redirect_to :back
end
end

Expand Down Expand Up @@ -50,6 +50,6 @@ def invite
@invite ||= InvitationCode.find_by_token(params[:invite][:token])
end
end

helper_method :invite
end
10 changes: 10 additions & 0 deletions app/views/registrations/new.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,16 @@
<%= f.password_field :password, :placeholder => "••••••••", :title => t('registrations.new.enter_password'), :required => true, :pattern => "......+" %>
</div>
</div>

<div class="control-group">
<label class="control-label" for="user_password_confirmation">
<%= t('.password_confirmation') %>
</label>

<div class="controls">
<%= f.password_field :password_confirmation, :placeholder => "••••••••", :title => t('registrations.new.enter_password_again'), :required => true, :pattern => "......+" %>
</div>
</div>
<%= invite_hidden_tag(invite) %>
</fieldset>

Expand Down
1 change: 1 addition & 0 deletions config/locales/diaspora/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -687,6 +687,7 @@ en:
email: "EMAIL"
username: "USERNAME"
password: "PASSWORD"
password_confirmation: "PASSWORD CONFIRMATION"
continue: "Continue"
create:
success: "You've joined Diaspora!"
Expand Down
2 changes: 2 additions & 0 deletions features/accepts_invitation.feature
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Feature: invitation acceptance
| user_username | ohai |
| user_email | woot@sweet.com |
| user_password | secret |
| user_password_confirmation | secret |
And I press "Continue"
Then I should be on the getting started page
And I should see "Well, hello there!"
Expand All @@ -24,6 +25,7 @@ Feature: invitation acceptance
| user_username | ohai |
| user_email | woot@sweet.com |
| user_password | secret |
| user_password_confirmation | secret |
And I press "Continue"
Then I should be on the getting started page
And I should see "Well, hello there!"
Expand Down
7 changes: 4 additions & 3 deletions features/signs_up.feature
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ Feature: new user registration
Background:
When I go to the new user registration page
And I fill in the following:
| user_username | ohai |
| user_email | ohai@example.com |
| user_password | secret |
| user_username | ohai |
| user_email | ohai@example.com |
| user_password | secret |
| user_password_confirmation | secret |
And I press "Continue"
Then I should be on the getting started page
And I should see "Well, hello there!" and "Who are you?" and "What are you into?"
Expand Down
1 change: 1 addition & 0 deletions features/step_definitions/user_steps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@
step 'I fill in "user_username" with "ohai"'
step 'I fill in "user_email" with "[email protected]"'
step 'I fill in "user_password" with "secret"'
step 'I fill in "user_password_confirmation" with "secret"'
end

And /^I should be able to friend Alice$/ do
Expand Down
4 changes: 2 additions & 2 deletions spec/controllers/registrations_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,9 @@
flash[:error].should_not be_blank
end

it "re-renders the form" do
it "redirects back" do
get :create, @invalid_params
response.should render_template("registrations/new")
response.should be_redirect
end
end
end
Expand Down

0 comments on commit 83c2458

Please sign in to comment.