Skip to content

Commit

Permalink
quick login for testing
Browse files Browse the repository at this point in the history
  • Loading branch information
shamilkotta committed Mar 12, 2023
1 parent 206533c commit 73a647c
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 6 deletions.
4 changes: 2 additions & 2 deletions controllers/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ module.exports = {

postOfficeLogin: (req, res) => {
const { username, password } = req.body;
const name = process.env.OFFICE || "admin";
const pass = process.env.OFFICE_PASS || "admin123";
const name = process.env.OFFICE || "admin@gmail.com";
const pass = process.env.OFFICE_PASS || "admin@123";
if (username === name && password === pass) {
req.session.loggedIn = true;
req.session.user = { username: name, role: "office" };
Expand Down
2 changes: 1 addition & 1 deletion middlewares/multerParse.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const fileFilter = (req, file, cb) => {
return cb(null, true);
};

const upload = multer({ storage, fileFilter, limits: { fileSize: 1048576 } });
const upload = multer({ storage, fileFilter, limits: { fileSize: 2097152 } });

module.exports = (req, res, next) => {
upload.single("profile")(req, res, (err) => {
Expand Down
4 changes: 2 additions & 2 deletions middlewares/validations/office/batchValidations.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ const createBatchSchema = yup.object().shape({
: value
)
.test("isPerfectString", "Please enter valid name", (arg) =>
/^[A-Za-z]+$/.test(arg)
/^[A-Za-z ]+$/.test(arg)
),
})
),
Expand Down Expand Up @@ -186,7 +186,7 @@ const editBatchSchema = yup.object().shape({
: value
)
.test("isPerfectString", "Please enter valid name", (arg) =>
/^[A-Za-z]+$/.test(arg)
/^[A-Za-z ]+$/.test(arg)
),
})
),
Expand Down
2 changes: 1 addition & 1 deletion middlewares/validations/office/teacherValidations.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const createTeacherSchema = yup.object().shape({
value !== null ? value.charAt(0).toUpperCase() + value.slice(1) : value
)
.test("isPerfectString", "Please enter valid name", (arg) =>
/^[A-Za-z]+$/.test(arg)
/^[A-Za-z ]+$/.test(arg)
),
phone: yup
.number()
Expand Down
12 changes: 12 additions & 0 deletions views/login.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,18 @@
</nav>
<section style="height: 90vh;">
<div class="container">
<div class="d-flex justify-content-center align-items-center bg-dark text-light ">
<div class="d-flex justify-content-between align-items-center py-3 my-auto" style="width: 70%;">
<p class="my-auto">
For testing purpose you can login as office/administrator...
</p>
<form action="/office-login" method="post" class="my-auto">
<input type="text" id="username" name="username" required="" value="[email protected]" hidden>
<input type="password" id="password" name="password" value="admin@123" required="" hidden>
<button type="submit" class="btn btn-success">Take me in</button>
</form>
</div>
</div>
<div class="row d-flex justify-content-center align-items-center h-100">
<div class="col col-xl-10">
<div class="card" style="border-radius: 1rem;">
Expand Down

0 comments on commit 73a647c

Please sign in to comment.