From: eagletmt Date: Mon, 22 Oct 2012 04:48:42 +0000 (+0900) Subject: Adjust account registration views X-Git-Tag: v1.0~71^2~12^2~4 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=d27bdb01c6addb53daf87e3f5988c0d88141a512;p=sharp4k%2FCUTEn.git Adjust account registration views --- diff --git a/CutenServer/app/views/devise/confirmations/new.html.haml b/CutenServer/app/views/teachers/confirmations/new.html.haml similarity index 100% rename from CutenServer/app/views/devise/confirmations/new.html.haml rename to CutenServer/app/views/teachers/confirmations/new.html.haml diff --git a/CutenServer/app/views/devise/mailer/confirmation_instructions.html.haml b/CutenServer/app/views/teachers/mailer/confirmation_instructions.html.haml similarity index 100% rename from CutenServer/app/views/devise/mailer/confirmation_instructions.html.haml rename to CutenServer/app/views/teachers/mailer/confirmation_instructions.html.haml diff --git a/CutenServer/app/views/devise/mailer/reset_password_instructions.html.haml b/CutenServer/app/views/teachers/mailer/reset_password_instructions.html.haml similarity index 100% rename from CutenServer/app/views/devise/mailer/reset_password_instructions.html.haml rename to CutenServer/app/views/teachers/mailer/reset_password_instructions.html.haml diff --git a/CutenServer/app/views/devise/mailer/unlock_instructions.html.haml b/CutenServer/app/views/teachers/mailer/unlock_instructions.html.haml similarity index 100% rename from CutenServer/app/views/devise/mailer/unlock_instructions.html.haml rename to CutenServer/app/views/teachers/mailer/unlock_instructions.html.haml diff --git a/CutenServer/app/views/devise/passwords/edit.html.haml b/CutenServer/app/views/teachers/passwords/edit.html.haml similarity index 100% rename from CutenServer/app/views/devise/passwords/edit.html.haml rename to CutenServer/app/views/teachers/passwords/edit.html.haml diff --git a/CutenServer/app/views/devise/passwords/new.html.haml b/CutenServer/app/views/teachers/passwords/new.html.haml similarity index 100% rename from CutenServer/app/views/devise/passwords/new.html.haml rename to CutenServer/app/views/teachers/passwords/new.html.haml diff --git a/CutenServer/app/views/devise/registrations/edit.html.haml b/CutenServer/app/views/teachers/registrations/edit.html.haml similarity index 91% rename from CutenServer/app/views/devise/registrations/edit.html.haml rename to CutenServer/app/views/teachers/registrations/edit.html.haml index 52b20ea..3c8b74b 100644 --- a/CutenServer/app/views/devise/registrations/edit.html.haml +++ b/CutenServer/app/views/teachers/registrations/edit.html.haml @@ -20,10 +20,6 @@ %i (we need your current password to confirm your changes) %br/ = f.password_field :current_password - %div - = f.label :student_number - %br/ - = f.text_field :student_number %div= f.submit "Update" %h3 Cancel my account %p diff --git a/CutenServer/app/views/teachers/registrations/new.html.haml b/CutenServer/app/views/teachers/registrations/new.html.haml new file mode 100644 index 0000000..771b86d --- /dev/null +++ b/CutenServer/app/views/teachers/registrations/new.html.haml @@ -0,0 +1,21 @@ +%h2 Sign up += form_for(resource, :as => resource_name, :url => registration_path(resource_name)) do |f| + = devise_error_messages! + %div + = f.label :email + %br/ + = f.email_field :email + %div + = f.label :password + %br/ + = f.password_field :password + %div + = f.label :password_confirmation + %br/ + = f.password_field :password_confirmation + %div + = f.label :name + %br/ + = f.text_field :name + %div= f.submit "Sign up" += render "devise/shared/links" diff --git a/CutenServer/app/views/teachers/sessions/new.html.haml b/CutenServer/app/views/teachers/sessions/new.html.haml new file mode 100644 index 0000000..99cfee7 --- /dev/null +++ b/CutenServer/app/views/teachers/sessions/new.html.haml @@ -0,0 +1,16 @@ +%h2 Sign in += form_for(resource, :as => resource_name, :url => session_path(resource_name)) do |f| + %div + = f.label :email + %br/ + = f.email_field :email + %div + = f.label :password + %br/ + = f.password_field :password + - if devise_mapping.rememberable? + %div + = f.check_box :remember_me + = f.label :remember_me + %div= f.submit "Sign in" += render "devise/shared/links" diff --git a/CutenServer/app/views/devise/shared/_links.haml b/CutenServer/app/views/teachers/shared/_links.haml similarity index 100% rename from CutenServer/app/views/devise/shared/_links.haml rename to CutenServer/app/views/teachers/shared/_links.haml diff --git a/CutenServer/app/views/devise/unlocks/new.html.haml b/CutenServer/app/views/teachers/unlocks/new.html.haml similarity index 100% rename from CutenServer/app/views/devise/unlocks/new.html.haml rename to CutenServer/app/views/teachers/unlocks/new.html.haml diff --git a/CutenServer/app/views/users/confirmations/new.html.haml b/CutenServer/app/views/users/confirmations/new.html.haml new file mode 100644 index 0000000..3386808 --- /dev/null +++ b/CutenServer/app/views/users/confirmations/new.html.haml @@ -0,0 +1,9 @@ +%h2 Resend confirmation instructions += form_for(resource, :as => resource_name, :url => confirmation_path(resource_name), :html => { :method => :post }) do |f| + = devise_error_messages! + %div + = f.label :email + %br/ + = f.email_field :email + %div= f.submit "Resend confirmation instructions" += render "devise/shared/links" diff --git a/CutenServer/app/views/users/mailer/confirmation_instructions.html.haml b/CutenServer/app/views/users/mailer/confirmation_instructions.html.haml new file mode 100644 index 0000000..26c9f1c --- /dev/null +++ b/CutenServer/app/views/users/mailer/confirmation_instructions.html.haml @@ -0,0 +1,4 @@ +%p + Welcome #{@resource.email}! +%p You can confirm your account email through the link below: +%p= link_to 'Confirm my account', confirmation_url(@resource, :confirmation_token => @resource.confirmation_token) diff --git a/CutenServer/app/views/users/mailer/reset_password_instructions.html.haml b/CutenServer/app/views/users/mailer/reset_password_instructions.html.haml new file mode 100644 index 0000000..4fc4743 --- /dev/null +++ b/CutenServer/app/views/users/mailer/reset_password_instructions.html.haml @@ -0,0 +1,6 @@ +%p + Hello #{@resource.email}! +%p Someone has requested a link to change your password, and you can do this through the link below. +%p= link_to 'Change my password', edit_password_url(@resource, :reset_password_token => @resource.reset_password_token) +%p If you didn't request this, please ignore this email. +%p Your password won't change until you access the link above and create a new one. diff --git a/CutenServer/app/views/users/mailer/unlock_instructions.html.haml b/CutenServer/app/views/users/mailer/unlock_instructions.html.haml new file mode 100644 index 0000000..34b0e9e --- /dev/null +++ b/CutenServer/app/views/users/mailer/unlock_instructions.html.haml @@ -0,0 +1,5 @@ +%p + Hello #{@resource.email}! +%p Your account has been locked due to an excessive amount of unsuccessful sign in attempts. +%p Click the link below to unlock your account: +%p= link_to 'Unlock my account', unlock_url(@resource, :unlock_token => @resource.unlock_token) diff --git a/CutenServer/app/views/users/passwords/edit.html.haml b/CutenServer/app/views/users/passwords/edit.html.haml new file mode 100644 index 0000000..0c227b9 --- /dev/null +++ b/CutenServer/app/views/users/passwords/edit.html.haml @@ -0,0 +1,14 @@ +%h2 Change your 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 + %div + = f.label :password, "New password" + %br/ + = f.password_field :password + %div + = f.label :password_confirmation, "Confirm new password" + %br/ + = f.password_field :password_confirmation + %div= f.submit "Change my password" += render "devise/shared/links" diff --git a/CutenServer/app/views/users/passwords/new.html.haml b/CutenServer/app/views/users/passwords/new.html.haml new file mode 100644 index 0000000..3d914df --- /dev/null +++ b/CutenServer/app/views/users/passwords/new.html.haml @@ -0,0 +1,9 @@ +%h2 Forgot your password? += form_for(resource, :as => resource_name, :url => password_path(resource_name), :html => { :method => :post }) do |f| + = devise_error_messages! + %div + = f.label :email + %br/ + = f.email_field :email + %div= f.submit "Send me reset password instructions" += render "devise/shared/links" diff --git a/CutenServer/app/views/users/registrations/edit.html.haml b/CutenServer/app/views/users/registrations/edit.html.haml new file mode 100644 index 0000000..3c8b74b --- /dev/null +++ b/CutenServer/app/views/users/registrations/edit.html.haml @@ -0,0 +1,27 @@ +%h2 + Edit #{resource_name.to_s.humanize} += form_for(resource, :as => resource_name, :url => registration_path(resource_name), :html => { :method => :put }) do |f| + = devise_error_messages! + %div + = f.label :email + %br/ + = f.email_field :email + %div + = f.label :password + %i (leave blank if you don't want to change it) + %br/ + = f.password_field :password, :autocomplete => "off" + %div + = f.label :password_confirmation + %br/ + = f.password_field :password_confirmation + %div + = f.label :current_password + %i (we need your current password to confirm your changes) + %br/ + = f.password_field :current_password + %div= f.submit "Update" +%h3 Cancel my account +%p + Unhappy? #{link_to "Cancel my account", registration_path(resource_name), :data => { :confirm => "Are you sure?" }, :method => :delete}. += link_to "Back", :back diff --git a/CutenServer/app/views/devise/registrations/new.html.haml b/CutenServer/app/views/users/registrations/new.html.haml similarity index 80% rename from CutenServer/app/views/devise/registrations/new.html.haml rename to CutenServer/app/views/users/registrations/new.html.haml index 7887141..ecd7e72 100644 --- a/CutenServer/app/views/devise/registrations/new.html.haml +++ b/CutenServer/app/views/users/registrations/new.html.haml @@ -17,8 +17,5 @@ = f.label :student_number %br/ = f.text_field :student_number - %div - = f.label :teacher_id - = f.select(:teacher_id, [['Student', nil]] + Teacher.all.map { |t| [t.name, t.id] }) %div= f.submit "Sign up" = render "devise/shared/links" diff --git a/CutenServer/app/views/users/sessions/new.html.haml b/CutenServer/app/views/users/sessions/new.html.haml new file mode 100644 index 0000000..99cfee7 --- /dev/null +++ b/CutenServer/app/views/users/sessions/new.html.haml @@ -0,0 +1,16 @@ +%h2 Sign in += form_for(resource, :as => resource_name, :url => session_path(resource_name)) do |f| + %div + = f.label :email + %br/ + = f.email_field :email + %div + = f.label :password + %br/ + = f.password_field :password + - if devise_mapping.rememberable? + %div + = f.check_box :remember_me + = f.label :remember_me + %div= f.submit "Sign in" += render "devise/shared/links" diff --git a/CutenServer/app/views/users/shared/_links.haml b/CutenServer/app/views/users/shared/_links.haml new file mode 100644 index 0000000..35d07ec --- /dev/null +++ b/CutenServer/app/views/users/shared/_links.haml @@ -0,0 +1,19 @@ +- if controller_name != 'sessions' + = link_to "Sign in", new_session_path(resource_name) + %br/ +- if devise_mapping.registerable? && controller_name != 'registrations' + = link_to "Sign up", new_registration_path(resource_name) + %br/ +- if devise_mapping.recoverable? && controller_name != 'passwords' + = link_to "Forgot your password?", new_password_path(resource_name) + %br/ +- if devise_mapping.confirmable? && controller_name != 'confirmations' + = link_to "Didn't receive confirmation instructions?", new_confirmation_path(resource_name) + %br/ +- if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks' + = link_to "Didn't receive unlock instructions?", new_unlock_path(resource_name) + %br/ +- if devise_mapping.omniauthable? + - resource_class.omniauth_providers.each do |provider| + = link_to "Sign in with #{provider.to_s.titleize}", omniauth_authorize_path(resource_name, provider) + %br/ diff --git a/CutenServer/app/views/users/unlocks/new.html.haml b/CutenServer/app/views/users/unlocks/new.html.haml new file mode 100644 index 0000000..17f4851 --- /dev/null +++ b/CutenServer/app/views/users/unlocks/new.html.haml @@ -0,0 +1,9 @@ +%h2 Resend unlock instructions += form_for(resource, :as => resource_name, :url => unlock_path(resource_name), :html => { :method => :post }) do |f| + = devise_error_messages! + %div + = f.label :email + %br/ + = f.email_field :email + %div= f.submit "Resend unlock instructions" += render "devise/shared/links" diff --git a/CutenServer/config/initializers/devise.rb b/CutenServer/config/initializers/devise.rb index 298c475..0a4b28d 100644 --- a/CutenServer/config/initializers/devise.rb +++ b/CutenServer/config/initializers/devise.rb @@ -2,4 +2,5 @@ require 'devise/orm/active_record' CutenServer::Application.configure do config.token_authentication_key = :auth_token + Devise.scoped_views = true end