Rails 3.2 Active Admin, Change password while logged in - ruby-on-rails

I've got a rails 3.2 app using active admin 0.4.3. It uses an employee model as the admin users. I've added a link to the Active Admin dashboard so the currently signed in employee can change their password if they want.
section :admin_tasks do
div do
link_to "Change Password", new_employee_password_path
end
end
However when I click the link I get a flash message saying that I'm already signed in. How would I go about adding a change password dialog to the active admin section of my app?
I used new_employee_password_path because it's what came up in the routes and it seemed appropriate. I also tried edit_employee_password_path but that didn't work either.

This page in the ActiveAdmin wiki should help https://github.com/gregbell/active_admin/wiki/How-to-add-User-Accounts-for-users-to-administer-their-personal-accounts

Related

How to setup an admin with the seed file through devise and cancancan?

I'm trying to setup an admin account so that the admin can sign in to the backend and start using it. But when I seed the file (rake db:seed) for the admin user, I get an email and when I click on it I get a message that the
translation missing with account has been successfully created but that it is not activated?
The app uses devise's confirmable module, in a rails 3 app.
I tried creating the user through the rails console, to bypass the confirmable module, with no luck. But when I try to log in, I get a message that my account hasn't been activated?
Tnx,
Tom

Unable to access Spree Admin panel after updating the authentication, verify user email from console

So I'm creating a very basic Spree Rails app. I was able to access the Admin panel by just going to http://localhost:3000/admin But after setting up the authentication when I try to access the administration after entering my email and password I get that I have to verify my email. How can I verify my user email using the console?
This should do the trick,
user = Spree::User.find_by(email: 'spree#example.com')
user.confirm!
This worked for me in my Spree Rails app, I think if your using Devise this will work.
user = Spree::User.first
user.password='123456'
user.password_confirmation='123456'
user.email='youremail#example.com'
user.skip_confirmation!
user.save

Confirm (as an admin) a User created with Devise

I am using Devise and since my app is in Beta, I want to control which users who have signed up can sign in.
So, even if the confirmation email is sent, how can I make it so that just when an admin has confirmed the account they will be able to sign in? Is there any module in Devise that would let me do so?
All you need to do is add an "approved" attribute to your user table, use admin to change its status and before sign in you can check whether user is approved or not. You can find detailed information here: link

authlogic_facebook_connect not skipping users validation

im running rails 2.3.8, authlogic 2.1.6 and the extension for facebook connect (https://github.com/studybyte/authlogic_facebook_connect)
the facebook side is working good, user click on facebook connect button, goes to facebook, logs in and returns to my app.
my problem is very simple but i cant figure it out. when user is redirected to my site after logging in, if is a new user, i create a new record. Since it comes from facebook the user has no email or password but the user is not saved because authlogic fails password and email validation.
the authlogic_facebook_connect shouldnt skip these validations?
i realized that i don't have to create a user, the plugin is supposed to do that for you. You just have to login the user after he connects to facebook.
It didnt work before because a did not create the facebook_session_key field but facebook_access_token instead.
It should. It's supposed to call save(:validate => false) (in Rails 3.1 or save_with_validation(false) for older version if I remember correctly) to skip the validations.

In a rail application i want to authorize admin to create a new record in particular module.not any user

Requirement:
I have a deal module in my rail application. when the user click on create new deal link it will check chat whether the user is admin or not.if the user is admin i want to allow
it to create a new deal otherwise it will display a flash message that you are not allowed and redirect the user to signin page to login as admin.if the user sign in as admin i want to redirect it to a page from where it previously comes.
Devise and cancan should help

Resources