1

I am a beginner with XPages, and I have looked at the TLCC Intro free training. I have also seen tutorials here. I have no experience with Lotus Notes, XPages or flat-structured databases. But, I do have some experience in JavaScript and good experience (IMO) in Java and Android.

I am facing the following problems.

1) I am trying to implement a very basic login mechanism.

Currently, I add users manually, based on a form. Now, I want to create a login page. I take a user and a password, and click on a button.

In the button, I want to read all documents associated with a view (that displays all usernames/passwords), compare with entered value, and if it exists check if the password fields match too.

Can someone please guide me in the correct direction? I can't figure out which functions to use. Also, should I be using Scope Variables? Is there a good document/tutorial regarding that?

I have tried the "view.getAllEntries()" method but it always returns null.
Am I approaching this correctly? Are there in-depth tutorials that can help me with this?

2) What is the method to debug SSJS? I am currently putting everything in a try/catch and printing the error there.

I apologize if this question has been asked elsewhere, I haven't really found anything regarding this. Please point me if there is this is a duplicate.

igt256
  • 13
  • 3
  • Honestly, no offense: do not implement "a very basic login mechanism". Reinventing the wheel is the tiniest problem with it, you are throwing away all the security Domino provides. – Frantisek Kossuth Dec 11 '14 at 09:16

1 Answers1

0

1.

Use view.getDocumentByKey(theUserName) to find a user document in your view. It returns the user document as NotesDocument or null if user is not in view. The view has to have a first sorted column with the usernamens.

2.

As of Notes Domino version 9 you can debug SSJS.

Knut Herrmann
  • 30,880
  • 4
  • 31
  • 67
  • Thank you for your reply! :) "first sorted column" means I shouldn't have the count column then? – igt256 Dec 11 '14 at 10:45
  • It means that in your view the first column should have the user name and this column has to be sorted. You can have other columns before this column but they have to be unsorted. – Knut Herrmann Dec 11 '14 at 10:50
  • Um, what has sorting to do this? Does the function search the first sorted column? BTW, I tried this and it is working. XPages are confusing! If I may ask, what would you suggest? This authentication inline or in a js file? – igt256 Dec 11 '14 at 11:00
  • Also, about the debugger, it says cannot connect and gives me the same error about adding the rows. I think my company's firewall may be interfering. What do I do? Did I edit the correct notes.ini file (in C:\Program Files (x86)\IBM\Notes)? – igt256 Dec 11 '14 at 11:03
  • Yes, it looks for value in first sorted column http://www-01.ibm.com/support/knowledgecenter/SSVRGU_9.0.1/com.ibm.designer.domino.api.doc/r_domino_View_getDocumentByKey.html – Knut Herrmann Dec 11 '14 at 11:06
  • Debugger: you have to edit notes.ini **on server**. This shouldn't be a production server for performance reasons. It is good practice to run an own test server where you have full admin access. – Knut Herrmann Dec 11 '14 at 11:08
  • Inline or js file: I would stay it inline if you use it only once and it is to too long. As SSJS is executed on server code location is not relevant to performance. – Knut Herrmann Dec 11 '14 at 11:12