mirror of
https://github.com/Akif9748/akf-forum.git
synced 2024-12-22 15:49:08 +03:00
login with email
This commit is contained in:
parent
10b021c16f
commit
30c701c09e
3 changed files with 6 additions and 5 deletions
|
@ -62,8 +62,8 @@ Akf-forum has got an API for AJAX (fetch), other clients etc. And, you can learn
|
|||
- forum setup page rewrite and directly open a router
|
||||
- login w/ email
|
||||
- BETTER SETUP PAGE
|
||||
### front-end
|
||||
|
||||
### front-end
|
||||
- text alling center body
|
||||
- add a css file for CodeMirror in threads / send message ok
|
||||
- old contents / titles add to forum interface
|
||||
|
@ -78,7 +78,6 @@ Akf-forum has got an API for AJAX (fetch), other clients etc. And, you can learn
|
|||
|
||||
#### css fix
|
||||
- admin page to css file
|
||||
https://medium.com/@minhquocece/how-to-create-an-upload-avatar-feature-like-facebook-by-cropper-js-and-slider-879990fdce82
|
||||
threads:
|
||||
<style>
|
||||
.fa {
|
||||
|
|
|
@ -12,8 +12,10 @@ app.post("/", async (req, res) => {
|
|||
|
||||
if (!name || !password) return res.error(400, "You forgot entering some values")
|
||||
|
||||
const member = await UserModel.findOne({ name }, "+password");
|
||||
if (!member || member.deleted) return res.error(401, 'Incorrect username!');
|
||||
const member = await UserModel.findOne({
|
||||
$or: [{ name }, { email: name }]
|
||||
}, "+password");
|
||||
if (!member || member.deleted) return res.error(401, 'Incorrect username or email!');
|
||||
if (!await bcrypt.compare(password, member.password)) return res.error(401, 'Incorrect password!');
|
||||
|
||||
req.session.userID = member.id;
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
<form class="login" action="/login?redirect=<%= redirect !== "/register" ? redirect : "/" %>" method="post">
|
||||
|
||||
<input type="text" name="name" placeholder="Username" class="input" required>
|
||||
<input type="text" name="name" placeholder="Email/Username" class="input" required>
|
||||
<input type="password" name="password" placeholder="Password" class="input" required>
|
||||
<input type="submit" style="width:100%" class="btn-primary" value="Login">
|
||||
</form>
|
||||
|
|
Loading…
Reference in a new issue