def changepassword(oldpass,newpass): oldpass = crypt.decrypt(oldpass) user = str(db_connect.getUser(email)) res = "" if user.password==oldpass : db_connect.deleteUser(email) user['password'] = crypt.encrypt(newpass) db_connect.add_user(User.fromdict(user)) res = "Password Changed..!!" else: res = "Wrong Password" return res
def signup(): jsonData = request.get_json() print(jsonData) password = jsonData['password'] password = crypt.encrypt(password) us = User(jsonData['name'],jsonData['email'],jsonData['mobile'],password) status = db_connect.add_user(us) return str(status)
def admin_reg(): data = request.form password = crypt.encrypt(data['password']) u = User(data['name'],data['email'],data['mobile'],password,type="admin") if(db_connect.add_user(u)==1): return redirect(url_for("admin")) else: abort(406)
def validate(email): user = db_connect.getUser(email,"") db_connect.deleteUser(email) db_connect.add_user(User.fromdict(user)) return redirect(url_for("users"))
def invalidateUser(self): self.isvalid = False db.add_user(self)