MemberMgr.sendPwd (email)
function retrieves a list of usernames/passwords for a submitted email-address and sends them as mail

  • Parameter String:
    email-address to search for accounts
  • Returns
    Obj Object containing two properties: - error (boolean): true if error happened, false if everything went fine - message (String): containing a message to user
Sourcecode in MemberMgr/objectFunctions.js:
1:   function sendPwd(email) {
2:      if (!email)
3:         throw new Exception("emailMissing");
4:      var sqlClause = "select USER_NAME,USER_PASSWORD from AV_USER where USER_EMAIL = '" + email + "'";
5:      var dbConn = getDBConnection("antville");
6:      var dbResult = dbConn.executeRetrieval(sqlClause);
7:      var cnt = 0;
8:      var pwdList = "";
9:      while (dbResult.next()) {
10:        pwdList += getMessage("MemberMgr.userName") + ": " + dbResult.getColumnItem("USER_NAME") + "\n";
11:        pwdList += getMessage("MemberMgr.password") + ": " + dbResult.getColumnItem("USER_PASSWORD") + "\n\n";
12:        cnt++;
13:     }
14:     dbResult.release;
15:     if (!cnt)
16:        throw new Exception("emailNoAccounts");
17:     // now we send the mail containing all accounts for this email-address
18:     var mailbody = this.renderSkinAsString("mailpassword", {text: pwdList});
19:     sendMail(root.sys_email, email, getMessage("mail.sendPwd"), mailbody);
20:     return new Message("mailSendPassword");
21:  }