From 5bb98a2863c8a4c9c87ae5c3ff9e06ce2d1e4d25 Mon Sep 17 00:00:00 2001 From: Xavier J Date: Mon, 8 Feb 2016 19:32:18 +0100 Subject: [PATCH] Activation : reset user password --- Gemfile | 2 - Gemfile.lock | 6 +-- app/views/docs/api-docs.json | 19 ------- app/views/docs/api/v1/procedures.json | 45 ---------------- app/views/users/passwords/edit.html.erb | 22 -------- app/views/users/passwords/edit.html.haml | 59 +++++++++++++++++++++ app/views/users/passwords/new.html.erb | 16 ------ app/views/users/passwords/new.html.haml | 50 +++++++++++++++++ app/views/users/registrations/edit.html.erb | 39 -------------- app/views/users/shared/_links.html.erb | 5 +- config/initializers/swagger_docs.rb | 23 -------- config/routes.rb | 3 +- vendor/assets/javascripts/franceconnect.js | 2 +- 13 files changed, 117 insertions(+), 174 deletions(-) delete mode 100644 app/views/docs/api-docs.json delete mode 100644 app/views/docs/api/v1/procedures.json delete mode 100644 app/views/users/passwords/edit.html.erb create mode 100644 app/views/users/passwords/edit.html.haml delete mode 100644 app/views/users/passwords/new.html.erb create mode 100644 app/views/users/passwords/new.html.haml delete mode 100644 app/views/users/registrations/edit.html.erb delete mode 100644 config/initializers/swagger_docs.rb diff --git a/Gemfile b/Gemfile index 8ad3045cb..c2f3f67fd 100644 --- a/Gemfile +++ b/Gemfile @@ -74,8 +74,6 @@ gem 'mailjet' gem "smart_listing" -gem 'swagger-docs' - group :test do gem 'capybara' gem 'factory_girl' diff --git a/Gemfile.lock b/Gemfile.lock index a4c18b349..808802d6f 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -380,9 +380,6 @@ GEM actionpack (>= 3.0) activesupport (>= 3.0) sprockets (>= 2.8, < 4.0) - swagger-docs (0.2.8) - activesupport (>= 3, < 5) - rails (>= 3, < 5) swd (1.0.0) activesupport (>= 3) attr_required (>= 0.0.5) @@ -496,7 +493,6 @@ DEPENDENCIES smart_listing spring spring-commands-rspec - swagger-docs terminal-notifier terminal-notifier-guard therubyracer @@ -509,4 +505,4 @@ DEPENDENCIES will_paginate-bootstrap BUNDLED WITH - 1.10.6 + 1.11.2 diff --git a/app/views/docs/api-docs.json b/app/views/docs/api-docs.json deleted file mode 100644 index a2142e59c..000000000 --- a/app/views/docs/api-docs.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "apiVersion": "1.0", - "swaggerVersion": "1.2", - "basePath": "https://tps.apientreprise.fr", - "apis": [ - { - "path": "/api/v1/procedures.{format}", - "description": "Procédure API" - } - ], - "authorizations": null, - "info": { - "title": "TPS application", - "description": "Doc des APIs de TPS", - "contact": "contact@tps.apientreprise.fr", - "license": "Apache 2.0", - "licenseUrl": "http://www.apache.org/licenses/LICENSE-2.0.html" - } -} \ No newline at end of file diff --git a/app/views/docs/api/v1/procedures.json b/app/views/docs/api/v1/procedures.json deleted file mode 100644 index 38e5967b1..000000000 --- a/app/views/docs/api/v1/procedures.json +++ /dev/null @@ -1,45 +0,0 @@ -{ - "apiVersion": "1.0", - "swaggerVersion": "1.2", - "basePath": "https://tps.apientreprise.fr", - "resourcePath": "procedures", - "apis": [ - { - "path": "/api/v1/procedures/{id}.json", - "operations": [ - { - "summary": "Récupérer les informations d'une procédure", - "parameters": [ - { - "paramType": "path", - "name": "id", - "type": "integer", - "description": null, - "required": true - } - ], - "responseMessages": [ - { - "code": 200, - "responseModel": "Procedure", - "message": "Success" - }, - { - "code": 401, - "responseModel": null, - "message": "Unauthorized" - }, - { - "code": 404, - "responseModel": null, - "message": "Not Found" - } - ], - "nickname": "API::V1::Procedures#show", - "method": "get" - } - ] - } - ], - "authorizations": null -} \ No newline at end of file diff --git a/app/views/users/passwords/edit.html.erb b/app/views/users/passwords/edit.html.erb deleted file mode 100644 index 94404bdb2..000000000 --- a/app/views/users/passwords/edit.html.erb +++ /dev/null @@ -1,22 +0,0 @@ -

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 %> - -
- <%= f.label :password, "New password" %>
- <%= f.password_field :password, autofocus: true, autocomplete: "off" %> -
- -
- <%= f.label :password_confirmation, "Confirm new password" %>
- <%= f.password_field :password_confirmation, autocomplete: "off" %> -
- -
- <%= f.submit "Change my password" %> -
-<% end %> - -<%= render "users/shared/links" %> diff --git a/app/views/users/passwords/edit.html.haml b/app/views/users/passwords/edit.html.haml new file mode 100644 index 000000000..60c694678 --- /dev/null +++ b/app/views/users/passwords/edit.html.haml @@ -0,0 +1,59 @@ +-#

Sign up

+-# +-#<%= form_for(resource, as: resource_name, url: registration_path(resource_name)) do |f| %> +-# <%= devise_error_messages! %> +-# +-#
+-# <%= f.label :email %>
+-# <%= f.email_field :email, autofocus: true %> +-#
+-# +-#
+-# <%= f.label :password %> +-# <% if @validatable %> +-# (<%= @minimum_password_length %> characters minimum) +-# <% end %>
+-# <%= f.password_field :password, autocomplete: "off" %> +-#
+-# +-#
+-# <%= f.label :password_confirmation %>
+-# <%= f.password_field :password_confirmation, autocomplete: "off" %> +-#
+-# +-#
+-# <%= f.submit "Sign up" %> +-#
+-#<% end %> + += devise_error_messages! + +#form_login + = image_tag('logo-tps.png') + %br + %h2#gestionnaire_login Changement de mot de passe + + %br + %br + #new_user + = form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :put }) do |f| + = f.hidden_field :reset_password_token + %h4 + = f.label 'Nouveau mot de passe' + + .input-group + .input-group-addon + %span.glyphicon.glyphicon-asterisk + = f.password_field :password, autofocus: true, autocomplete: "off", class: 'form-control' + %br + %h4 + = f.label 'Retaper le mot de passe' + .input-group + .input-group-addon + %span.glyphicon.glyphicon-asterisk + = f.password_field :password_confirmation, autocomplete: "off", class: 'form-control' + %br + %br + .actions + = f.submit "Changer", class:'btn btn-primary' + %br \ No newline at end of file diff --git a/app/views/users/passwords/new.html.erb b/app/views/users/passwords/new.html.erb deleted file mode 100644 index 808f4cbc8..000000000 --- a/app/views/users/passwords/new.html.erb +++ /dev/null @@ -1,16 +0,0 @@ -

Forgot your password?

- -<%= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :post }) do |f| %> - <%= devise_error_messages! %> - -
- <%= f.label :email %>
- <%= f.email_field :email, autofocus: true %> -
- -
- <%= f.submit "Send me reset password instructions" %> -
-<% end %> - -<%= render "users/shared/links" %> diff --git a/app/views/users/passwords/new.html.haml b/app/views/users/passwords/new.html.haml new file mode 100644 index 000000000..4ffd7bc17 --- /dev/null +++ b/app/views/users/passwords/new.html.haml @@ -0,0 +1,50 @@ +-#

Sign up

