/** * Registers a new user account. If registration was successful it will set flash message. * * @return bool */ public function temporary() { /** @var User $user */ $user = new \common\models\User(); $user->username = '******' . substr(str_shuffle(str_repeat("0123456789abcdefghijklmnopqrstuvwxyz", 10)), 0, 10); $user->auth_key = Yii::$app->security->generateRandomString(); $user->password_hash = Yii::$app->security->generateRandomString() . '_' . time(); $user->password = Yii::$app->security->generateRandomString() . '_' . time(); $user->email = Yii::$app->security->generateRandomString() . '@' . substr(str_shuffle(str_repeat("abcdefghijklmnopq", 4)), 0, 4) . '.com'; $user->generatePasswordResetToken(); $user->is_provider = 0; $user->registered_by(); $user->generateInviteHash(); $user->generatePhoneVerificationHash(); $user->generateRoleCode(); $user->created_at = time(); $user->updated_at = time(); $user->status = 10; if (!$user->temporary()) { return false; } return $user; }