Skip to content

Full Stack Programmer

Need a website, web app or API?

Full Stack Programmer

Need a website, web app or API?

  • 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,057
Author: Danyal
I'm working as programmer since 2002. Born, grew up, studied and worked in Pakistan now Im located in Denmark since 2006.

Post navigation

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

Posts

  • 15+ Javascript Array Methods January 19, 2023
  • Learn how to use .filter() on Array in javascript January 18, 2023
  • Microbit: Blink and Breath (LED Module) December 30, 2022
  • Microbit: Someone comes & sense and blink December 22, 2022
  • vuejs 3 emit the warning “Extraneous non-emits event listeners” December 5, 2022
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
danyal.dk

Other Posts

  • 15+ Javascript Array Methods January 19, 2023
  • Learn how to use .filter() on Array in javascript January 18, 2023
  • Microbit: Blink and Breath (LED Module) December 30, 2022
  • Microbit: Someone comes & sense and blink December 22, 2022
  • vuejs 3 emit the warning “Extraneous non-emits event listeners” December 5, 2022

Advertisement

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 (14) jQuery (3) js (5) laravel (18) 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) network (2) node (3) php (20) python (5) 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 (12)

Advertisement

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

Recent Posts

  • 15+ Javascript Array Methods
  • Learn how to use .filter() on Array in javascript
  • Microbit: Blink and Breath (LED Module)
  • Microbit: Someone comes & sense and blink
  • vuejs 3 emit the warning “Extraneous non-emits event listeners”
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 (14) jQuery (3) js (5) laravel (18) 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) network (2) node (3) php (20) python (5) 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 (12)

Search:

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 (14)
  • Laravel (29)
  • Laravel 5.5 (8)
  • Linux (10)
  • Lumen (6)
  • Microbit (3)
  • MySQL (5)
  • News & Updates (5)
  • Nginx (2)
  • Node (1)
  • Nuxt.js (2)
  • osMac (3)
  • Package Managers (1)
  • PHP (26)
  • Programming (4)
  • Python (2)
  • Ruby on Rails (1)
  • Symfony (3)
  • Tips (7)
  • Ubuntu (11)
  • Ubuntu 16.04 (10)
  • Ubuntu 17 (6)
  • Uncategorized (7)
  • Vuejs (10)
  • xcode (2)

Recent Posts

  • 15+ Javascript Array Methods
  • Learn how to use .filter() on Array in javascript
  • Microbit: Blink and Breath (LED Module)
  • Microbit: Someone comes & sense and blink
  • vuejs 3 emit the warning “Extraneous non-emits event listeners”

Most Viewed Posts

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

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 Merdeka 118
  • Facts about Brandenburg gate
  • Facts about the Berliner Fernsehturm
  • Top ten tallest buildings in the world
  • Facts about Lego House Billund
  • Facts about Universe science park
  • Top ten tourist places in Denmark
  • Facts about Rundetårnet

RSS Abdulsamad.dk

  • Learn facts about eiffel tower
  • Digt om kedsomhed
  • digt om kærlighed
  • scroll:bit for micro:bit
  • Micro:Rover for the microbit
  • Fakta om en kat. på Dansk
  • Fakta om Gorilla På dansk
  • Flagermus/Bats

RSS Laravel News

  • Building APIs in Laravel
  • Testmo Review: Unified Test Management
  • Statamic announces a new Flat Camp retreat
  • Simple Ad, Banner, and Callouts Manager for Laravel
  • Learn all about Laravel's dependency injection container

RSS Python Insider

  • Python 3.12.0 alpha 4 released
  • Python 3.11.1, 3.10.9, 3.9.16, 3.8.16, 3.7.16, and 3.12.0 alpha 3 are now available
  • Python 3.12.0 alpha 2 released
  • Python 3.12.0 alpha 1 released
  • Python 3.11.0 is 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 network node php python SQL ssh SSL Symfony Symfony 4 technology tip of the day tips ubuntu Ubuntu 16.04 ultrabit upgrade vuejs

Copyright © 2023 Full Stack Programmer

Design by ThemesDNA.com