From 12451e1bbe275dc4c0cbc74e869aed5eda62204b Mon Sep 17 00:00:00 2001
From: rswindell <>
Date: Thu, 9 Jan 2003 01:34:24 +0000
Subject: [PATCH] Created bbs good_passwordl() method, used to check if a
 requested user password meets the minimum password requirements (length,
 uniqueness, etc).

---
 src/sbbs3/js_bbs.cpp | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/src/sbbs3/js_bbs.cpp b/src/sbbs3/js_bbs.cpp
index 83fee562d6..38a2865453 100644
--- a/src/sbbs3/js_bbs.cpp
+++ b/src/sbbs3/js_bbs.cpp
@@ -1015,6 +1015,21 @@ js_chksyspass(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval
 	return(JS_TRUE);
 }
 
+static JSBool
+js_chkpass(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+{
+	sbbs_t*		sbbs;
+
+	if((sbbs=(sbbs_t*)JS_GetContextPrivate(cx))==NULL)
+		return(JS_FALSE);
+
+	JSString* str=JS_ValueToString(cx,argv[0]);
+
+	*rval = BOOLEAN_TO_JSVAL(sbbs->chkpass(JS_GetStringBytes(str),&sbbs->useron,true));
+	return(JS_TRUE);
+}
+
+
 static JSBool
 js_text(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
 {
@@ -2651,7 +2666,10 @@ static jsMethodSpec js_bbs_functions[] = {
 	/* security */
 	{"check_syspass",	js_chksyspass,		0,	JSTYPE_BOOLEAN,	""
 	,JSDOCSTR("prompt for and verify system password")
-	},		
+	},
+	{"good_password",	js_chkpass,			1,	JSTYPE_STRING,	JSDOCSTR("string password")
+	,JSDOCSTR("check if requested user password meets minimum password requirements (length, uniqueness, etc.)")
+	},
 	/* chat/node stuff */
 	{"page_sysop",		js_pagesysop,		0,	JSTYPE_BOOLEAN,	""
 	,JSDOCSTR("page the sysop for chat")
-- 
GitLab