Commit 5f4df375 authored by David Venhoek's avatar David Venhoek
Browse files

Further refined feedback functions for pinchange request.

parent a4dc196d
......@@ -82,7 +82,8 @@ type KeyshareHandler interface {
type ChangePinHandler interface {
ChangePinFailure(manager irma.SchemeManagerIdentifier, err error)
ChangePinSuccess(manager irma.SchemeManagerIdentifier)
ChangePinIncorrect(manager irma.SchemeManagerIdentifier)
ChangePinIncorrect(manager irma.SchemeManagerIdentifier, message string)
ChangePinBlocked(manager irma.SchemeManagerIdentifier, message string)
}
// ClientHandler informs the user that the configuration or the list of attributes
......@@ -779,10 +780,15 @@ func (client *Client) keyshareChangePinWorker(managerID irma.SchemeManagerIdenti
return err
}
if res.Status != kssPinSuccess {
client.handler.ChangePinIncorrect(managerID)
} else {
switch res.Status {
case kssPinSuccess:
client.handler.ChangePinSuccess(managerID)
case kssPinFailure:
client.handler.ChangePinIncorrect(managerID, res.Message)
case kssPinError:
client.handler.ChangePinBlocked(managerID, res.Message)
default:
return errors.New("Unknown keyshare response")
}
return nil
......
......@@ -55,7 +55,7 @@ func (i *TestClientHandler) ChangePinFailure(manager irma.SchemeManagerIdentifie
i.t.Fatal(err)
}
}
func (i *TestClientHandler) ChangePinIncorrect(manager irma.SchemeManagerIdentifier) {
func (i *TestClientHandler) ChangePinIncorrect(manager irma.SchemeManagerIdentifier, message string) {
err := errors.New("incorrect pin")
select {
case i.c <- err: //nop
......@@ -63,6 +63,14 @@ func (i *TestClientHandler) ChangePinIncorrect(manager irma.SchemeManagerIdentif
i.t.Fatal(err)
}
}
func (i *TestClientHandler) ChangePinBlocked(manager irma.SchemeManagerIdentifier, message string) {
err := errors.New("blocked account")
select {
case i.c <- err: //nop
default:
i.t.Fatal(err)
}
}
func parseStorage(t *testing.T) *Client {
require.NoError(t, fs.CopyDirectory("../testdata/teststorage", "../testdata/storage/test"))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment