mirror of
https://github.com/Akif9748/akf-forum.git
synced 2024-11-26 05:10:41 +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
|
- forum setup page rewrite and directly open a router
|
||||||
- login w/ email
|
- login w/ email
|
||||||
- BETTER SETUP PAGE
|
- BETTER SETUP PAGE
|
||||||
### front-end
|
|
||||||
|
|
||||||
|
### front-end
|
||||||
- text alling center body
|
- text alling center body
|
||||||
- add a css file for CodeMirror in threads / send message ok
|
- add a css file for CodeMirror in threads / send message ok
|
||||||
- old contents / titles add to forum interface
|
- 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
|
#### css fix
|
||||||
- admin page to css file
|
- 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:
|
threads:
|
||||||
<style>
|
<style>
|
||||||
.fa {
|
.fa {
|
||||||
|
|
|
@ -12,8 +12,10 @@ app.post("/", async (req, res) => {
|
||||||
|
|
||||||
if (!name || !password) return res.error(400, "You forgot entering some values")
|
if (!name || !password) return res.error(400, "You forgot entering some values")
|
||||||
|
|
||||||
const member = await UserModel.findOne({ name }, "+password");
|
const member = await UserModel.findOne({
|
||||||
if (!member || member.deleted) return res.error(401, 'Incorrect username!');
|
$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!');
|
if (!await bcrypt.compare(password, member.password)) return res.error(401, 'Incorrect password!');
|
||||||
|
|
||||||
req.session.userID = member.id;
|
req.session.userID = member.id;
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
|
|
||||||
<form class="login" action="/login?redirect=<%= redirect !== "/register" ? redirect : "/" %>" method="post">
|
<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="password" name="password" placeholder="Password" class="input" required>
|
||||||
<input type="submit" style="width:100%" class="btn-primary" value="Login">
|
<input type="submit" style="width:100%" class="btn-primary" value="Login">
|
||||||
</form>
|
</form>
|
||||||
|
|
Loading…
Reference in a new issue