M
M
Mishcake2020-05-23 10:41:02
Kohana
Mishcake, 2020-05-23 10:41:02

How to change password in Kohana framework?

Hello. I got an ancient self-written admin panel on Kohana to work. You need to change the password to restrict access to old admins. But the developer did not add the password change functionality, but he created the admin user himself.

I dug into the sources and found a file in which the login data is hardwired. When editing, the ability to enter the admin panel disappears (writes "wrong password"), so I decided that this is where you need to dig. But I can't figure it out.

modules -> auth -> config -> auth.php

<?php defined('SYSPATH') OR die('No direct access allowed.');

return array(

  'driver'       => 'File',
  'hash_method'  => 'sha256',
  'hash_key'     => 'blablabla',
  'lifetime'     => 1209600,
  'session_type' => Session::$default,
  'session_key'  => 'auth_user',

  // Username/password combinations for the Auth File driver
  'users' => array(
    'admin' => 'хэш пароля',
  ),

);


I tried to hash manually on third-party services and insert the second line of another user - it does not help. Changed the hash of the password to a password without a hash - does not help.

How to change the password in this system? Help me please.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander Komarchuk, 2020-05-23
@Mishcake

After all, google has everything. Look here: Kohana 3.1: Simple User Authentication
There is even a video in the article " Kohana video course " - "Working with the authorization module in Kohana".
If you just need to close access quickly, try using " HTTP basic authentication "
There is an article on this topic

E
entermix, 2020-09-02
@entermix

You can hash the password using the hash_password method
https://github.com/kohana/auth/blob/3.3/master/cla...

echo Auth::instance()->hash_password('new password')

https://stackoverflow.com/questions/4248068/genera...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question