1
0
mirror of https://github.com/moepman/bk-dss synced 2024-12-22 06:54:26 +01:00

Add password support

This commit is contained in:
Markus 2016-11-10 08:11:25 +01:00
parent 9669790224
commit 8667f788f1
2 changed files with 7 additions and 0 deletions

View File

@ -6,6 +6,7 @@ TBA
## Requirements
* passlib >= 1.6.0
* py-flask >= 0.10
* py-flask-wtf >= 0.10
* py-ldap >= 2.4.15

View File

@ -4,6 +4,8 @@ from flask import Flask, render_template, redirect, url_for, session
from flask_wtf import Form
import ldap
import ldap.modlist
import os
from passlib.hash import ldap_salted_sha1
from redis import Redis
import uuid
from wtforms.fields import IntegerField, PasswordField, SelectField, StringField, SubmitField
@ -43,6 +45,9 @@ class LoginForm(Form):
submit = SubmitField('Login')
def makeSecret(password):
return ldap_salted_sha1.encrypt(password)
def isAdmin():
return isLoggedin() and rdb.hget(session['uuid'], 'user') in app.config.get('ADMINS', [])
@ -85,6 +90,7 @@ def create():
'uid' : form.uid.data,
'gn' : form.gn.data,
'sn' : form.sn.data,
'pass' : makeSecret(form.pwd1.data)
}
# add user