(ctx context.Context, req *api.QueryAccountByPasswordRequest, res *api.QueryAccountByPasswordResponse)
| 852 | } |
| 853 | |
| 854 | func (a *UserInternalAPI) QueryAccountByPassword(ctx context.Context, req *api.QueryAccountByPasswordRequest, res *api.QueryAccountByPasswordResponse) error { |
| 855 | acc, err := a.DB.GetAccountByPassword(ctx, req.Localpart, req.PlaintextPassword) |
| 856 | switch err { |
| 857 | case sql.ErrNoRows: // user does not exist |
| 858 | return nil |
| 859 | case bcrypt.ErrMismatchedHashAndPassword: // user exists, but password doesn't match |
| 860 | return nil |
| 861 | default: |
| 862 | res.Exists = true |
| 863 | res.Account = acc |
| 864 | return nil |
| 865 | } |
| 866 | } |
| 867 | |
| 868 | func (a *UserInternalAPI) SetDisplayName(ctx context.Context, req *api.PerformUpdateDisplayNameRequest, _ *struct{}) error { |
| 869 | return a.DB.SetDisplayName(ctx, req.Localpart, req.DisplayName) |
nothing calls this directly
no test coverage detected