Skip to content

Full Stack Programmer

Just another blog classic, isn't it!

Full Stack Programmer

Just another blog classic, isn't it!

  • Blog
  • Who am i?
  • More About Me
    • Skills
    • Experience
    • Recommendations
    • Education
    • My Activities
  • IT Services
  • #Instagram
  • Contact
  • Privacy & Policy
Lumen

Lumen/Lumen: Create & Check Password

 Danyal  April 15, 2020  Posted in Laravel Tagged Authentication, hash, login, password

Laravel/Lumen comes with Hash facade that provides the secure Bcrypt & Argon2 hashing for storing user string passwords.

Default Laravel Login & Register Controllers uses Bcrypt for authentication.

Let’s take a look at the basic implementation:

<?php

namespace App\Http\Controllers;

use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Hash;

class UserController extends Controller
{
    /**
     * Update the password for the user.
     *
     * @param  Request  $request
     * @return Response
     */
    public function update(Request $request)
    {
        $request->user()->fill([
            'password' => Hash::make($request->newPassword)
        ])->save();
    }

    /**
     * Check stored password
     *
     * @param  Request  $request
     * @return Response
     */
    public function check(Request $request)
    {
      $user = User::where('email', '=', 'hello@email.com')->first();
      if ($user) {
          if (Hash::check($request->get('password'), $user->password) {
            // unauthenticated
            return ['error' => 'unauthenticated'];
          }
      }
      return [];
    }
}

Post Views: 5,664
Author: Danyal
I'm skilled programmer with expertise in Vue.js/Nux.js for front-end development and PHP Laravel for back-end development. I excel in building APIs and services, and also have experience in web server setup & maintenance. My versatile skill set allows you to develop and maintain web applications effectively, from the user interface to the server-side functionality. I love coding with never ending learning attitude, thanks for visiting danya.dk

Post navigation

Tip: How to install pip on mac OS →
← Laravel: Usage of old() in form when editing
danyal.dk

Posts

  • Vue 3 State Management September 16, 2023
  • Trip to Hintertux Glacier (Hintertuxer Gletscher) August 27, 2023
  • Project 36: Joystick June 12, 2023
  • How to Create a Script Element in JavaScript? June 8, 2023
  • Laravel Migration: How to add a column with a default of an existing column June 6, 2023
Backend Skills
Website & Web App Development
PHP Slim, Symfony 3.4, Laravel 5.8 & Lumen 5.8
MVC Applications and RestAPI's Development (PHP 5.6 & PHP 7)
MySQL, MongoDB, PostgresQL
Apache2, Nginx, Caching & Cloud Server Management
Frontend Skills
Javascript, jQuery, AngularJS, CSS3, HTML5, Bootstrap4
Bootstrap4 templating custom SCSS
Nuxtjs & Vuejs
Using in Bold.dk new version and other freelance projects.
Systems & Tools
E-Mail & SMS Marketing & Customer Satisfaction Surveys
SurveyGizmo, eMailPlatform

Tags

.htaccess (2) array (3) Authentication (6) coding (7) commands (6) composer (4) database (5) devops (5) docker (3) drupal (5) Eloquent (3) error (5) Git (3) help (3) javascript (16) jQuery (3) js (5) laravel (19) laravel 5.5 (2) Laravel 5.6 (6) laravel5.7 (4) LaravelPassport (3) linux (7) lumen (7) LumenPassport (3) microbit (3) migration (3) mysql (8) node (3) php (21) python (6) SQL (3) ssh (3) SSL (3) Symfony (2) Symfony 4 (2) technology (7) tip of the day (3) tips (7) ubuntu (8) Ubuntu 16.04 (2) ultrabit (3) upgrade (3) vuejs (13) vuex (3)

Advertisement

Categories

  • Apache2 (1)
  • Chrome (1)
  • CkEditor (1)
  • Cloud (2)
  • CMS (8)
  • Code Editors (1)
  • Code snippets (1)
  • Composer (1)
  • Daily Tips (5)
  • Databases (5)
  • Development (4)
  • Docker (4)
  • Eloquent (1)
  • EU (1)
  • File System (1)
  • Git (3)
  • Google (2)
  • GraphQL (2)
  • Gulp (1)
  • Heandy Tips (2)
  • HTML (1)
  • javascript (15)
  • Laravel (30)
  • Laravel 5.5 (8)
  • Linux (10)
  • Lumen (6)
  • Microbit (4)
  • MySQL (5)
  • News & Updates (5)
  • Nginx (2)
  • Node (1)
  • Nuxt.js (2)
  • osMac (3)
  • Package Managers (1)
  • PHP (27)
  • Programming (4)
  • Python (2)
  • Ruby on Rails (1)
  • Symfony (3)
  • Tips (7)
  • Ubuntu (11)
  • Ubuntu 16.04 (10)
  • Ubuntu 17 (6)
  • Uncategorized (8)
  • Vlog (1)
  • Vuejs (11)
  • xcode (2)

Recent Posts

  • Vue 3 State Management
  • Trip to Hintertux Glacier (Hintertuxer Gletscher)
  • Project 36: Joystick
  • How to Create a Script Element in JavaScript?
  • Laravel Migration: How to add a column with a default of an existing column

Most Viewed Posts

  • Laravel 5.7 Route [login] not defined (15,867)
  • Install Laravel required PHP & Extentions (13,109)
  • Laravel composer install – Your requirements could not be resolved to an installable set of packages. (12,628)
  • Laravel 5.6 use a prefix on database tables (10,165)
  • Dual boot windows 10 & Ubuntu 16.04 – Lenovo Y520 (9,888)

RSS Rida.dk

  • The Berlin Wall
  • Turkey: one of top 10 most visited countries #6
  • Italy: one of top 10 most visited countries #5
  • Daily Motivation #3
  • Daily Motivation #2
  • Daily Motivation #1
  • China: one of top 10 most visited countries #4
  • USA: one of top 10 most visited countries #3

RSS Abdulraheem.dk

  • Facts about Lotte world tower
  • Facts About Ping An Finance Tower
  • Facts about Abraj Al-Bait
  • Facts about Shanghai tower
  • Facts about Merdeka 118
  • Facts about Brandenburg gate
  • Facts about the Berliner Fernsehturm
  • Top ten tallest buildings in the world

RSS Abdulsamad.dk

  • digt om en båndegård
  • Fakta om Monkey land Hillerød
  • Fakta om Universe science park
  • Digt
  • Fakta Ankylosaurer
  • Learn facts about eiffel tower
  • Digt om kedsomhed
  • digt om kærlighed

RSS Laravel News

  • Introducing the Laravel Number Utility Class
  • Laravel Cyber Deals
  • A Feature Flags Implementation for Filament
  • Laravel 10.33 Released
  • PHP 8.3 is released with typed class constants, a json_validate function, and more

RSS Python Insider

  • Python 3.13.0 alpha 2 is now available
  • Python 3.13.0 alpha 1 is now available
  • Python 3.11.6 is now available
  • Python 3.12.0 (final) now available
  • Python 3.12.0 release candidate 3 now available

Tags

.htaccess array Authentication coding commands composer database devops docker drupal Eloquent error Git help javascript jQuery js laravel laravel 5.5 Laravel 5.6 laravel5.7 LaravelPassport linux lumen LumenPassport microbit migration mysql node php python SQL ssh SSL Symfony Symfony 4 technology tip of the day tips ubuntu Ubuntu 16.04 ultrabit upgrade vuejs vuex

Copyright © 2023 Full Stack Programmer

Design by ThemesDNA.com