From 2a145e67abb72c0b6b4d67cee79995b22f196f58 Mon Sep 17 00:00:00 2001 From: goobertron Date: Sun, 9 Feb 2014 13:47:48 +0000 Subject: [PATCH] Update design of forgot_password and change_password forms Fix redirect to stream, make labels lower-case Fix cuke --- Changelog.md | 2 +- app/assets/stylesheets/new_styles/_base.scss | 4 ++- app/assets/stylesheets/new_styles/_login.scss | 8 +++++- app/controllers/passwords_controller.rb | 4 +++ app/views/devise/passwords/edit.haml | 18 ------------- app/views/devise/passwords/new.haml | 14 ---------- app/views/passwords/edit.haml | 27 +++++++++++++++++++ .../{devise => }/passwords/edit.mobile.haml | 0 app/views/passwords/new.haml | 20 ++++++++++++++ .../{devise => }/passwords/new.mobile.haml | 0 config/locales/devise/devise.en.yml | 4 +++ config/routes.rb | 2 +- features/desktop/change_password.feature | 4 +-- 13 files changed, 69 insertions(+), 38 deletions(-) create mode 100644 app/controllers/passwords_controller.rb delete mode 100644 app/views/devise/passwords/edit.haml delete mode 100644 app/views/devise/passwords/new.haml create mode 100644 app/views/passwords/edit.haml rename app/views/{devise => }/passwords/edit.mobile.haml (100%) create mode 100644 app/views/passwords/new.haml rename app/views/{devise => }/passwords/new.mobile.haml (100%) diff --git a/Changelog.md b/Changelog.md index 1b7328601..b2ac0ecd2 100644 --- a/Changelog.md +++ b/Changelog.md @@ -7,7 +7,7 @@ * Update image branding to the new decided standard [#4702](https://github.com/diaspora/diaspora/pull/4702) * Consistent naming of conversations and messages [#4756](https://github.com/diaspora/diaspora/pull/4756) * Improve stream generation time [#4769](https://github.com/diaspora/diaspora/pull/4769) - +* Update forgot_password and reset_password pages [#4707](https://github.com/diaspora/diaspora/pull/4707) ## Bug fixes * Improve time agos by updating the plugin [#4280](https://github.com/diaspora/diaspora/issues/4280) diff --git a/app/assets/stylesheets/new_styles/_base.scss b/app/assets/stylesheets/new_styles/_base.scss index d5942bf20..279f521d0 100644 --- a/app/assets/stylesheets/new_styles/_base.scss +++ b/app/assets/stylesheets/new_styles/_base.scss @@ -32,7 +32,9 @@ a { color : $link-blue } } } -#login { +#login, +#forgot_password, +#reset_password { background-image : image_url("texture/light-bg.png"); height: 100%; } diff --git a/app/assets/stylesheets/new_styles/_login.scss b/app/assets/stylesheets/new_styles/_login.scss index 9b9de1a58..77c6d0741 100644 --- a/app/assets/stylesheets/new_styles/_login.scss +++ b/app/assets/stylesheets/new_styles/_login.scss @@ -1,4 +1,6 @@ -#login { +#login, +#forgot_password, +#reset_password { position : absolute; top : 0; left : 0; @@ -8,6 +10,10 @@ //color : #fff; text-align : center; + label { + text-transform: uppercase; + } + input[type=text], input[type=password] { width : 120px; diff --git a/app/controllers/passwords_controller.rb b/app/controllers/passwords_controller.rb new file mode 100644 index 000000000..657f89809 --- /dev/null +++ b/app/controllers/passwords_controller.rb @@ -0,0 +1,4 @@ +class PasswordsController < Devise::PasswordsController + layout "application", :only => [:new] + before_filter -> { @css_framework = :bootstrap }, only: [:new, :create, :edit] +end diff --git a/app/views/devise/passwords/edit.haml b/app/views/devise/passwords/edit.haml deleted file mode 100644 index 92d2175b3..000000000 --- a/app/views/devise/passwords/edit.haml +++ /dev/null @@ -1,18 +0,0 @@ -.span-12.prepend-6.last - .floating - %h2 - = t('.change_password') - = form_for(resource, :as => resource_name, :url => password_path(resource_name), :html => { :method => :put }) do |f| - = devise_error_messages! - = f.hidden_field :reset_password_token - %p - = f.label :password, t('password') - %br/ - = f.password_field :password - %p - = f.label :password_confirmation, t('password_confirmation') - %br/ - = f.password_field :password_confirmation - %p - = f.submit t('.change_password') - = render :partial => "devise/shared/links" diff --git a/app/views/devise/passwords/new.haml b/app/views/devise/passwords/new.haml deleted file mode 100644 index 7095f9501..000000000 --- a/app/views/devise/passwords/new.haml +++ /dev/null @@ -1,14 +0,0 @@ -.span-12.prepend-6.last - .floating - %h2 - = t('.forgot_password') - - unless devise_error_messages!.empty? - %i= t('.no_account') - - = form_for(resource, :as => resource_name, :url => password_path(resource_name)) do |f| - %p - = f.label :email, t('email') - = f.text_field :email - %p - = f.submit t('.send_password_instructions') - = render :partial => "devise/shared/links" diff --git a/app/views/passwords/edit.haml b/app/views/passwords/edit.haml new file mode 100644 index 000000000..e4316a94c --- /dev/null +++ b/app/views/passwords/edit.haml @@ -0,0 +1,27 @@ +- content_for :page_title do + = "#{AppConfig.settings.pod_name} / #{t('devise.passwords.edit.change_password')}" + +#reset_password + %h1{id: "huge-text"}= AppConfig.settings.pod_name + + = form_for(resource, :as => resource_name, :url => password_path(resource_name), :html => {:class => "form-horizontal block-form", :method => :put }, :autocomplete => 'off') do |f| + %fieldset + = f.hidden_field :reset_password_token + .control-group + %label{class: "control-label", for: "user_password", style: "width: 45%; text-align: right; padding: 10px 0; overflow: hidden"} + = t('devise.passwords.edit.new_password') + .controls + = f.password_field :password, :required => true, :placeholder => "••••••••", :autocapitalize => "off", :autocorrect => "off", :autofocus => true, :style => "width: 55%;" + .control-group + %label{class: "control-label", for: "user_password_confirmation", style: "width: 45%; text-align: right; padding: 10px 0; overflow: hidden"} + = t('devise.passwords.edit.confirm_password') + .controls + = f.password_field :password_confirmation, :required => true, :placeholder => "••••••••", :autocapitalize => "off", :autocorrect => "off", :style => "width: 55%;" + = hidden_field(:user, :remember_me, :value => 1) + = f.submit t('devise.passwords.edit.change_password'), :class => "new-btn" + + %br/ + %br/ + %br/ + = link_to t('devise.shared.links.sign_in'), new_session_path(resource_name) + diff --git a/app/views/devise/passwords/edit.mobile.haml b/app/views/passwords/edit.mobile.haml similarity index 100% rename from app/views/devise/passwords/edit.mobile.haml rename to app/views/passwords/edit.mobile.haml diff --git a/app/views/passwords/new.haml b/app/views/passwords/new.haml new file mode 100644 index 000000000..9ffcca124 --- /dev/null +++ b/app/views/passwords/new.haml @@ -0,0 +1,20 @@ +- content_for :page_title do + = "#{AppConfig.settings.pod_name} / #{t('devise.passwords.new.forgot_password')}" + +#forgot_password + %h1{id: "huge-text"}= AppConfig.settings.pod_name + + = form_for(resource, :as => resource_name, :url => password_path(resource_name), :html => {:class => "form-horizontal block-form"}, :autocomplete => 'off') do |f| + %fieldset + .control-group + %label{class: "control-label", for: "user_email", style: "width: 40%; text-align: center; padding: 10px 0; overflow: hidden"} + = t('devise.passwords.new.email') + .controls + = f.text_field :email, :required => true, :autocapitalize => "off", :placeholder => "••••••••", :autocorrect => "off", :autofocus => true, :style => "width: 60%;" + = f.submit t('devise.passwords.new.send_password_instructions'), :class => "new-btn" + + %br/ + %br/ + %br/ + = link_to t('devise.shared.links.sign_in'), new_session_path(resource_name) + diff --git a/app/views/devise/passwords/new.mobile.haml b/app/views/passwords/new.mobile.haml similarity index 100% rename from app/views/devise/passwords/new.mobile.haml rename to app/views/passwords/new.mobile.haml diff --git a/config/locales/devise/devise.en.yml b/config/locales/devise/devise.en.yml index cd6417802..ae07c7787 100644 --- a/config/locales/devise/devise.en.yml +++ b/config/locales/devise/devise.en.yml @@ -30,9 +30,13 @@ en: updated: 'Your password was changed successfully. You are now signed in.' edit: change_password: "Change my password" + new_password: "New password" + confirm_password: "Confirm password" new: forgot_password: "Forgot your password?" no_account: 'No account with this email exists' + reset_password: "Reset password" + email: "Email address" send_password_instructions: "Send me reset password instructions" confirmations: send_instructions: 'You will receive an email with instructions about how to confirm your account in a few minutes.' diff --git a/config/routes.rb b/config/routes.rb index a40fd9131..6ce3648f3 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -108,7 +108,7 @@ Diaspora::Application.routes.draw do match 'users/edit' => redirect('/user/edit') devise_for :users, :controllers => {:registrations => "registrations", - :password => "devise/passwords", + :passwords => "passwords", :sessions => "sessions"} #legacy routes to support old invite routes diff --git a/features/desktop/change_password.feature b/features/desktop/change_password.feature index 113f106ec..889d97e08 100644 --- a/features/desktop/change_password.feature +++ b/features/desktop/change_password.feature @@ -14,11 +14,11 @@ Feature: Change password Scenario: Reset my password Given a user with email "forgetful@users.net" Given I am on forgot password page - When I fill out forgot password form with "Forgetful@users.net" + When I fill out forgot password form with "forgetful@users.net" And I submit forgot password form Then I should see "You will receive an email with instructions" When I follow the "Change my password" link from the last sent email - Then I should see "Change my password" + Then I should see "NEW PASSWORD" When I fill out reset password form with "supersecret" and "supersecret" And I submit reset password form Then I should be on the stream page