Browse Source

rename method name

main
ghost 3 years ago
parent
commit
2fdd59338c
  1. 3
      src/application/controller/login.php
  2. 2
      src/application/controller/register.php
  3. 2
      src/application/model/user.php

3
src/application/controller/login.php

@ -61,7 +61,7 @@ if (isset($_POST) && $_POST) {
if (!$errorUserName && !$errorUserPrivateKey) { if (!$errorUserName && !$errorUserPrivateKey) {
// Check user exists // Check user exists
if ($_modelUser->userNameExists($userName)) { if ($userId = $_modelUser->getUserId($userName)) {
if ($_twister->importWallet($userName, $userPrivateKey)) { if ($_twister->importWallet($userName, $userPrivateKey)) {
@ -78,6 +78,7 @@ if (isset($_POST) && $_POST) {
session_start(); session_start();
$_SESSION['userName'] = $userName; $_SESSION['userName'] = $userName;
$_SESSION['userId'] = $userId;
// Redirect // Redirect
header('Location: ' . PROJECT_HOST, true, 302); header('Location: ' . PROJECT_HOST, true, 302);

2
src/application/controller/register.php

@ -57,7 +57,7 @@ if (isset($_POST) && $_POST) {
$errorUserName = _('Username required.'); $errorUserName = _('Username required.');
} }
if ($_modelUser->userNameExists($userName)) { if ($_modelUser->getUserId($userName)) {
$errorUserName = _('Username already taken.'); $errorUserName = _('Username already taken.');
} }

2
src/application/model/user.php

@ -54,7 +54,7 @@ class ModelUser extends Model {
} }
} }
public function userNameExists(string $userName) { public function getUserId(string $userName) {
try { try {

Loading…
Cancel
Save