Improved error handling.
This commit is contained in:
parent
4d7f329885
commit
f9a00a3daa
@ -334,7 +334,8 @@ sub require_activate {
|
|||||||
my $methodimpl = $self -> get_user_authmethod_module($username)
|
my $methodimpl = $self -> get_user_authmethod_module($username)
|
||||||
or return undef;
|
or return undef;
|
||||||
|
|
||||||
return $methodimpl -> require_activate();
|
return $methodimpl -> require_activate()
|
||||||
|
or return $self -> self_error($methodimpl -> errstr();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -372,7 +373,8 @@ sub activated {
|
|||||||
my $user = $self -> get_user($username)
|
my $user = $self -> get_user($username)
|
||||||
or return undef;
|
or return undef;
|
||||||
|
|
||||||
return $methodimpl -> activated($user -> {"user_id"});
|
return $methodimpl -> activated($user -> {"user_id"})
|
||||||
|
or return $self -> self_error($methodimpl -> errstr();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -396,7 +398,9 @@ sub activate_user {
|
|||||||
or return undef;
|
or return undef;
|
||||||
|
|
||||||
# Activate the user, and return their data if successful.
|
# Activate the user, and return their data if successful.
|
||||||
return $methodimpl -> activate_user($user -> {"user_id"});
|
return $user if($methodimpl -> activate_user($user -> {"user_id"}));
|
||||||
|
|
||||||
|
return $self -> self_error($methodimpl -> errstr();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -413,7 +417,8 @@ sub supports_recovery {
|
|||||||
my $methodimpl = $self -> get_user_authmethod_module($username)
|
my $methodimpl = $self -> get_user_authmethod_module($username)
|
||||||
or return undef;
|
or return undef;
|
||||||
|
|
||||||
return $methodimpl -> supports_recovery();
|
return $methodimpl -> supports_recovery()
|
||||||
|
or return $self -> self_error($methodimpl -> errstr();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -430,7 +435,8 @@ sub norecover_message {
|
|||||||
my $methodimpl = $self -> get_user_authmethod_module($username)
|
my $methodimpl = $self -> get_user_authmethod_module($username)
|
||||||
or return undef;
|
or return undef;
|
||||||
|
|
||||||
return $methodimpl -> norecover_message();
|
return $methodimpl -> norecover_message()
|
||||||
|
or return $self -> self_error($methodimpl -> errstr();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -449,7 +455,8 @@ sub reset_password_actcode {
|
|||||||
my $user = $self -> get_user($username)
|
my $user = $self -> get_user($username)
|
||||||
or return undef;
|
or return undef;
|
||||||
|
|
||||||
return $methodimpl -> reset_password_actcode($user -> {"user_id"});
|
return $methodimpl -> reset_password_actcode($user -> {"user_id"})
|
||||||
|
or return $self -> self_error($methodimpl -> errstr();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -468,7 +475,8 @@ sub reset_password {
|
|||||||
my $user = $self -> get_user($username)
|
my $user = $self -> get_user($username)
|
||||||
or return undef;
|
or return undef;
|
||||||
|
|
||||||
return $methodimpl -> reset_password($user -> {"user_id"});
|
return $methodimpl -> reset_password($user -> {"user_id"})
|
||||||
|
or return $self -> self_error($methodimpl -> errstr();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -489,7 +497,8 @@ sub set_password {
|
|||||||
my $user = $self -> get_user($username)
|
my $user = $self -> get_user($username)
|
||||||
or return undef;
|
or return undef;
|
||||||
|
|
||||||
return $methodimpl -> set_password($user -> {"user_id"}, $password);
|
return $methodimpl -> set_password($user -> {"user_id"}, $password)
|
||||||
|
or return $self -> self_error($methodimpl -> errstr();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -508,7 +517,8 @@ sub generate_actcode {
|
|||||||
my $user = $self -> get_user($username)
|
my $user = $self -> get_user($username)
|
||||||
or return undef;
|
or return undef;
|
||||||
|
|
||||||
return $methodimpl -> generate_actcode($user -> {"user_id"});
|
return $methodimpl -> generate_actcode($user -> {"user_id"})
|
||||||
|
or return $self -> self_error($methodimpl -> errstr();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -129,7 +129,7 @@ sub activated {
|
|||||||
# activation code, and sets the activation timestamp.
|
# activation code, and sets the activation timestamp.
|
||||||
#
|
#
|
||||||
# @param userid The ID of the user account to activate.
|
# @param userid The ID of the user account to activate.
|
||||||
# @return true on success, undef on error.
|
# @return True on success, undef on error.
|
||||||
sub activate_user {
|
sub activate_user {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
my $userid = shift;
|
my $userid = shift;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user