the browser-facing portion of osu!
at master 674 B view raw
1<?php 2 3// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the GNU Affero General Public License v3.0. 4// See the LICENCE file in the repository root for full licence text. 5 6namespace App\Models; 7 8/** 9 * @property mixed $hash 10 */ 11class WeakPassword extends Model 12{ 13 public $incrementing = false; 14 public $timestamps = false; 15 protected $primaryKey = 'hash'; 16 protected $keyType = 'string'; 17 18 public static function add($string) 19 { 20 static::create(['hash' => md5(strtolower($string), true)]); 21 } 22 23 public static function check($string) 24 { 25 return static::where(['hash' => md5(strtolower($string), true)])->exists(); 26 } 27}