Example #1
0
        public static LoginResult attemptLogin(string username, string password)
        {
            var req = new UserLoginRequest(username, password);
            TokenIDMessageResult res = APIRequest.login(req).GetAwaiter().GetResult();

            if (res.Error != null)
            {
                return(new LoginResult(null, res.Token, res.Error));
            }
            else
            {
                Result <UserModel> user = APIRequest.getUserById(res.Id).GetAwaiter().GetResult();
                return(new LoginResult(user.Items.FirstOrDefault(), res.Token, res.Error));
            }
        }
Example #2
0
        private void handleSubmitCommand()
        {
            if (hasErrors())
            {
                return;
            }
            TokenIDMessageResult res = Utility.attemptChangePassword(credentials.CurrentUser.Name, Password.Value, NewPassword.Value);

            if (res.Error != null)
            {
                Error.Value = res.Error.Message;
            }
            else
            {
                Message.Value = res.Message;
            }
        }