tmp
parent
ca4cb9e231
commit
bbf7a9a80e
2
makefile
2
makefile
|
@ -52,7 +52,7 @@ get-user:
|
|||
migrate-user:
|
||||
./bin/authc user migrate $(NAME) $(PASSWORD_HASH) $(LOGIN_OPT)
|
||||
|
||||
USER_DB ?= user-db.txt
|
||||
USER_DB ?= /tmp/authd-migration-user-db.txt
|
||||
migrate-all-users:
|
||||
./bin/authc migration-script $(USER_DB) $(LOGIN_OPT)
|
||||
|
||||
|
|
|
@ -112,8 +112,23 @@ class Actions
|
|||
|
||||
File.each_line(filename) do |line|
|
||||
login, password_hash_brkn = line.split("\t")
|
||||
Baguette::Log.info "adding user '#{login}', hash '#{password_hash_brkn}'"
|
||||
pp! authd.migrate_user login, password_hash_brkn
|
||||
STDOUT.write ((" " * 150) + "\r").to_slice
|
||||
STDOUT.write "adding user '#{login}'\r".to_slice
|
||||
response = authd.migrate_user login, password_hash_brkn
|
||||
|
||||
case response
|
||||
when AuthD::Response::UserAdded
|
||||
pp! response.user
|
||||
when AuthD::Response::ErrorMustBeAuthenticated
|
||||
Baguette::Log.error "ErrorMustBeAuthenticated"
|
||||
exit 1
|
||||
when AuthD::Response::ErrorAlreadyUsedLogin
|
||||
#Baguette::Log.error "ErrorAlreadyUsedLogin"
|
||||
when AuthD::Response::ErrorMailRequired
|
||||
Baguette::Log.error "ErrorMailRequired"
|
||||
else
|
||||
Baguette::Log.error "unknown error"
|
||||
end
|
||||
end
|
||||
|
||||
rescue e : AuthD::Exception
|
||||
|
|
Loading…
Reference in New Issue