+-# +-#<%= form_for(resource, as: resource_name, url: registration_path(resource_name)) do |f| %> +-# <%= devise_error_messages! %> +-# +-#
+-# <%= f.label :email %>
+-# <%= f.email_field :email, autofocus: true %> +-#
+-# +-#
+-# <%= f.label :password %> +-# <% if @validatable %> +-# (<%= @minimum_password_length %> characters minimum) +-# <% end %>
+-# <%= f.password_field :password, autocomplete: "off" %> +-#
+-# +-#
+-# <%= f.label :password_confirmation %>
+-# <%= f.password_field :password_confirmation, autocomplete: "off" %> +-#
+-# +-#
+-# <%= f.submit "Sign up" %> +-#
+-#<% end %> + += devise_error_messages! + +#form_login + = image_tag('logo-tps.png') + %br + %h2#gestionnaire_login Mot de passe oublié + + %br + %br + #new_user + = form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :post }) do |f| + %h4 + = f.label :email + .input-group + .input-group-addon + %span.glyphicon.glyphicon-user + = f.email_field :email, class: 'form-control', placeholder: 'Email' + %br + %br + .actions + = f.submit "Renvoyer", class:'btn btn-primary' + %br \ No newline at end of file diff --git a/app/views/users/registrations/edit.html.erb b/app/views/users/registrations/edit.html.erb deleted file mode 100644 index 3ea40f014..000000000 --- a/app/views/users/registrations/edit.html.erb +++ /dev/null @@ -1,39 +0,0 @@ -

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! %> - -
- <%= f.label :email %>
- <%= f.email_field :email, autofocus: true %> -
- - <% if devise_mapping.confirmable? && resource.pending_reconfirmation? %> -
Currently waiting confirmation for: <%= resource.unconfirmed_email %>
- <% end %> - -
- <%= f.label :password %> (leave blank if you don't want to change it)
- <%= f.password_field :password, autocomplete: "off" %> -
- -
- <%= f.label :password_confirmation %>
- <%= f.password_field :password_confirmation, autocomplete: "off" %> -
- -
- <%= f.label :current_password %> (we need your current password to confirm your changes)
- <%= f.password_field :current_password, autocomplete: "off" %> -
- -
- <%= f.submit "Update" %> -
-<% end %> - -

Cancel my account

- -

Unhappy? <%= button_to "Cancel my account", registration_path(resource_name), data: { confirm: "Are you sure?" }, method: :delete %>

- -<%= link_to "Back", :back %> diff --git a/app/views/users/shared/_links.html.erb b/app/views/users/shared/_links.html.erb index d6bcb8072..b1d1b5381 100644 --- a/app/views/users/shared/_links.html.erb +++ b/app/views/users/shared/_links.html.erb @@ -1,3 +1,6 @@ <%- if devise_mapping.registerable? && controller_name != 'registrations' %> - <%= link_to "S'inscrire", new_registration_path(resource_name), {class: 'btn btn-sm btn-success'} %>
+ <%= link_to "S'inscrire", new_registration_path(resource_name), {class: 'btn btn-sm btn-success'} %>
+ <% end -%> +
+<%= link_to "Mot de passe oublié ?", new_password_path(resource_name) %>
diff --git a/config/initializers/swagger_docs.rb b/config/initializers/swagger_docs.rb deleted file mode 100644 index 0781b818f..000000000 --- a/config/initializers/swagger_docs.rb +++ /dev/null @@ -1,23 +0,0 @@ -Swagger::Docs::Config.register_apis( - { - "1.0" => { - # the extension used for the API - :api_extension_type => :json, - # the output location where your .json files are written to - :api_file_path => "app/views/docs/", - # the URL base path to your API - :base_path => "https://tps.apientreprise.fr", - # if you want to delete all .json files at each generation - :clean_directory => false, - # add custom attributes to api-docs - :attributes => { - :info => { - "title" => "TPS application", - "description" => "Doc des APIs de TPS", - "contact" => "contact@tps.apientreprise.fr", - "license" => "Apache 2.0", - "licenseUrl" => "http://www.apache.org/licenses/LICENSE-2.0.html" - } - } - } - }) \ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index f0e0bf81f..fb8f963e3 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -10,7 +10,8 @@ Rails.application.routes.draw do devise_for :users, controllers: { sessions: 'users/sessions', - registrations: 'users/registrations' + registrations: 'users/registrations', + passwords: 'users/passwords' } root 'root#index' diff --git a/vendor/assets/javascripts/franceconnect.js b/vendor/assets/javascripts/franceconnect.js index 01ab3c453..e65ca7614 100644 --- a/vendor/assets/javascripts/franceconnect.js +++ b/vendor/assets/javascripts/franceconnect.js @@ -10,7 +10,7 @@ var franceConnectKit = {}; //initCurrentHostnameSource(); //includeFCCss(); - fconnect.currentHost = 'fcp.integ01.dev-franceconnect.fr' + fconnect.currentHost = 'fcp.integ01.dev-franceconnect.fr'; var fconnectProfile = document.getElementById('fconnect-profile'); if (fconnectProfile) {