Laravel 5.4 - rename id and password fields - authentication

I have one doubt, I'm new at Laravel 5.4 and I've been developing an login for an application, the tables ApiUsuarios have the fields usu_id, usu_nick and usu_password.
My surprise comes when I've been able to add a new user, but not to login, and only way that I can solve this was renaming my usu_id > id and the usu_password to password.
Is there any other solution?
Here is my project in github
https://github.com/kevingcfcb88/pokeapi_laravel.git
In the branch development.
Thanks in advance.

Related

Implement web push in laravel

I m trying to implement web push notification in my laravel application and I have setup web push for laravel by follow along the tutorial from the tutorial below
https://medium.com/#sagarmaheshwary31/push-notifications-with-laravel-and-webpush-446884265aaa
but there are still some question that I am not understand
Why we need the push_subscription in database ? It seems like I not even used it elsewhere ?
laravel notification not working ( if i did like this )
$users = User::whereIn('id', $vendor_user_ids)->get();
Notification::send($users, new WebChatPushNotification($chat));
but it work if I use Notification::send(User::all(), new WebChatPushNotification($chat));
since both of them are also a collection of user model, but why the latest one work.
and is there any other tutorial that can explain about web push more better that are recommended ?
Oh ya, for your information, I am using Laravel 8 and laravel-notification-channels/webpush package
Thanks in advance!
Finnally, I managed to solve it by myself.
the package itself will need to query the user's endpoint from the table when we try to notify the user.
Notification wont show because my $users is null, so nobody will be notify. such a silly mistakes, sorry for trying to ask such silly question here.

How to access a custom module from the website (for portal users) [odoo13]

I have a custom module for user to upload some information and files
I can use forms and make the module accessible from the website but I need them to be able to edit there recored also, exactly like if they are internal user but only for y custom module
anyone knows how to do that thank u very much in advance.
edit
after reading the comment of #KevalMehta
I think my question should be how to update a record from a form
this is my code to create a new record in my module
request.env['manager.create_company_link'].sudo().create(kw)
so first I think I need the id of the record I need to update before how to update it
I thing #KevalMehta is referring to me using .sudo() how to give the right access

Kohana 3 auth username as number

I want to use numbers as username in Kohana Auth. For example, username 100001?
While adding new user Kohana returns me error: ORM_Validation_Exception [ 0 ]: Failed to validate array
Is is possible to user numbers as username in Kohana?
EDIT: This answer looks simpler and better than mine, but try to understand it at all.
You need to extend User Model, I'll help you using auth with the ORM driver.
Steps to extend User Model:
If you didn't yet, configure Auth module to use orm and create a database table with the fields you want. Here is a good example of how to doing it (It's an old tutorial using ko3.1 but you can still learn from it). PS.: you can have any columns at the 'users' table and you don't need to have the 'username' column if you do not want.
Open and read carefully this file: MODULES/orm/classes/model/auth/user.php (It's self documented and I hope you understand it. If not, stop reading this answer here and read the kohana docs. Some shortcuts: Auth - Kohana User Guide, Auth (orm) methods, addons:auth
Copy the file (don't edit the original) to APPPATH/classes/model/auth/user.php and edit it how you want. Some functions that you may like to edit are: rules, filters and unique_key (<- useful). Be creative, you also can add custom functions.
Test and change whatever else needed.
You can change the login method to works as you like. You can set login by e-mail, make a custom validation method or parse values before saving in the database (see public function filters()). This is helpful for whatever you try to do with auth module using ORM... But... if you really don't want to use ORM, you can build your own driver, learn how.
I made this some time ago in kohana 3.2 but I think you won't get problems with 3.3. If you still have questions, this question on kohana forum may help.

SocialEngine 4 i want to allow editing for owner only

An existing Project i'm currently working on is based on SocialEngine 4, and i have to extend a plugin to allow Members for creating new stuff/editing their own stuff. Right now i got it to let them make new entries. They're also able to edit globally.Now my Question is how to change that into more granular permissions. Since i didn't found any documentary about what is what in "engine4_authorization_permissions" it would be great if someone could explain that to me, since socialengineforum.com is offline.
greets
Jan
Please take a look to permission use in group plugin.
<<<<
you can also use same permission in your plugin.

How can I integrate users' logins from my site into phpBB?

I need some help with what is probably a newbie question in terms of modifying phpBB.
I have a whole system developed in PHP, and I would like to integrate phpBB so that people can navigate into the forums and post seamlessly, without logging in again.
Now, using the phpBB users table as the users table for my system (and having people register in phpBB instead of in my website) is not possible unfortunately (it'd take more work to redo our system than to build our own basic forum).
I'm assuming I can hack my way into making phpBB believe that a certain user ID has logged in, however, that user won't exist in phpBB's users table (which I'm assuming will cause it to error out pretty much everywhere).
All the tutorials and forum posts I could find implied having phpBB as the primary. I couldn't find anything to do it the other way around.
I'm guessing the only possible way to solve this is by having both tables relatively synchronized.
Now, provided that I can have both users table synchronized, what is the best way to integrate both sites, keeping my site's login and users table as the "primary" ones?
Also, is there anything in particular I should keep in mind when creating records in phpBB's users table? Or is it relatively straightforward to figure out? What tables should I be writing to, if there is more than one?
This is an old question so I'm sure you've worked something out by now, but if you need to refactor things in the future, this is entirely possible with authentication plugins in phpBB3:
http://wiki.phpbb.com/Authentication_plugins
I'm working on one now where phpBB is the "secondary" system, and it's going pretty well.
I just worked on this task today, after some investigation implemented an Authentication plugin Here is a good example Getting phpBB to accept Django sessions
I have integrated phpBB with a site before, however I used phpBB's login system/users table as the primary one as you said. Since phpBB is a pretty advanced forum software, it would be a pretty time consuming project to change its user and login system completely.
When I had to use the site's login as the primary one, I used PunBB. It was way simpler to modify PunBB.
If you absolutely have to use your own login as primary, and phpBB, then I agree with you in that the easiest way would be to keep the tables synchronized, and call both the login scripts when somebody logs in.
When you're inserting data into phpBB, the users table is pretty straightforward. Each entry has the basic info for a user, and if you have custom fields for the user profiles, they go into the profile_fields and profile_fields_data tables.
One tricky thing is how phpBB encrypts user passwords. I think you have to use phpBB's function called phpbb_hash($password) to do that. It's declared in the file
phpbb/includes/functions.php
For the phpBB login code, see funciton login_box in file phpbb/includes/functions.php
You can use the below to login into phpBB:
$result=$auth->login($username, $password);
if ($result['status'] == LOGIN_SUCCESS) {
echo "You're logged in";
} else {
echo $user->lang[$result['error_msg']];
}