Migrate Ucoz password

Converting from other board software? Good decision! Need help? Have a question about a convertor? Wish to offer a convertor package? Post here.
Post Reply
b33
Registered User
Posts: 4
Joined: Mon Oct 10, 2016 1:20 pm

Migrate Ucoz password

Post by b33 » Mon Oct 10, 2016 1:58 pm

Hello.

I converted ucoz-forum to phpBB 3.1, but I have one problem - I can't login to phpBB 3.1 with my ucoz login/password. I've tried to create ucoz password driver in phpBB, but all of my attempts had no positive results :)

For example, ucoz password hash is - $1$wP1c$DWFJ4mfkMI.CSaGsjxSoN.
Where $wP1c$ - random salt for each user. The password for this hash is - "255429"
So, ucoz create its hash by using the standart php function crypt();

Code: Select all

crypt('255429','$1$wP1c$');
Can anyone help to create password driver?
Thanks, and sorry for my eng.

User avatar
Mick
Support Team Member
Support Team Member
Posts: 18011
Joined: Fri Aug 29, 2008 9:49 am
Location: Cardiff

Re: Migrate Ucoz password

Post by Mick » Mon Oct 10, 2016 2:09 pm

There's nothing you can do with the hashes as it's a security feature. The passwords are hashed which is a one way process. Presumably you can't use the I forgot my password link? You can create a temporary admin account to help reset your account. Don't forget to backup the database before running the query.

In phpMyAdmin run the following SQL query, which will create an admin user named Admin1 with a password of admin. From that point you should be able to get into the ACP.

Code: Select all

INSERT INTO phpbb_users (user_type, group_id, username, username_clean, user_regdate, user_password, user_email, user_lang, user_style, user_rank, user_colour, user_posts, user_permissions, user_ip, user_birthday, user_lastpage, user_last_confirm_key, user_post_sortby_type, user_post_sortby_dir, user_topic_sortby_type, user_topic_sortby_dir, user_avatar, user_sig, user_sig_bbcode_uid, user_jabber, user_actkey, user_newpasswd) VALUES (3, 5, 'Admin1', 'admin1', 0, '21232f297a57a5a743894a0e4a801fc3', 'admin@example.com', 'en', 1, 1, 'AA0000', 1, '', '', '', '', '', 't', 'a', 't', 'd', '', '', '', '', '', '');
Change your table prefix if it is not phpbb_

See Executing SQL Queries in phpMyAdmin if you are unfamiliar with running database queries.

As soon as you have done this, use the temporary admin account to change the details on the original admin account, then delete the temporary account.
This is because:
  1. anyone could use that account to log in to your board if you didn’t change the password.
  2. this temporary user has not been fully set up (e.g. it is not a member of the “Registered users” group, so it won’t have normal access to your forums).
To remove the account you will first need to remove “founder” status from it: ACP> Users and groups> Manage Users> Admin1> Overview> Founder = No
"The more connected we get the more alone we become" - Kyle Broflovski

There are no ‘threads’ in phpBB, they are topics.
Forza Garibaldi

b33
Registered User
Posts: 4
Joined: Mon Oct 10, 2016 1:20 pm

Re: Migrate Ucoz password

Post by b33 » Mon Oct 10, 2016 2:22 pm

Yes I know it, but I have over 500 users in my forum. And it's looks not user-friendly. I want to do it technologically.

User avatar
Mick
Support Team Member
Support Team Member
Posts: 18011
Joined: Fri Aug 29, 2008 9:49 am
Location: Cardiff

Re: Migrate Ucoz password

Post by Mick » Mon Oct 10, 2016 2:29 pm

Aah, apologies, I thought it was just you couldn't access your admin account after the conversion.
"The more connected we get the more alone we become" - Kyle Broflovski

There are no ‘threads’ in phpBB, they are topics.
Forza Garibaldi

b33
Registered User
Posts: 4
Joined: Mon Oct 10, 2016 1:20 pm

Re: Migrate Ucoz password

Post by b33 » Tue Oct 11, 2016 6:12 am

To migrate from ucoz to phpBB 3.0 I've used this script http://phpbbex.com/forum/viewtopic.php?t=131
According the instructions we need edit the file auth_db.php to login with your ucoz-account

Open and find

Code: Select all

|| (strlen($row['user_password']) == 32  && (md5($password_old_format) == $row['user_password'] || md5(utf8_to_cp1252($password_old_format)) == $row['user_password'])) 
Add

Code: Select all

|| crypt($password_old_format, $row['user_password']) == $row['user_password']
But it's works only in phpBB 3.0 version, phpBB 3.1 uses another login realisation.

b33
Registered User
Posts: 4
Joined: Mon Oct 10, 2016 1:20 pm

Re: Migrate Ucoz password

Post by b33 » Mon Oct 24, 2016 12:54 pm

Solved

Open config/password.yml and Add

Code: Select all

  passwords.driver.ucoz:
        class: phpbb\passwords\driver\ucoz
        arguments:
            - @config
            - @passwords.driver_helper
        tags:
            - { name: passwords.driver }
Create ucoz.php in phpbb/passwords/driver

Code: Select all

<?php

namespace phpbb\passwords\driver;

class ucoz extends base
{
   const PREFIX = '$1$';

   public function get_prefix()
   {
      return self::PREFIX;
   }


   public function hash($password, $salt = '')
   {
      if ($salt == '')
      {
         $salt = $prefix;
      }

      $salt = substr($salt,0,8);
      $hash = crypt($password, $salt);
      return $hash;
   }


   public function check($password, $hash, $user_row = array())
   {
      $salt = substr($hash, 0, 30);
      if (strlen($salt) != 30)
      {
         return false;
      }

      if ($this->helper->string_compare($hash, $this->hash($password, $salt)))
      {
         return true;
      }
      return false;
   }

}

Post Reply

Return to “[3.1.x] Convertors”

Who is online

Users browsing this forum: No registered users and 2 guests

cron