One-time passwords. One-time-password generation and verification
# new uba_otp_ns ()
Members
# attrs : ubaOtpAttrs static
Attributes defined in metadata. Property does not exist in real life and added for IDE
# entity : UBEntity instance
Reference to entity metadata
Methods
# addNew (ctx: ubMethodParams) instance
Create record with filled default values and return it to caller.
Newly created record is not inserted to database. For inserting record to the database insert
method should be called
Arguments:
ctx
: ubMethodParamsmParams
: objectOptional values for attributes of new record
# delete (ctx: ubMethodParams) instance
Delete record by ID
Arguments:
ctx
: ubMethodParamsmParams
: objectDelete method parameters
# insert (ctx: ubMethodParams) instance
New record insertion
Arguments:
ctx
: ubMethodParamsmParams
: objectInsert method parameters
# select (ctx: ubMethodParams) instance
ORM query for read records
Arguments:
ctx
: ubMethodParamsmParams
: UBQLORM query in UBQL format
# update (ctx: ubMethodParams) instance
Update existed record
Arguments:
ctx
: ubMethodParams
# auth (otp: string, otpKind: string, fCheckUDataopt: function, checkDataopt: object, callopt: function) → boolean instance deprecated
use authAndExecute instead
Switch session to user from OTP (SMS or EMail) or execute callback in session of user from OTP. For TOTP use verifyTotp function.
# authAndExecute (otp: string, otpKind: string, callBack: function) → boolean instance
Check given otp, and in case it is correct run callback
Return:
Is otp correct
Arguments:
// generation otp
var userID = 100000000122,
uData = {size: {width: 100, height: 50}};
var otp = uba_otp.generateOtp('EMail', userID, uData);
// send this otp via EMail
//............................
// after receiving this otp
var isOtpCorrect = uba_otp.authAndExecute('EMail', otp, function(uData){
var params = JSON.parse(uData);
console.log('user ID is', Session.userID);//'user ID is 100000000122';
console.log('width is', params.width);//'width is 100';
}))
# verifyTotp (totpValue: string, userIDopt: number) → boolean instance
Verify TOTP for currently logged-in user