|
@@ -336,6 +336,10 @@ func (ldap *ldapHandler) SynchronizeUserFromLDAP() error {
|
|
|
//LOGIN related function
|
|
|
//functions basically same as arozos's original function
|
|
|
func (ldap *ldapHandler) HandleLoginPage(w http.ResponseWriter, r *http.Request) {
|
|
|
+ checkLDAPenabled := ldap.readSingleConfig("enabled")
|
|
|
+ if checkLDAPenabled == "true" {
|
|
|
+ common.SendTextResponse(w, "LDAP not enabled.")
|
|
|
+ }
|
|
|
//load the template from file and inject necessary variables
|
|
|
red, _ := common.Mv(r, "redirect", false)
|
|
|
|
|
@@ -359,6 +363,10 @@ func (ldap *ldapHandler) HandleLoginPage(w http.ResponseWriter, r *http.Request)
|
|
|
}
|
|
|
|
|
|
func (ldap *ldapHandler) HandleNewPasswordPage(w http.ResponseWriter, r *http.Request) {
|
|
|
+ checkLDAPenabled := ldap.readSingleConfig("enabled")
|
|
|
+ if checkLDAPenabled == "true" {
|
|
|
+ common.SendTextResponse(w, "LDAP not enabled.")
|
|
|
+ }
|
|
|
//get the parameter from the request
|
|
|
acc, err := common.Mv(r, "username", false)
|
|
|
if err != nil {
|
|
@@ -395,6 +403,10 @@ func (ldap *ldapHandler) HandleNewPasswordPage(w http.ResponseWriter, r *http.Re
|
|
|
}
|
|
|
|
|
|
func (ldap *ldapHandler) HandleLogin(w http.ResponseWriter, r *http.Request) {
|
|
|
+ checkLDAPenabled := ldap.readSingleConfig("enabled")
|
|
|
+ if checkLDAPenabled == "true" {
|
|
|
+ common.SendTextResponse(w, "LDAP not enabled.")
|
|
|
+ }
|
|
|
//Get username from request using POST mode
|
|
|
username, err := common.Mv(r, "username", true)
|
|
|
if err != nil {
|
|
@@ -455,6 +467,10 @@ func (ldap *ldapHandler) HandleLogin(w http.ResponseWriter, r *http.Request) {
|
|
|
}
|
|
|
|
|
|
func (ldap *ldapHandler) HandleSetPassword(w http.ResponseWriter, r *http.Request) {
|
|
|
+ checkLDAPenabled := ldap.readSingleConfig("enabled")
|
|
|
+ if checkLDAPenabled == "true" {
|
|
|
+ common.SendTextResponse(w, "LDAP not enabled.")
|
|
|
+ }
|
|
|
//get paramters from request
|
|
|
username, err := common.Mv(r, "username", true)
|
|
|
if err != nil {
|