From 2a928455f9dcefa465b80b79768ba1d1a423e6e9 Mon Sep 17 00:00:00 2001 From: Azul Date: Mon, 3 Dec 2012 10:52:01 +0100 Subject: enable users to cancel their account --- users/app/controllers/users_controller.rb | 2 +- users/app/views/users/edit.html.haml | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) (limited to 'users/app') diff --git a/users/app/controllers/users_controller.rb b/users/app/controllers/users_controller.rb index 3407191..cffc8c6 100644 --- a/users/app/controllers/users_controller.rb +++ b/users/app/controllers/users_controller.rb @@ -36,7 +36,7 @@ class UsersController < ApplicationController def destroy @user.destroy - redirect_to users_path + redirect_to admin? ? users_path : login_path end protected diff --git a/users/app/views/users/edit.html.haml b/users/app/views/users/edit.html.haml index 8298443..cfcf220 100644 --- a/users/app/views/users/edit.html.haml +++ b/users/app/views/users/edit.html.haml @@ -1,3 +1,10 @@ .span8.offset2 %h2=t :settings = render 'form' + - if @user == current_user + %legend + =t :cancel_account + %small You will not be able to login anymore. + = link_to user_path(@user), :method => :delete, :class => "btn btn-danger" do + %i.icon-remove.icon-white + Remove my Account -- cgit v1.2.3