Welcome Guest, Not a member yet? Register   Sign In
How to add users in Myth/Auth in batches
#1
Smile 
(This post was last modified: 05-03-2022, 03:59 AM by yoshi.)

Thanks for everything.
I was able to add login functionality to an existing app using Myth/Auth, but the next step is to add a large number of dummy users for development. For example, creating a school management system, a school teacher and a school student (e.g. [email protected]).

On the db, if I copy password_hash, activate_hash, active to the users I added with seeder, they can't seem to log in (great in production!). .

Is there any way to add each user in bulk (dummy users can log in) with seeder or other software for development?

Alternatively, it might be possible to add a non-activated user in seeder and add a record to the school_users table using only the id as a foreign key.
Reply
#2

I use the site below to generate dummy data:
http://filldb.info/
Reply
#3

(This post was last modified: 05-03-2022, 12:52 AM by yoshi.)

(05-02-2022, 11:29 PM)JustJohnQ Wrote: I use the site below to generate dummy data:
http://filldb.info/

thanks, JustJohnQI. Smile
I'm not having trouble creating dummy data itself, I just don't know how to approve dummy users in batches.
Reply
#4

Why not use the Database Seeder to add the data to the database table?
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#5

(This post was last modified: 05-03-2022, 04:02 AM by yoshi.)

(05-03-2022, 12:53 AM)InsiteFX Wrote: Why not use the Database Seeder to add the data to the database table?

thanks InsiteFXWhy.

Yes, I am. I am using a database seeder to create users.

I have just noticed the 1st question's answer.
I discovered that the following two dummy users have different passwords.
Instead of using a converted value for each user, using a single converted value.

The password_hash function was converting the same words but spitting out different hashes. This was the cause.

PHP Code:
[
    'id' => 1,
    'email' => '[email protected]',
    'username' => 'sample teacher1',
    'activate_hash' => '59481d0b64af5c49a971bee3ea104ba9',
    'password_hash' => password_hash('apple1111'PASSWORD_DEFAULT),  <-- A
    
'active' => 1,
],
[
    'id' => 2,
    'email' => '[email protected]',
    'username' => 'sample teacher2',
    'activate_hash' => '579257a205f0b1c4947f01d4979afdf4',
    'password_hash' => password_hash('apple1111'PASSWORD_DEFAULT),  <-- B
    
'active' => 1,
], 
Reply
#6

What's your problem?
Myth:Auth has administration commands:
https://github.com/lonnieezell/myth-auth...teUser.php
https://github.com/lonnieezell/myth-auth...teUser.php
You can see how to do in them.
Reply
#7

(05-03-2022, 05:17 AM)kenjis Wrote: What's your problem?
Myth:Auth has administration commands:
https://github.com/lonnieezell/myth-auth...teUser.php
https://github.com/lonnieezell/myth-auth...teUser.php
You can see how to do in them.

thanks, kenjis

My problem was to copy a dummy user for testing the aggregation process. At first I thought that copying dummy users would not work because I did not know how to use Myth/Auth, but what I found out was that "the exact same word will produce different results when hashing is applied.

This problem was solved by putting the value after hashing into a variable and using it around.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB