Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- segue-se o codigo
- form#form()
- fieldset
- legend Account Info
- .row
- .col-md-6
- .form-group
- label.control-label Username
- input#Username.form-control(type='text',value=locals.user.username,readonly name='Username')
- .form-group
- label.control-label Email Address
- input#email.form-control(type='email', value=locals.user.mail, name='email')
- .form-group
- label.control-label Old Password
- input#oldpassword.form-control(type='password', placeholder='old password', name='oldpassword')
- .form-group
- label.control-label New Password
- input#password.form-control(type='password', placeholder='password', name='password')
- .form-group
- label.control-label Confirm New Password
- input#password_again.form-control(type='password', placeholder='password', name='password_again')
- .col-md-6
- .row
- .form-group
- label Image Upload
- .fileinput.fileinput-new(data-provides='fileinput')
- .fileinput-new.thumbnail
- img(src='../images/default-user.png', alt='')
- .fileinput-preview.fileinput-exists.thumbnail
- .user-edit-image-buttons
- span.btn.btn-azure.btn-file
- span.fileinput-new
- i.fa.fa-picture
- | Select image
- span.fileinput-exists
- i.fa.fa-picture
- | Change
- input(type='file')
- a.btn.fileinput-exists.btn-red(href='#', data-dismiss='fileinput')
- i.fa.fa-times
- | Remove
- .row
- .col-md-12
- div
- | Required Fields
- hr
- .row
- .col-md-8
- p By clicking UPDATE, you are agreeing to the Policy and Terms & Conditions.
- .col-md-4
- input#target.btn.btn-primary.pull-right(type='submit', value='Submit', name='target')
- const AlteraUserpassword = async (connection, req, res) => {
- req.body.password = await hashpass(req.body.password)
- const user= await User.AlteraPasswordUser(connection, req.body)
- if(!user){
- console.log("Nao Deu");
- return res.render('Administration/perfil',{error: true})
- }else{
- console.log("Deu");
- return res.render('Administration/perfil',{error: false})
- }
- }
- const AlteraPasswordUser = (connection, data) => {
- return new Promise((resolve, reject) => {
- connection.query(`UPDATE user SET password = '${data.password}' WHERE username = '${data.Username}`, (err, result) => {
- if(err){
- resolve(false)
- }else{
- resolve(result)
- }
- })
- })
- }
- const express = require('express')
- const router = express.Router()
- const connection = require('../../Config/database')
- const controllerAdmin = require('../../controllers/Administration')
- const controlleruser = require('../../controllers/login')
- router.get('/Administration/perfil', (req, res) => controllerAdmin.findcidade2(connection, req, res));
- router.get('/Administration/Perfil/edit', (req, res) => controlleruser.AlteraUserpassword(connection, req, res));
- //router.get('/Administration/Perfil/edit', controlleruser.FormEdit)
- //router.get('/Administration/perfil/', (req, res) => res.render('Administration/perfil',{username:res.locals.user.username,email:res.locals.user.mail}))
- module.exports = app => app.use('/', router)
- #panel_edit_account.tab-pane.fade
- include Perfil/edit.jade
Add Comment
Please, Sign In to add comment