35 lines
1.0 KiB
Ruby
35 lines
1.0 KiB
Ruby
|
class Admin::OfficialModuleController < OrbitAdminController
|
||
|
|
||
|
def set_master_key
|
||
|
@master_password = MasterPassword.first rescue nil
|
||
|
if @master_password.nil?
|
||
|
@master_password = MasterPassword.new
|
||
|
end
|
||
|
end
|
||
|
|
||
|
def update_master_password
|
||
|
master_password = MasterPassword.first rescue nil
|
||
|
if master_password.nil?
|
||
|
master_password = MasterPassword.create(password_params)
|
||
|
else
|
||
|
master_password.update_attributes(password_params)
|
||
|
master_password.save
|
||
|
end
|
||
|
# emails = User.all.collect{|u| u.member_profile.email rescue nil}
|
||
|
# emails.delete(nil)
|
||
|
# Email.new({
|
||
|
# "mail_to" => emails,
|
||
|
# "mail_subject" => "Master password changed.",
|
||
|
# "mail_content" => "Master password has been changed for all the sites. Please login with the new password. The new password is : <h3>#{password_params[:password]}</h3>"
|
||
|
# }).deliver
|
||
|
redirect_to admin_site_set_master_key_path(current_site)
|
||
|
end
|
||
|
|
||
|
|
||
|
private
|
||
|
|
||
|
def password_params
|
||
|
params.require(:master_password).permit!
|
||
|
end
|
||
|
|
||
|
end
|