A re-frame coeffect for creating random passwords.
Step 1.
Add the following project dependency:
Step 2.
In the namespace add the "require":
(ns app.core
(:require
...
[re-frame.core :as re-frame]
[rf-fx-password.core] ;; add this
...))
Step 3.
The password is passed in the coeffects map under :random-password
key.
The coeffect can be used either without any arguments:
(re-frame/reg-event-fx
::event
[(re-frame/inject-cofx :random-password)] ;; add the coeffect
(fn [{:keys [db random-password]} _] ;; by default the password is 10
(println "password:" random-password) ;; characters long
...))
;; password: SFfV&RnuWy
Or it can take a password length:
(re-frame/reg-event-fx
::event
[(re-frame/inject-cofx :random-password 16)] ;; add the coeffect
(fn [{:keys [db random-password]} _] ;; password will have 16
(println "password:" random-password) ;; characters
...))
;; password: y$zAq?"^k0g;Bn(V
rf-fx-password is 2-Clause BSD License.
Can you improve this documentation?Edit on GitHub
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close