Laravel User Authentication with Username instead of Email

The Laravel standard authentication method is to enter email-address and password to login after the authentication is added with php artisan make:auth.
If you are working on an application for a company that is only used by employees, they have their usernames and passwords, so it doesn’t make sense to sign in with the email-address.

At the registration process, which will be done in this case by an administrator, a username is already requested. I saw some videos for this type of registration with an extra username database field for registration. I’m the existing one.

Laravel 5.4 needs php7. Not all servers of the world run still on php7. So I show how the authentication with the username works on Laravel 5.4 and 5.2.45 which runs under php5.

Laravel 5.4
Edit app/Http/Controllers/Auth/LoginController.php

(click to enlarge)


protected $username = 'name';
 public function username()
 return 'name';

like it is shown i the picture.
Laravel has still a function for authentication with the username. I this case the variable $username is filled with our database field „name“ which is the name of the user which was used at registration.

Edit app/Http/Controllers/Auth/RegisterController.php

(click to enlarge)

Add the „unique“ attribute to „name“ in the Validator.

Edit resources/views/auth/login.blade.php

(click to enlarge)

Change all the the „email“ to „name“. If you use find / replace take care of the type-attribute at input. It should be „text“ and not „name“. 😉

Laravel 5.2.45

Here are other controllers for authentication.

Edit app/Http/Controllers/Auth/AuthController.php

(click to enlarge)

Add only

protected $username = 'name';

like it is shown in the picture and add the „unique“ attribute to „name“ in the Validator.
Than change the view like in Laravel 5.4.

J2EE with Netbeans and Tomcat with Ubuntu Mate

You should have installed a recent java jdk. If you want also use java FX install the Oracle jdk. Open jdk has some trouble with java FX cause licences.
J2EE may not be downloaded from Oracle separately.
Install Netbeans from the Ubuntu repository and download tomcat .gz file from
Netbeans will be version 8.1 and I use tomcat 8.5.15. My OS is Ubuntu Mate 17.04.
Extract the apache-tomcat-8.5.15.tar.gz to your home-folder or where ever you want.
Start Netbeans and select from the Tools menu Plugins.
Add Java EE Base and EjB and EAR plugins.

(click to enlarge)

Without the EjB and EAR plugin an „javaee-endorsed-api-7.0.jar missing error“ will raise, when you start a new project.

Go to the Tool menu and choose Servers.
Click on Add Server .. down left in the window and choose Apache Tomcat or TomEE.
The server location is the root directory where tomcat was extracted to, i.e. the tomcat folder in your home folder.
Enter a username and a password and leave the option „Create user …“ checked.

There is also a well known bug in the tomcat configuration you have to fix.
Open the server.xml in <tomcat-folder>/bin set the connector tag as comment and define the connector like this:


(click to enlarge)

That’s it.
Now you can start a new project and test the installation. When click on the green arrow for „run project“ the code will be deployed, tomcat is starting and a new browser-window or tab opens with the result of your code.
This setup is so much easier than with MS Windows. And except download times you will be back at work in less than 15 minutes.

(click to enlarge)


Screen tearing on Linux on Thinkpad X201 with Ultrabase Dock on external LCD display

I have had the problem, that „waves“ were moving from the bottom of the monitor to the top.
It was not important which linux distribution I used. It was the same on every distribution. But most worst it was on XFCE environments. I tried to fix it with driver options and other compositors like compton, but nothing really helps.
For another reason I unplugged one time all USB devices from the dock. And the screen tearing was gone. I was surprised.
I found that the tearing comes from the power management. It tries to turn USB devices of and turn them directly on again. That results the tearing on the screen.
There is an advanced power management system called tlp that is available for every distribution.
Install tlp and set USB_AUTOSUSPEND = 0 in /etc/default/tlp . After that restart the computer or restart the service tlp and the „waves“ are history.
I tested this with Ubuntu MATE, Xubuntu, Ubuntu Gnome, Opensuse XFCE / Gnome, Debian XFCE / MATE / Gnome, Fedora Gnome 24/25, Manjaro XFCE and Linux Mint 18 MATE / Cinnamon.
Perhaps this will work with other machines with an intel i915 graphic chip.