fixes #2419
This commit is contained in:
9
app/controllers/maintenance/user/passwords_controller.rb
Normal file
9
app/controllers/maintenance/user/passwords_controller.rb
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
module Maintenance
|
||||||
|
module User
|
||||||
|
class PasswordsController < ApplicationController
|
||||||
|
def edit
|
||||||
|
@user = CurrentUser.user
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -55,6 +55,8 @@ class UsersController < ApplicationController
|
|||||||
cookies.delete(:favorite_tags_with_categories)
|
cookies.delete(:favorite_tags_with_categories)
|
||||||
if @user.errors.any?
|
if @user.errors.any?
|
||||||
flash[:notice] = @user.errors.full_messages.join("; ")
|
flash[:notice] = @user.errors.full_messages.join("; ")
|
||||||
|
else
|
||||||
|
flash[:notice] = "Settings updated"
|
||||||
end
|
end
|
||||||
respond_with(@user)
|
respond_with(@user)
|
||||||
end
|
end
|
||||||
|
|||||||
15
app/views/maintenance/user/passwords/edit.html.erb
Normal file
15
app/views/maintenance/user/passwords/edit.html.erb
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
<div id="c-users">
|
||||||
|
<div id="a-edit">
|
||||||
|
<h1>Change Password</h1>
|
||||||
|
|
||||||
|
<%= simple_form_for @user do |f| %>
|
||||||
|
<%= f.input :old_password, :as => :password, :input_html => {:autocomplete => "off"} %>
|
||||||
|
<%= f.input :password, :label => "New password", :input_html => {:autocomplete => "off"} %>
|
||||||
|
<%= f.button :submit, "Submit" %>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<% content_for(:page_title) do %>
|
||||||
|
Change Password - <%= Danbooru.config.app_name %>
|
||||||
|
<% end %>
|
||||||
@@ -3,7 +3,14 @@
|
|||||||
<h1>Settings</h1>
|
<h1>Settings</h1>
|
||||||
|
|
||||||
<%= simple_form_for @user do |f| %>
|
<%= simple_form_for @user do |f| %>
|
||||||
<h2 id="edit-options"><%= link_to "Basic settings", "#basic-settings", :class => "active" %> | <%= link_to "Advanced settings", "#advanced-settings" %> | <%= link_to "Change password", "#change-password" %> | <%= link_to "Delete account", maintenance_user_deletion_path, :id => "delete-account" %></h2>
|
<h2 id="edit-options">
|
||||||
|
<%= link_to "Basic settings", "#basic-settings", :class => "active" %>
|
||||||
|
| <%= link_to "Advanced settings", "#advanced-settings" %>
|
||||||
|
<% if CurrentUser.user.id == @user.id %>
|
||||||
|
| <%= link_to "Change password", edit_user_password_path(:user_id => @user.id), :id => "change-password" %>
|
||||||
|
| <%= link_to "Delete account", maintenance_user_deletion_path, :id => "delete-account" %>
|
||||||
|
<% end %>
|
||||||
|
</h2>
|
||||||
|
|
||||||
<fieldset id="basic-settings-section">
|
<fieldset id="basic-settings-section">
|
||||||
<div class="input">
|
<div class="input">
|
||||||
@@ -77,12 +84,6 @@
|
|||||||
<%= f.input :custom_style, :label => "Custom <a href='http://en.wikipedia.org/wiki/Cascading_Style_Sheets'>CSS</a> style".html_safe, :hint => "Style to apply to the whole site.", :input_html => {:size => "40x5"} %>
|
<%= f.input :custom_style, :label => "Custom <a href='http://en.wikipedia.org/wiki/Cascading_Style_Sheets'>CSS</a> style".html_safe, :hint => "Style to apply to the whole site.", :input_html => {:size => "40x5"} %>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
||||||
<fieldset id="change-password-section">
|
|
||||||
<%= f.input :password, :hint => "Leave blank if you don't want to change your password", :label => "New password", :input_html => {:autocomplete => "off"} %>
|
|
||||||
|
|
||||||
<%= f.input :old_password, :as => :password, :input_html => {:autocomplete => "off"} %>
|
|
||||||
</fieldset>
|
|
||||||
|
|
||||||
<%= f.button :submit, "Submit" %>
|
<%= f.button :submit, "Submit" %>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
@@ -95,11 +96,11 @@
|
|||||||
<% content_for(:html_header) do %>
|
<% content_for(:html_header) do %>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
$(function() {
|
$(function() {
|
||||||
$("#change-password-section,#advanced-settings-section").hide();
|
$("#advanced-settings-section").hide();
|
||||||
$("#edit-options a:not(#delete-account)").on("click", function(e) {
|
$("#edit-options a:not(#delete-account):not(#change-password)").on("click", function(e) {
|
||||||
var $target = $(e.target);
|
var $target = $(e.target);
|
||||||
$("h2 a").removeClass("active");
|
$("h2 a").removeClass("active");
|
||||||
$("#basic-settings-section,#change-password-section,#advanced-settings-section").hide();
|
$("#basic-settings-section,#advanced-settings-section").hide();
|
||||||
$target.addClass("active")
|
$target.addClass("active")
|
||||||
$($target.attr("href") + "-section").show();
|
$($target.attr("href") + "-section").show();
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|||||||
@@ -248,6 +248,8 @@ Rails.application.routes.draw do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
resources :users do
|
resources :users do
|
||||||
|
resource :password, :only => [:edit], :controller => "maintenance/user/passwords"
|
||||||
|
|
||||||
collection do
|
collection do
|
||||||
get :search
|
get :search
|
||||||
get :custom_style
|
get :custom_style
|
||||||
|
|||||||
15
script/fixes/034_fix_dmail_filters.rb
Normal file
15
script/fixes/034_fix_dmail_filters.rb
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
#!/usr/bin/env ruby
|
||||||
|
|
||||||
|
require File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'config', 'environment'))
|
||||||
|
|
||||||
|
ActiveRecord::Base.connection.execute("set statement_timeout = 0")
|
||||||
|
|
||||||
|
CurrentUser.user = User.admins.first
|
||||||
|
CurrentUser.ip_addr = "127.0.0.1"
|
||||||
|
|
||||||
|
DmailFilter.find_each do |filter|
|
||||||
|
if filter.words == filter.user.name
|
||||||
|
filter.words = ""
|
||||||
|
filter.save
|
||||||
|
end
|
||||||
|
end
|
||||||
Reference in New Issue
Block a user