how to reset password in fresh installed laravel 5? - email

i have just installed laravel5 and migrate the users table and inserted the users in table.
now i want to change the password using password reset in laravel5.
when is use the email to reset the password the bootbox alert is seen saying We have e-mailed your password reset link!. but, actually email is not being sent.
i have used the mandrill for email purpose in that project, i want to reset password.anyone here who knows how to reset password sending password in laravel 5?

Run this in your controller function,
$password = "123456";
$new_password = Hash::make($password);
return $new_password;
This will return the hashed new password. replace the new password with password field of users table.

You can use php artisan tinker to write some php code directly from the command line and change your password, e.g.:
$user = User::find(1);
$user->password = \Hash::make($password);
$user->save();

Related

Checking if a user already signed up

I built a custom authentication system using FirebaseAuthentication tokens.
My signup / login flow should work like this:
User presses login button
My server generates the authentication token and sends it to the client
Check if the user already exists (in the 'Auth' table or in my database?)
If true: sign in using FIRAuth.auth()?.signIn(withCustomToken:...
If false: Show a form to to enter custom information (name, etc..)
sign using FIRAuth.auth()?.signIn(withCustomToken:...
save the custom information to my database
My question is: How can I find out if the user has already signed up?
Would a publicly accessible database with only uid's be the way to go?
This is fairly opinion based, but yes, I would use a standalone DB that stores each user's username who has signed up. Then all that is required is a quick web request through a PHP file querying for any rows returned with that username.
The firebase sign in method will feedback in asynchronous callback.
FIRAuth.auth()?.signInWithEmail(email, password: password, completion: { (user , error) in
if let error = error {
print(error.localizedDescription)
return
}
self.signedIn(user)
})
If you haven't sign up yet. The error will print out
There is no user record corresponding to this identifier. The user may have been deleted.

Meteor: How to log user in using username OR password

I have set up a custom login system with my Meteor applications where a created user has a username, email, password, profile (with many other non-important fields there)...
For my login I have the following function:
Meteor.loginWithPassword(username, password, function(err) {/* error feedback */});
At the moment this works perfectly for logging in with the username but I'd like to be able to log in with email address.
Is there a way to login with username OR email address?
Note that I've added validation on creating a username where the username cannot be an email so I am able to perform an "if isEmail" condition before applying this login function. Therefore the username and email won't be the same so that factor is not an issue.
You can just do something like this
Meteor.loginWithPassword(email, password, function(err) {/* error feedback */});

(Xcode 6 Swift Language) saving users data (username, userEmail, userPassword) and send it to database

I'm making an IOS app for iPhone that required users to register. I want to send data to a service sites and then record it on database, but i only know how to save it locally, by using this code:
NSUserDefaults.standardUserDefaults().setObject(userEmail, forKey:"userEmail");
NSUserDefaults.standardUserDefaults().setObject(userEmail, forKey:"userPasswoed");
NSUserDefaults.standardUserDefaults().synchronize();
So the question is how can I save the users data and then send it to a service sites and record it in database (using the Swift language)?
By database, I'm guessing you mean something like parse. You can register for Parse at parse.com and go through the steps in quick start to set your app up. Parse creates a user class for you then you can create a variable for the username, email and password and send that data to parse using the pfuser class. Once you have done all of that, this is the code you can use to set those properties and send them to parse.
let user = PFUser()
user.username = username
user.email = userEmail
user.password = password

how to login in magento admin using coding

Hi magento geeks i need your help,
i'm adding product from backend code in my magneto server, i want to set admin session when product creating then only it will we shown in both front and back end now its working fine for setting admin session id manually.
now i want to set admin session according to admin login based, of-course i will give admin username and password since i will get current logged in user id.
what i want is login magento admin using coding.
any help would be great!
Finally i found solution for this question
Mage::getSingleton('core/session', array('name' => 'adminhtml'));
// supply username
$user = Mage::getModel('admin/user')->loadByUsername('Admin_name_to_login'); // user your admin username
if (Mage::getSingleton('adminhtml/url')->useSecretKey()) {
Mage::getSingleton('adminhtml/url')->renewSecretUrls();
}
$session = Mage::getSingleton('admin/session');
$session->setIsFirstVisit(true);
$session->setUser($user);
$session->setAcl(Mage::getResourceModel('admin/acl')->loadAcl());
Mage::dispatchEvent('admin_session_user_login_success',array('user'=>$user));
if ($session->isLoggedIn()) {
echo "Logged in";
}
else{
echo 'Not Logged';
}
?>

How can i login using email address in zend?

I have the situtation like , Admin should login as User from Admin End. I have user email address which is username for my site.
I am using following code in login page.
...
$users = new Default_Model_DbTable_Users();
$auth = Zend_Auth::getInstance();
$auth = Zend_Auth::getInstance();
$authAdapter = new Zend_Auth_Adapter_DbTable($users->getAdapter(),'customers');
$authAdapter->setIdentityColumn('email')->setCredentialColumn('password');
$authAdapter->setIdentity($username)->setCredential(base64_encode($password));
$authAdapter->getDbSelect()->where('status = 1');
$result = $auth->authenticate($authAdapter);
.....
Now I have to use only email address to login. I can check whether ADMIN do the user login from admin end. Is it possible to login using email address ?. Kindly advice on this
If you would like to allow admin to log in as any user from the admin panel, you don't have to use Zend_Auth::authenticate() to check any credentials against the database. All you really need to do is set up the identity like you do for a normal user login.
From admin you might do something like this:
$user = getUserInfoFromDatabase(); // get the user object used for Zend_Auth identity
$auth = Zend_Auth::getInstance()->getStorage()->write($user);
// redirect admin to user frontend
The only important thing is that whatever you write() to the storage, must be the EXACT same object/data you write to storage from your user login code.
It doesn't matter how the data gets there, as long as it is what your application requires to check identity.
Since your admin has already been authenticated and has permission to access a user account, you don't need to use Zend_Auth::authenticate() to validate the user email/password, you can skip that step and simply assign the identity for the admin directly to the session.
You may need to use separate session namespaces for admin and users if you are not already.
Hope that helps, let me know if I can clarify anything. The part where you set the identity is probably short after $result = $auth->authenticate($authAdapter); in your code, probably inside if ($result == true)