| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 0bb26c6 commit a6ad6f5
9 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -34,6 +34,15 @@ def login | |||
| 34 | 34 | end | |
| 35 | 35 | end | |
| 36 | 36 | ||
| 37 | + def destroy | ||
| 38 | + if params[:user][:email] == @user.email | ||
| 39 | + sign_out(current_user) | ||
| 40 | + @user.destroy | ||
| 41 | + redirect_to root_url, notice: I18n.t('notices.account_deleted') | ||
| 42 | + else | ||
| 43 | + redirect_to @user, alert: I18n.t('errors.invalid_email') | ||
| 44 | + end | ||
| 45 | + end | ||
| 37 | 46 | ||
| 38 | 47 | private | |
| 39 | 48 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -45,3 +45,12 @@ | |||
| 45 | 45 | = f.password_field :password, autofocus: true, autocomplete: "off" | |
| 46 | 46 | = f.password_field :password_confirmation, autocomplete: "off" | |
| 47 | 47 | = f.submit t('.submit_password') | |
| 48 | + | ||
| 49 | + %br | ||
| 50 | + %p | ||
| 51 | + %strong= link_to t('.delete_account'), '#delete_user_form', data: {toggle: "collapse"} | ||
| 52 | + | ||
| 53 | + = twitter_bootstrap_form_for @user, html: {class: (params[:delete_user] ? '' : 'collapse'), id: 'delete_user_form', method: 'DELETE'} do |f| | ||
| 54 | + %p= t('.delete_account_notice') | ||
| 55 | + = f.text_field :email, value: '', autocomplete: "off" | ||
| 56 | + = f.submit t('.delete_account_confirm'), class: 'btn-danger' | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -25,11 +25,13 @@ en: | |||
| 25 | 25 | wrong_bitcoin_address: Error updating bitcoin address | |
| 26 | 26 | user_not_found: User not found | |
| 27 | 27 | access_denied: You are not authorized to perform this action! | |
| 28 | + invalid_email: Invalid email | ||
| 28 | 29 | notices: | |
| 29 | 30 | project_updated: The project settings have been updated | |
| 30 | 31 | tips_decided: The tip amounts have been defined | |
| 31 | 32 | user_updated: Your information saved! | |
| 32 | 33 | user_unsubscribed: "You unsubscribed! Sorry for bothering you. Although, you can still leave us your bitcoin address to get your tips." | |
| 34 | + account_deleted: Your account was deleted | ||
| 33 | 35 | tip_amounts: | |
| 34 | 36 | undecided: "Undecided" | |
| 35 | 37 | free: "Free: 0%" | |
@@ -176,6 +178,9 @@ en: | |||
| 176 | 178 | change_password: Change your password | |
| 177 | 179 | submit_password: Change my password | |
| 178 | 180 | use_from_gravatar: Use from your gravatar profile | |
| 181 | + delete_account: Delete Account | ||
| 182 | + delete_account_notice: Enter your bitcoin address and click the button below to delete your account. This account will be gone forever, but you will still be able to sign up with the same github account. Please be certain. | ||
| 183 | + delete_account_confirm: Delete this account! | ||
| 179 | 184 | withdrawals: | |
| 180 | 185 | index: | |
| 181 | 186 | title: Last Withdrawals | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -22,7 +22,7 @@ | |||
| 22 | 22 | resources :tips , :only => [:index] | |
| 23 | 23 | resources :deposits , :only => [:index] | |
| 24 | 24 | resources :withdrawals , :only => [:index] | |
| 25 | - resources :users , :only => [:index , :show , :update] | ||
| 25 | + resources :users , :only => [:index , :show , :update, :destroy] | ||
| 26 | 26 | resources :projects , :only => [:index , :show , :update , :edit ] do | |
| 27 | 27 | collection do | |
| 28 | 28 | get 'search' | |
| Back | FazBrowse Home | New Git URL |
0 commit comments