🎨 改进登录方式

This commit is contained in:
WispX
2021-07-28 10:27:22 +08:00
parent e4e7e57580
commit fbbc69f80a
2 changed files with 2 additions and 9 deletions
+2 -2
View File
@@ -14,11 +14,11 @@ use think\facade\Session;
class Auth extends Base
{
public function login($type = null, $account = null, $password = null)
public function login($account = null, $password = null)
{
if ($this->request->isPost()) {
try {
Users::login($account, $password, $type);
Users::login($account, $password, filter_var($account, FILTER_VALIDATE_EMAIL) ? 'email' : 'username');
} catch (Exception $e) {
Session::flash('error', $e->getMessage());
return $this->fetch();
-7
View File
@@ -16,13 +16,6 @@
<div class="panel-body-box">
<form action="{:url('auth/login')}" method="post">
{include file="common:alert"}
<div class="mt-3">
<label class="mdui-textfield-label">{:lang('Login mode')}</label>
<select class="mdui-select" mdui-select name="type">
<option value="email" {if input('post.type') === 'email'} selected{/if}>{:lang('Mailbox')}</option>
<option value="username" {if input('post.type') === 'username'} selected{/if}>{:lang('User name')}</option>
</select>
</div>
<div class="mdui-textfield mdui-textfield-floating-label">
<label class="mdui-textfield-label">{:lang('Account')}</label>
<input class="mdui-textfield-input" type="text" name="account" value="{:input('post.account')}"/>