recovery get search validate
parent
baa86bf667
commit
194abdd1f9
|
@ -496,8 +496,8 @@ module AuthD
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def ask_password_recovery(uid_or_login : String | Int32)
|
def ask_password_recovery(uid_or_login : String | Int32, email : String)
|
||||||
send Request::AskPasswordRecovery.new uid_or_login
|
send Request::AskPasswordRecovery.new uid_or_login, email
|
||||||
response = Response.from_ipc read
|
response = Response.from_ipc read
|
||||||
|
|
||||||
case response
|
case response
|
||||||
|
|
|
@ -69,6 +69,10 @@ class Actions
|
||||||
@the_call["user-mod"] = ->user_mod
|
@the_call["user-mod"] = ->user_mod
|
||||||
@the_call["user-registration"] = ->user_registration # Do not require admin priviledges.
|
@the_call["user-registration"] = ->user_registration # Do not require admin priviledges.
|
||||||
@the_call["user-delete"] = ->user_deletion # Do not require admin priviledges.
|
@the_call["user-delete"] = ->user_deletion # Do not require admin priviledges.
|
||||||
|
@the_call["user-get"] = ->user_get # Do not require authentication.
|
||||||
|
@the_call["user-validation"] = ->user_validation # Do not require authentication.
|
||||||
|
@the_call["user-recovery"] = ->user_recovery # Do not require authentication.
|
||||||
|
@the_call["user-search"] = ->user_search # Do not require authentication.
|
||||||
|
|
||||||
@the_call["permission-set"] = ->permission_set
|
@the_call["permission-set"] = ->permission_set
|
||||||
@the_call["permission-check"] = ->permission_check
|
@the_call["permission-check"] = ->permission_check
|
||||||
|
@ -148,18 +152,25 @@ class Actions
|
||||||
puts res
|
puts res
|
||||||
end
|
end
|
||||||
|
|
||||||
# TODO
|
def user_validation
|
||||||
def validate
|
args = Context.args.not_nil!
|
||||||
# pp! r = authd.validate_user login.not_nil!, activation_key.not_nil!
|
login, activation_key = args[0..1]
|
||||||
|
pp! authd.validate_user login, activation_key
|
||||||
end
|
end
|
||||||
def search
|
def user_search
|
||||||
# pp! r = authd.search_user login.not_nil!
|
args = Context.args.not_nil!
|
||||||
|
login = args[0]
|
||||||
|
pp! authd.search_user login
|
||||||
end
|
end
|
||||||
def get
|
def user_get
|
||||||
# pp! authd.get_user? login
|
args = Context.args.not_nil!
|
||||||
|
login = args[0]
|
||||||
|
pp! authd.get_user? login
|
||||||
end
|
end
|
||||||
def ask_password_recovery
|
def user_recovery
|
||||||
# pp! authd.ask_password_recovery login
|
args = Context.args.not_nil!
|
||||||
|
login, email = args[0..1]
|
||||||
|
pp! authd.ask_password_recovery login, email
|
||||||
end
|
end
|
||||||
|
|
||||||
def permission_check
|
def permission_check
|
||||||
|
|
|
@ -82,7 +82,7 @@ parser = OptionParser.new do |parser|
|
||||||
end
|
end
|
||||||
|
|
||||||
parser.on "user", "Operations on users." do
|
parser.on "user", "Operations on users." do
|
||||||
parser.banner = "Usage: user [add | mod | delete]"
|
parser.banner = "Usage: user [add | mod | delete | validate | search | get | recover | register ]"
|
||||||
|
|
||||||
parser.on "add", "Adding a user to the DB." do
|
parser.on "add", "Adding a user to the DB." do
|
||||||
parser.banner = "usage: user add login email phone [-P profile] [opt]"
|
parser.banner = "usage: user add login email phone [-P profile] [opt]"
|
||||||
|
@ -122,6 +122,47 @@ parser = OptionParser.new do |parser|
|
||||||
unrecognized_args_to_context_args.call parser, 1
|
unrecognized_args_to_context_args.call parser, 1
|
||||||
end
|
end
|
||||||
|
|
||||||
|
parser.on "validate", "Validate user." do
|
||||||
|
parser.banner = "Usage: user validate login activation-key [opt]"
|
||||||
|
Baguette::Log.info "Validate user."
|
||||||
|
Context.command = "user-validate"
|
||||||
|
# No need to be authenticated.
|
||||||
|
opt_help.call parser
|
||||||
|
# login activation-key
|
||||||
|
unrecognized_args_to_context_args.call parser, 2
|
||||||
|
end
|
||||||
|
|
||||||
|
parser.on "get", "Get user info." do
|
||||||
|
parser.banner = "Usage: user get login [opt]"
|
||||||
|
Baguette::Log.info "Get user info."
|
||||||
|
Context.command = "user-get"
|
||||||
|
# No need to be authenticated.
|
||||||
|
opt_help.call parser
|
||||||
|
# login
|
||||||
|
unrecognized_args_to_context_args.call parser, 1
|
||||||
|
end
|
||||||
|
|
||||||
|
parser.on "search", "Search user." do
|
||||||
|
parser.banner = "Usage: user recover login [opt]"
|
||||||
|
Baguette::Log.info "Search user."
|
||||||
|
Context.command = "user-search"
|
||||||
|
# No need to be authenticated.
|
||||||
|
opt_help.call parser
|
||||||
|
# login
|
||||||
|
unrecognized_args_to_context_args.call parser, 1
|
||||||
|
end
|
||||||
|
|
||||||
|
parser.on "recover", "Recover user password." do
|
||||||
|
parser.banner = "Usage: user recover login email [opt]"
|
||||||
|
Baguette::Log.info "Recover user password."
|
||||||
|
Context.command = "user-recovery"
|
||||||
|
# No need to be authenticated.
|
||||||
|
opt_help.call parser
|
||||||
|
# login email
|
||||||
|
unrecognized_args_to_context_args.call parser, 2
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
# Do not require to be admin.
|
# Do not require to be admin.
|
||||||
parser.on "register", "Register a user (requires activation)." do
|
parser.on "register", "Register a user (requires activation)." do
|
||||||
parser.banner = "Usage: user register login email phone [-P profile] [opt]"
|
parser.banner = "Usage: user register login email phone [-P profile] [opt]"
|
||||||
|
|
Loading…
Reference in New Issue