forked from hng-tech/remote_job_alert
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from hnginternship5/master
Recent update
- Loading branch information
Showing
9 changed files
with
120 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
const mongoose = require('mongoose'); | ||
const AdminSchema = new mongoose.Schema({ | ||
username: { | ||
type: String, | ||
unique: true, | ||
required: true, | ||
trim: true | ||
}, | ||
password: { | ||
type: String, | ||
required: true, | ||
} | ||
}); | ||
|
||
|
||
AdminSchema.statics.authenticate = function (username, password, callback) { | ||
Admin.findOne({ username: username, | ||
password: password | ||
}) | ||
.exec(function (err, admin) { | ||
if (err) { | ||
return callback(err) | ||
} else if (!admin) { | ||
var err = new Error('User not found.'); | ||
err.status = 401; | ||
return callback(err); | ||
} else { | ||
return callback(null, admin); | ||
} | ||
|
||
}); | ||
} | ||
|
||
|
||
|
||
var Admin = mongoose.model('Admin', AdminSchema); | ||
module.exports = Admin; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{{> header }} | ||
<div class="container d-flex"> | ||
|
||
<div style="text-align: center;"> | ||
<div class="form-text" style="display: inline-block;"> | ||
<h2 class="text-center">Admin Login</h2> | ||
<p class="text-center">Authorised Personnel Only</p> | ||
</div> | ||
<div style="display: inline-block;"> | ||
<form action="/admin" method="POST"> | ||
<input style="margin-right: 15px;" type="text" name="username" placeholder="Username" required> | ||
<input style="margin-right: 15px;" type="password" name="password" placeholder="Password" required> | ||
<br/> | ||
<button style="margin-top: 10px; margin-bottom: 10px;" class="btn btn-primary">Login</button> | ||
</form> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
<script src="views/dist/js/bootstrap.min.js"></script> {{> footer}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters