Merge 697fc08e18 into 257226273b
This commit is contained in:
commit
91dc475eb2
6 changed files with 69 additions and 3 deletions
|
|
@ -16,4 +16,15 @@ class Admin::UsersController < ApplicationController
|
||||||
user.update_attributes!(params[:user])
|
user.update_attributes!(params[:user])
|
||||||
redirect_to admin_users_path, :notice => "Updated #{user.email}"
|
redirect_to admin_users_path, :notice => "Updated #{user.email}"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def delete
|
||||||
|
@user = User.find(params[:id])
|
||||||
|
end
|
||||||
|
|
||||||
|
def destroy
|
||||||
|
@user = User.find(params[:id])
|
||||||
|
@user.destroy
|
||||||
|
redirect_to admin_users_path, :notice => "User got deleted"
|
||||||
|
|
||||||
|
end
|
||||||
end
|
end
|
||||||
38
app/controllers/passwords_controller.rb
Normal file
38
app/controllers/passwords_controller.rb
Normal file
|
|
@ -0,0 +1,38 @@
|
||||||
|
class PasswordsController < Devise::PasswordsController
|
||||||
|
skip_before_filter :verify_user
|
||||||
|
def new
|
||||||
|
super
|
||||||
|
end
|
||||||
|
|
||||||
|
def edit
|
||||||
|
super
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
def update
|
||||||
|
@user = User.find_by_reset_password_token(params[:user][:reset_password_token])
|
||||||
|
logger.debug "#{@user.email}"
|
||||||
|
password_changed = false
|
||||||
|
if !params[:user][:password].nil?
|
||||||
|
if !params[:user][:password].empty?
|
||||||
|
password_changed = true
|
||||||
|
else
|
||||||
|
params[:user].delete :password
|
||||||
|
params[:user].delete :password_confirmation
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if password_changed
|
||||||
|
successfully_updated = @user.reset_password!(params[:user][:password],params[:user][:password_confirmation])
|
||||||
|
else
|
||||||
|
redirect_to session[:return_to], :notice => "Blank Field Entered" and return
|
||||||
|
end
|
||||||
|
|
||||||
|
if successfully_updated
|
||||||
|
redirect_to root_path, :notice => "Your password is changed" and return
|
||||||
|
else
|
||||||
|
redirect_to session[:return_to] and return
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
@ -13,7 +13,7 @@
|
||||||
%b ID
|
%b ID
|
||||||
%th
|
%th
|
||||||
%b Title
|
%b Title
|
||||||
- if @conference.call_for_papers.rating != 0
|
- if !@conference.call_for_papers.blank? && @conference.call_for_papers.rating != 0
|
||||||
%th
|
%th
|
||||||
%b Rating
|
%b Rating
|
||||||
%th
|
%th
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,7 @@
|
||||||
%b Roles
|
%b Roles
|
||||||
%th
|
%th
|
||||||
%th
|
%th
|
||||||
|
%th
|
||||||
- @users.each do |user|
|
- @users.each do |user|
|
||||||
- person = Person.find_person_by_user_id(user.id)
|
- person = Person.find_person_by_user_id(user.id)
|
||||||
%tr
|
%tr
|
||||||
|
|
@ -72,6 +73,12 @@
|
||||||
"data-content" => user.popup_details,
|
"data-content" => user.popup_details,
|
||||||
"data-original-title" => ""
|
"data-original-title" => ""
|
||||||
|
|
||||||
|
%td
|
||||||
|
- if current_user.id == user.id or user.role_ids.include? 3
|
||||||
|
=link_to 'Delete',admin_user_path(user), :method => :delete , :data => {:confirm => 'Are you sure ?'}, :disabled => true,:class => "btn btn-primary disabled btn-danger",:role => "button"
|
||||||
|
- else
|
||||||
|
=link_to 'Delete',admin_user_path(user), :method=> :delete , :data=> {:confirm => 'Are you sure ?'},:class => "btn btn-primary btn-danger"
|
||||||
|
|
||||||
:javascript
|
:javascript
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
$('#users').dataTable( {
|
$('#users').dataTable( {
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,11 @@
|
||||||
Osem::Application.routes.draw do
|
Osem::Application.routes.draw do
|
||||||
|
|
||||||
devise_for :users, :controllers => { :registrations => :registrations }, :path => 'accounts'
|
devise_for :users, :controllers => { :registrations => :registrations,:passwords=>:passwords }, :path => 'accounts'
|
||||||
|
|
||||||
|
# resources :passwords do
|
||||||
|
# get "passwords/new" => "passwords#new"
|
||||||
|
# get "/passwords/:id/edit" => "passwords#edit"
|
||||||
|
# end
|
||||||
|
|
||||||
namespace :admin do
|
namespace :admin do
|
||||||
resources :users
|
resources :users
|
||||||
|
|
|
||||||
5
spec/views/passwords/update.html.erb_spec.rb
Normal file
5
spec/views/passwords/update.html.erb_spec.rb
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
require 'spec_helper'
|
||||||
|
|
||||||
|
describe "passwords/update.html.erb" do
|
||||||
|
pending "add some examples to (or delete) #{__FILE__}"
|
||||||
|
end
|
||||||
Loading…
Add table
Add a link
Reference in a new issue