allow user accounts to be deleted
This commit is contained in:
parent
847a513a94
commit
f21dea069f
@ -3,6 +3,14 @@ class UsersController < ApplicationController
|
|||||||
skip_before_filter :verify_authenticity_token, :only => [:api_login]
|
skip_before_filter :verify_authenticity_token, :only => [:api_login]
|
||||||
before_filter :require_user, :only => [:show, :edit, :update, :edit_profile]
|
before_filter :require_user, :only => [:show, :edit, :update, :edit_profile]
|
||||||
|
|
||||||
|
# delete account
|
||||||
|
def destroy
|
||||||
|
user = current_user
|
||||||
|
user.delete
|
||||||
|
flash[:notice] = t(:account_deleted)
|
||||||
|
redirect_to root_path
|
||||||
|
end
|
||||||
|
|
||||||
# allow login via api
|
# allow login via api
|
||||||
def api_login
|
def api_login
|
||||||
# get the user by login or email
|
# get the user by login or email
|
||||||
|
@ -32,19 +32,19 @@
|
|||||||
class User < ActiveRecord::Base
|
class User < ActiveRecord::Base
|
||||||
include KeyUtilities
|
include KeyUtilities
|
||||||
devise :database_authenticatable, :registerable, :recoverable, :rememberable, :trackable, :validatable
|
devise :database_authenticatable, :registerable, :recoverable, :rememberable, :trackable, :validatable
|
||||||
has_many :channels
|
has_many :channels, :dependent => :destroy
|
||||||
has_many :twitter_accounts, :dependent => :destroy
|
has_many :twitter_accounts, :dependent => :destroy
|
||||||
has_many :thinghttps, :dependent => :destroy
|
has_many :thinghttps, :dependent => :destroy
|
||||||
has_many :tweetcontrols, :dependent => :destroy
|
has_many :tweetcontrols, :dependent => :destroy
|
||||||
has_many :reacts, :dependent => :destroy
|
has_many :reacts, :dependent => :destroy
|
||||||
has_many :scheduled_thinghttps, :dependent => :destroy
|
has_many :scheduled_thinghttps, :dependent => :destroy
|
||||||
has_many :talkbacks, :dependent => :destroy
|
has_many :talkbacks, :dependent => :destroy
|
||||||
has_many :plugins
|
has_many :plugins, :dependent => :destroy
|
||||||
has_many :devices
|
has_many :devices, :dependent => :destroy
|
||||||
has_many :api_keys
|
has_many :api_keys, :dependent => :destroy
|
||||||
has_many :watchings, :dependent => :destroy
|
has_many :watchings, :dependent => :destroy
|
||||||
has_many :watched_channels, :through => :watchings, :source => :channel
|
has_many :watched_channels, :through => :watchings, :source => :channel, :dependent => :destroy
|
||||||
has_many :comments
|
has_many :comments, :dependent => :destroy
|
||||||
|
|
||||||
self.include_root_in_json = false
|
self.include_root_in_json = false
|
||||||
|
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
<div class="row">
|
||||||
<div class="col-sm-8 col-xs-7">
|
<div class="col-sm-8 col-xs-7">
|
||||||
|
|
||||||
<ol class="breadcrumb">
|
<ol class="breadcrumb">
|
||||||
@ -45,4 +46,10 @@
|
|||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<br><br>
|
||||||
|
|
||||||
|
<h3><%= t(:account_delete_message) %></h3>
|
||||||
|
<%= button_to t(:account_delete), user_path(@user.id), :method => 'delete', :data => { :confirm => t(:confirm_account_delete) }, :class => 'btn btn-danger' %>
|
||||||
|
|
||||||
|
@ -9,6 +9,9 @@ en:
|
|||||||
about: "About"
|
about: "About"
|
||||||
account: "Account"
|
account: "Account"
|
||||||
account_changes: "Confirm account changes"
|
account_changes: "Confirm account changes"
|
||||||
|
account_delete: "Delete Account"
|
||||||
|
account_deleted: "Your account has been deleted."
|
||||||
|
account_delete_message: "Want to delete your account?"
|
||||||
account_edit: "Edit Account"
|
account_edit: "Edit Account"
|
||||||
account_error: "There were some problems creating your account:"
|
account_error: "There were some problems creating your account:"
|
||||||
account_error_edit: "There were some problems editing your account:"
|
account_error_edit: "There were some problems editing your account:"
|
||||||
@ -88,6 +91,7 @@ en:
|
|||||||
comment_reply: "reply"
|
comment_reply: "reply"
|
||||||
comment_reported: "Reported!"
|
comment_reported: "Reported!"
|
||||||
community: "Community"
|
community: "Community"
|
||||||
|
confirm_account_delete: "Are you sure you want to delete your account? This cannot be undone."
|
||||||
confirm_read_key_delete: "Are you sure you want to delete this Read API Key?"
|
confirm_read_key_delete: "Are you sure you want to delete this Read API Key?"
|
||||||
confirm_channel_clear: "Are you sure you want to clear this channel?"
|
confirm_channel_clear: "Are you sure you want to clear this channel?"
|
||||||
confirm_channel_delete: "Are you sure you want to delete this channel?"
|
confirm_channel_delete: "Are you sure you want to delete this channel?"
|
||||||
|
Loading…
Reference in New Issue
Block a user