mirror of
https://github.com/journeyman-cc/smeagol.git
synced 2026-04-12 18:05:06 +00:00
Fixed bug where password could be blanked if a user was edited and no new password set
This commit is contained in:
parent
656d503128
commit
75c5618239
3 changed files with 12 additions and 4 deletions
|
|
@ -1 +1 @@
|
|||
{:admin {:admin true, :email "info@weft.scot", :password "admin"}}
|
||||
{:admin {:admin true, :email "info@weft.scot", :password "admin"}, :jenny {:email "jenny@auchencairn.org", :admin false, :password "$s0$f0801$1uniQfftB37G5e5GklJANQ==$kQ0+/YcCuaz2x5iYjwhNlDlnWX/exE/8pSC+R4C0WvQ="}}
|
||||
|
|
@ -133,7 +133,9 @@
|
|||
|
||||
|
||||
(defn add-user
|
||||
"Add a user to the passwd file with this `username`, initial password and `email` address and `admin` flag."
|
||||
"Add a user to the passwd file with this `username`, initial password `newpass`,
|
||||
`email` address and `admin` flag; *or*, modify an existing user. Return true
|
||||
if user is successfully stored, false otherwise."
|
||||
[username newpass email admin]
|
||||
(timbre/info "Trying to add user " username)
|
||||
(cond
|
||||
|
|
|
|||
|
|
@ -69,10 +69,16 @@
|
|||
check-pass (auth/evaluate-password pass1 pass2)
|
||||
password (if (and pass1 (true? check-pass)) pass1)
|
||||
stored (if
|
||||
(and
|
||||
(:email params)
|
||||
(or
|
||||
(nil? pass1)
|
||||
(zero? (count pass1))
|
||||
(true? check-pass)))
|
||||
(auth/add-user target password (:email params) (:admin params)))
|
||||
message (if stored (str (:save-user-success (util/get-messages request)) " " target "."))
|
||||
error (if (and (:email params) (not stored))
|
||||
error (if
|
||||
(and (:email params) (not stored))
|
||||
(str
|
||||
(:save-user-fail (util/get-messages request))
|
||||
" " target ". "
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue