rails_admin: control on admin users signup - ruby-on-rails-3

I installed rails_admin first with model name as rails_admin_user.
The first time I logged in, I clicked 'sign up' and created admin user account.
Now every time I want to login; there is a 'sign up' link still there.
Seems that anyone can create account for admin interface of rails_admin.
If this is true, please let me know how to restrict admin user creation process.

Hey, here is how you do it. Go to your user or member model, depending on how you set up devise, and remove registerable from devise attributes. This way the sign up link will disappear.

Late but still good to share I think. You could do this to show signup for first user only, which will hopefully be you.
devise :registerable if User.empty?

Related

Deleting buddypress account without deleting user

I've recently started using Buddypress in conjunction with a plugin called memberpress on a site, and am running into a problem:
Basically, if you're logged in to the site, as the Admin for example, and you go to the buddypress profile page link, you're automatically set up with a buddypress membership/profile and listed in the member directory.
I don't want everyone who logs into the site to just automatically/accidentally become a buddypress member and to be listed in the directory.
So I need to A)know how to delete the buddypress membership when that occurs without deleting the user and their ability to log into the site and B)better yet, stop buddypress from automatically assigning membership without purposeful signup.
Any insight would be helpful, thanks!
Buddy press works not connection but using the user table for users profiles. It means if you delete user or buddy press profile both result same delete both.
It might possible
Case 1 hide buddy press profile from public by deregister profile for the user
Case 2 hide user from member directory only.

show logout button along with the name of user after successfull login

I am a yiibie, and i am stuck at a point. I have three roles in my project. 1.Admin. 2.Owner 3. Authenticated User. I have a header and a footer widget.In header widget which is the top section has a signup and login link. i want to show my user name and a logout link after his successful login. I do not want to make another widget. i Know the logic, we can use if else.
If a user has been logged in, show his name and logout link at the top section(header widget). else if he is a normal user or not logged in show him, signup and login link. Thats it.But how to write code..is the thing i dont know. Plus i am using yii rights and yii user extension too.
Read the documentation please.
This will be helpful:
http://www.yiiframework.com/doc/api/1.1/CWebUser#isGuest-detail
Here example: http://pastebin.com/r0XpkPNZ
Is easy after login you can see the username otherwise you see nothings
<?php
if (!Yii::app()->user->isGuest) {
echo Yii::app()->user->name;
}
?>

How to manually create reset password token using devise

I am developing a Rails 3.2 app. When a user signs up or when I create a user account in my admin panel, a welcome email is sent to them. I want to include a link on which the user can click to get to the password reset page (where they can set/change their password).
So what I want to do basically is to manually create a reset password token, create a link to the reset password page (where they select a new password) and include it in the welcome email. I do not want to send two emails (welcome and reset password).
I guess some of this code could be used but I do not know how.
https://github.com/plataformatec/devise/blob/master/lib/devise/models/recoverable.rb
How can I do this?
Thankful for all help!
Just had to do something similar to this and thought I'd post an answer if someone stumbles on this. Assuming you have devise correctly set up, all you need to do is make sure the user exists in the database and then redirect to the devise route. I leveraged their code here: goo.gl/cE5USm.
def password_reset_controller
user = User.find_by_email( params[:email] )
if user
redirect_to password_path(:user, email: user.email)
else
# do something different
end
end
In console if you call password_path(:user, email: user.email) -> "/users/password?email='email'"
Edit:
Alternatively, you can just use user.send_reset_password_instructions from goo.gl/aPQ8MU

using devise how do i keep a user logged in past closing the browser

I have a rails app using devise and even with the remember me button clicked when i close the browser and reopen it it loses all history of the user ever being logged in.
The session should persist well beyond that. How do i change this?
I am not using timeoutable or anything that auto logs the user out.
Thanks!
Did you look at the 'Rememberable' module in Devise?
http://rubydoc.info/github/plataformatec/devise/master/Devise/Models/Rememberable
On the user Model =>
:rememberable

Joomla mod_login vs com_user

I'm having a very weird issue with user logins.
I'm building a site where all the content/menus are only available after you login.
I made a 'login' through the Modules and assign it the "userlogin" position.
Now when I go to the home page or any page, the login box comes up, but there's also a second login form. It seems to be coming from com_user.
This com_user login form doesn't work. I can't login using any credentials. If it was working I can simply remove my login module.
Is there a way I can either:
get com_user to work with normal user logins
or
disable this and so I can only see the Module login.
I can hide it from CSS, but I want to know where it's coming from.
Check the menu link which you have created should be public.
If these are not public then whenever user clicks it, he/she will be asked for login. Thats why the second login option is coming up.