public function addFrom($from, $alias = '') { if ($alias === '') { if (is_string($from)) { $alias = $from; } else { $alias = Config::randomString(3); } } $this->table = array_merge($this->table, [$alias => ['type' => 'from', 'table' => $from]]); return $this; }
public function newPassword() { Users::redirectIf(true); try { $user = Users::findOrFail('mail', Helper::post('mail')); $pass = Config::randomString(8); $user->password = password_hash($pass, PASSWORD_BCRYPT); $user->save(); Users::resendPassword($user, $pass); } catch (\Exception $e) { Session::setFlash('danger', '', 'Aucun compte trouvée avec cette adresse email !'); } Router::redirect('user.signin'); }