How to use security method in Cypress

Best JavaScript code snippet using cypress

twofactor.js

Source:twofactor.js Github

copy

Full Screen

1'use strict';2/**3 * Module Dependencies4 */5var User = require('../models/User');6var utils = require('../config/utils');7var config = require('../config/config');8var bcrypt = require('bcrypt-nodejs');9var twilio = require('twilio')(config.twilio.sid, config.twilio.token);10var passport = require('passport');11var passportConf = require('../config/passport');12/**13 * Enhanced Security Controller14 */15module.exports.controller = function (app) {16 /**17 * ==============================================18 * COMMON ROUTES FOR BOTH TOTP AND SMS19 * ==============================================20 */21 /**22 * GET /enable-enhanced-security (requires authentication)23 *24 * Begin the enhanced security setup process.25 */26 app.get('/enable-enhanced-security', passportConf.isAuthenticated, function (req, res) {27 if (req.user.enhancedSecurity.enabled) {28 req.flash('info', { msg: 'You already enabled enhanced security.' });29 return res.redirect('back');30 }31 res.render('twofactor/enable-enhanced-security', {32 navTitle: 'Enable Enhanced Security',33 url: '/account', // to set navbar active state34 user: req.user35 });36 });37 /**38 * GET /complete-enhanced-security (requires authentication)39 *40 * Finalize enhanced security setup with the user.41 */42 app.get('/complete-enhanced-security', passportConf.isAuthenticated, function (req, res) {43 res.render('twofactor/complete-enhanced-security', {44 navTitle: 'Enhanced Security',45 url: '/account', // to set navbar active state46 user: req.user47 });48 });49 /**50 * GET /verify-setup51 *52 * Prepare for code validation. If the user53 * is using SMS send them their code. Otherwise54 * Continue to /verify-code.55 * Used for both TOTP and SMS authentication.56 */57 app.get('/verify-setup', function (req, res) {58 if ((req.user.enhancedSecurity.enabled) && (req.user.enhancedSecurity.type === 'sms')) {59 // NOTE: The JavaScript date is based on a time value that is milliseconds60 // since midnight 01 January, 1970 UTC. A day holds 86,400,000 milliseconds.61 // To convert the Mongo date we need to parse it so we can compare it to "now".62 // If we don't already have a token (so user can reload page, etc.)63 if ((Date.parse(req.user.enhancedSecurity.smsExpires) < Date.now()) || (!req.user.enhancedSecurity.sms)) {64 // Generate a six digit SMS token65 var sms = utils.randomSMS(6);66 // SMS Expiration Period (5 Minutes)67 var minute = 60000;68 var expiration = (minute * 5);69 // Hash the SMS token prior to saving it70 bcrypt.genSalt(10, function (err, salt) {71 bcrypt.hash(sms, salt, null, function (err, hash) {72 // Save the SMS token73 User.findById(req.user.id, function (err, user) {74 if (err) {75 req.flash('error', { msg: err.message });76 return res.redirect('back');77 }78 user.enhancedSecurity.sms = hash;79 user.enhancedSecurity.smsExpires = Date.now() + expiration;80 user.save(function (err) {81 if (err) {82 req.flash('error', { msg: err.message });83 return res.redirect('back');84 }85 });86 // Send the SMS token to the User87 var message = {88 to: user.profile.phone.mobile,89 from: config.twilio.phone,90 body: 'Your ' + app.locals.application + ' login code is: ' + sms + '.'91 };92 twilio.sendMessage(message, function (err, responseData) {93 if (err) {94 req.flash('error', { msg: err.message });95 return res.redirect('back');96 }97 req.flash('info', { msg: 'A login code was sent to your mobile phone.' });98 res.redirect('/verify-code');99 });100 });101 });102 });103 } else {104 res.redirect('/verify-code');105 }106 } else {107 req.flash('info', { msg: 'Use your mobile app to get your login code.' });108 res.redirect('/verify-code');109 }110 });111 /**112 * GET /verify-code113 *114 * Get OTP Code from user for validation.115 * Used for both TOTP and SMS authentication.116 */117 app.get('/verify-code', function (req, res) {118 res.render('twofactor/verify-code', {119 navTitle: 'Verify Code',120 url: '/account', // to set navbar active state121 user: req.user122 });123 });124 /**125 * POST /verify-otp126 *127 * Verify OTP Password128 */129 app.post('/verify-code', function (req, res, next) {130 // Handle SMS131 if ((req.user.enhancedSecurity.enabled) && (req.user.enhancedSecurity.type === 'sms')) {132 // Get the user using their ID and make sure their sms token hasn't expired yet133 User.findOne({ _id: req.user.id })134 .where('enhancedSecurity.smsExpires').gt(Date.now())135 .exec(function (err, user) {136 if (err) {137 req.flash('error', { msg: err.message });138 return res.redirect('back');139 }140 if (!user) {141 req.flash('error', { msg: 'Your code has expired.' });142 return res.redirect('/verify-setup');143 }144 // Validate their SMS token145 user.compareSMS(req.body.code, function (err, isMatch) {146 if (err) {147 req.flash('error', { msg: err.message });148 return res.redirect('back');149 }150 if (isMatch) {151 // Clean out SMS token152 User.findById(req.user.id, function (err, user) {153 if (err) {154 req.flash('error', { msg: err.message });155 return res.redirect('back');156 }157 user.enhancedSecurity.sms = null;158 user.enhancedSecurity.smsExpires = null;159 user.save(function (err) {160 if (err) {161 req.flash('error', { msg: err.message });162 return res.redirect('back');163 }164 });165 });166 // Save the fact that we have authenticated via two factor167 req.session.passport.secondFactor = 'validated';168 // Send user on their merry way169 if (req.session.attemptedURL) {170 var redirectURL = req.session.attemptedURL;171 delete req.session.attemptedURL;172 res.redirect(redirectURL);173 } else {174 res.redirect('/');175 }176 } else {177 req.flash('error', { msg: 'That code is invalid.' });178 return res.redirect('back');179 }180 });181 });182 }183 // Handle TOTP184 if ((req.user.enhancedSecurity.enabled) && (req.user.enhancedSecurity.type === 'totp')) {185 // Use Passport's TOTP authentication186 passport.authenticate('totp', function (err, user, info) {187 if (err) {188 req.flash('error', { msg: err.message });189 return res.redirect('back');190 } else {191 // Log user in192 req.logIn(user, function (err) {193 if (err) {194 req.flash('error', { msg: 'That code is invalid.' });195 return res.redirect('back');196 } else {197 // Save the fact that we have authenticated via two factor198 req.session.passport.secondFactor = 'validated';199 // Send user on their merry way200 if (req.session.attemptedURL) {201 var redirectURL = req.session.attemptedURL;202 delete req.session.attemptedURL;203 res.redirect(redirectURL);204 } else {205 res.redirect('/');206 }207 }208 });209 }210 })(req, res, next);211 }212 });213 /**214 * GET /disable-enhanced-security (requires authentication)215 * Turns *off* two factor enhanced security216 */217 app.get('/disable-enhanced-security', passportConf.isAuthenticated, function (req, res) {218 // Get user219 User.findById(req.user.id, function (err, user) {220 if (err) {221 req.flash('error', { msg: err.message });222 return (err);223 }224 // Remove enhanced security profile225 user.enhancedSecurity = null;226 user.activity.last_updated = Date.now();227 user.save(function (err) {228 if (err) {229 req.flash('error', { msg: err.message });230 return (err);231 }232 });233 });234 // Then redirect back to account235 req.flash('info', { msg: 'Enhanced security has been turned off.' });236 res.redirect('/account');237 // TODO:238 // In a real scenario we would also send the person an email notifying them239 // that enhanced security has been turned off. This is an extra measure of240 // security in case somehow they did not initiate the action (much like a241 // password change email). There are examples in the user.js and account.js242 // controllers.243 });244 /**245 * ==============================================246 * TOTP ROUTES247 * ==============================================248 */249 /**250 * GET /setup-totp (requires authentication)251 *252 * Create a TOTP key and share it with the user253 * via QR code and base32 encoded key so they254 * can setup their mobile app.255 */256 app.get('/setup-totp', passportConf.isAuthenticated, function (req, res) {257 // Prevent someone from seeing your QR code if enhanced security is *already* enabled.258 // Otherwise if they knew the URL and had access to your machine while259 // you were already logged in they could make it display.260 if (req.user.enhancedSecurity.enabled) {261 req.flash('info', { msg: 'You already enabled enhanced security.' });262 return res.redirect('back');263 }264 // Make this page idempotent in case user hits back or refresh265 var key;266 if (typeof req.user.enhancedSecurity.token === 'undefined') {267 // Generate a new key268 key = utils.randomKey(10);269 // Save the key for the user270 User.findById(req.user.id, function (err, user) {271 if (err) {272 req.flash('error', { msg: err.message });273 return (err);274 }275 user.enhancedSecurity.token = key;276 user.enhancedSecurity.period = 30;277 user.save(function (err) {278 if (err) {279 req.flash('error', { msg: err.message });280 return (err);281 }282 });283 });284 } else {285 // Just use existing key286 key = req.user.enhancedSecurity.token;287 }288 // encode key to base32289 var encodedKey = utils.encode(key);290 // Generate QR code291 // Reference: https://code.google.com/p/google-authenticator/wiki/KeyUriFormat292 var otpUrl = 'otpauth://totp/' + config.name + ':%20' + req.user.email + '?issuer=' + config.name + '&secret=' + encodedKey + '&period=30';293 var qrImage = 'https://chart.googleapis.com/chart?chs=166x166&chld=L|0&cht=qr&chl=' + encodeURIComponent(otpUrl);294 // Render the setup page295 res.render('twofactor/setup-totp', {296 navTitle: 'Setup Enhanced Security',297 user: req.user,298 url: '/account', // to set navbar active state299 key: encodedKey,300 qrImage: qrImage301 });302 });303 /**304 * GET /verify-totp-first (requires authentication)305 *306 * Test key validation. Ensure that TOTP works307 * for user BEFORE we turn on enhanced security!308 */309 app.get('/verify-totp-first', passportConf.isAuthenticated, function (req, res) {310 res.render('twofactor/verify-totp-first', {311 navTitle: 'Verify',312 url: '/account', // to set navbar active state313 user: req.user314 });315 });316 /**317 * POST /verify-otp-first (requires authentication)318 *319 * If the code is verified then turn on enhanced security320 * and redirect to the 'complete-enhanced-security' page.321 */322 app.post('/verify-totp-first', passportConf.isAuthenticated, function (req, res, next) {323 passport.authenticate('totp', function (err, user, info) {324 if (err) {325 req.flash('error', { msg: err.message });326 return res.redirect('back');327 } else {328 // Log user in329 req.logIn(user, function (err) {330 if (err) {331 req.flash('error', { msg: 'That code is invalid.' });332 return res.redirect('back');333 } else {334 // Finalize enabling enhanced security by setting enhancedSecurity.enabled = true335 User.findById(req.user.id, function (err, user) {336 if (err) {337 req.flash('error', { msg: err.message });338 return (err);339 }340 user.enhancedSecurity.enabled = true;341 user.enhancedSecurity.type = 'totp';342 user.activity.last_updated = Date.now();343 user.save(function (err) {344 if (err) {345 req.flash('error', { msg: err.message });346 return (err);347 }348 });349 });350 // Save the fact that we have authenticated via two factor351 req.session.passport.secondFactor = 'validated';352 // Complete enhanced security setup353 res.redirect('/complete-enhanced-security');354 }355 });356 }357 })(req, res, next);358 });359 /**360 * ==============================================361 * SMS ROUTES362 * ==============================================363 */364 /**365 * GET /setup-sms (requires authentication)366 *367 * Initiate SMS setup - need to capture or368 * validate the users mobile phone number.369 */370 app.get('/setup-sms', passportConf.isAuthenticated, function (req, res) {371 res.render('twofactor/setup-sms', {372 navTitle: 'Setup SMS',373 user: req.user,374 url: '/account' // to set navbar active state375 });376 });377 /**378 * POST /setup-sms (requires authentication)379 *380 * Save the user's mobile phone number and send them a381 * SMS message with a one-time code to test.382 */383 app.post('/setup-sms', passportConf.isAuthenticated, function (req, res) {384 // Generate a six digit key385 var sms = utils.randomSMS(6);386 // SET SMS Expiration Period (5 Minutes)387 var minute = 60000;388 var expiration = (minute * 5);389 // Hash the SMS token prior to saving it390 bcrypt.genSalt(10, function (err, salt) {391 bcrypt.hash(sms, salt, null, function (err, hash) {392 // Save the Mobile number and SMS for the user393 User.findById(req.user.id, function (err, user) {394 if (err) {395 req.flash('error', { msg: err.message });396 return (err);397 }398 user.profile.phone.mobile = req.body.phoneMobile;399 user.enhancedSecurity.sms = hash;400 user.enhancedSecurity.smsExpires = Date.now() + expiration;401 user.activity.last_updated = Date.now();402 user.save(function (err) {403 if (err) {404 req.flash('error', { msg: err.message });405 return (err);406 }407 });408 });409 // Send the SMS Text to the User410 var message = {411 to: req.body.phoneMobile,412 from: config.twilio.phone,413 body: 'Your ' + app.locals.application + ' login code is: ' + sms + '.'414 };415 twilio.sendMessage(message, function (err, responseData) {416 if (err) {417 req.flash('error', { msg: err.message });418 return res.redirect('back');419 }420 req.flash('success', { msg: 'A login code was sent to your mobile phone.' });421 res.redirect('/verify-sms-first');422 });423 });424 });425 });426 /**427 * GET /verify-sms-first (requires authentication)428 *429 * Verify that the user's SMS test code works.430 */431 app.get('/verify-sms-first', passportConf.isAuthenticated, function (req, res, next) {432 res.render('twofactor/verify-sms-first', {433 navTitle: 'Verify SMS',434 user: req.user,435 url: '/account' // to set navbar active state436 });437 });438 /**439 * POST /verify-sms-first (requires authentication)440 *441 * If the code is verified then turn on enhanced security442 * and redirect to the 'complete-enhanced-security' page.443 */444 app.post('/verify-sms-first', passportConf.isAuthenticated, function (req, res, next) {445 // Get the user using their ID and make sure their sms token hasn't expired yet446 User.findOne({ _id: req.user.id })447 .where('enhancedSecurity.smsExpires').gt(Date.now())448 .exec(function (err, user) {449 if (err) {450 req.flash('error', { msg: err.message });451 return res.redirect('back');452 }453 if (!user) {454 req.flash('error', { msg: 'Your code has expired.' });455 return res.redirect('back');456 }457 // Validate their SMS token458 user.compareSMS(req.body.code, function (err, isMatch) {459 if (isMatch) {460 // Finalize enabling enhanced security461 user.enhancedSecurity.enabled = true;462 user.enhancedSecurity.type = 'sms';463 user.enhancedSecurity.sms = null;464 user.enhancedSecurity.smsExpires = null;465 user.activity.last_updated = Date.now();466 user.save(function (err) {467 if (err) {468 req.flash('error', { msg: err.message });469 return res.redirect('back');470 }471 });472 // Save the fact that we have authenticated via two factor473 req.session.passport.secondFactor = 'validated';474 // Complete enhanced security setup475 res.redirect('/complete-enhanced-security');476 } else {477 req.flash('error', { msg: 'That code is invalid.' });478 return res.redirect('back');479 }480 });481 });482 });...

Full Screen

Full Screen

IndexedDBModel.js

Source:IndexedDBModel.js Github

copy

Full Screen

1/*2 * Copyright (C) 2012 Google Inc. All rights reserved.3 *4 * Redistribution and use in source and binary forms, with or without5 * modification, are permitted provided that the following conditions are6 * met:7 *8 * * Redistributions of source code must retain the above copyright9 * notice, this list of conditions and the following disclaimer.10 * * Redistributions in binary form must reproduce the above11 * copyright notice, this list of conditions and the following disclaimer12 * in the documentation and/or other materials provided with the13 * distribution.14 * * Neither the name of Google Inc. nor the names of its15 * contributors may be used to endorse or promote products derived from16 * this software without specific prior written permission.17 *18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.29 */30/**31 * @constructor32 * @extends {WebInspector.TargetAwareObject}33 */34WebInspector.IndexedDBModel = function(target)35{36 WebInspector.TargetAwareObject.call(this, target);37 this._agent = target.indexedDBAgent();38 this._agent.enable();39 target.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.SecurityOriginAdded, this._securityOriginAdded, this);40 target.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.SecurityOriginRemoved, this._securityOriginRemoved, this);41 /** @type {!Map.<!WebInspector.IndexedDBModel.DatabaseId, !WebInspector.IndexedDBModel.Database>} */42 this._databases = new Map();43 /** @type {!Object.<string, !Array.<string>>} */44 this._databaseNamesBySecurityOrigin = {};45 this._reset();46}47WebInspector.IndexedDBModel.KeyTypes = {48 NumberType: "number",49 StringType: "string",50 DateType: "date",51 ArrayType: "array"52};53WebInspector.IndexedDBModel.KeyPathTypes = {54 NullType: "null",55 StringType: "string",56 ArrayType: "array"57};58/**59 * @param {*} idbKey60 * @return {?Object}61 */62WebInspector.IndexedDBModel.keyFromIDBKey = function(idbKey)63{64 if (typeof(idbKey) === "undefined" || idbKey === null)65 return null;66 var key = {};67 switch (typeof(idbKey)) {68 case "number":69 key.number = idbKey;70 key.type = WebInspector.IndexedDBModel.KeyTypes.NumberType;71 break;72 case "string":73 key.string = idbKey;74 key.type = WebInspector.IndexedDBModel.KeyTypes.StringType;75 break;76 case "object":77 if (idbKey instanceof Date) {78 key.date = idbKey.getTime();79 key.type = WebInspector.IndexedDBModel.KeyTypes.DateType;80 } else if (idbKey instanceof Array) {81 key.array = [];82 for (var i = 0; i < idbKey.length; ++i)83 key.array.push(WebInspector.IndexedDBModel.keyFromIDBKey(idbKey[i]));84 key.type = WebInspector.IndexedDBModel.KeyTypes.ArrayType;85 }86 break;87 default:88 return null;89 }90 return key;91}92/**93 * @param {?IDBKeyRange=} idbKeyRange94 * @return {?{lower: ?Object, upper: ?Object, lowerOpen: *, upperOpen: *}}95 */96WebInspector.IndexedDBModel.keyRangeFromIDBKeyRange = function(idbKeyRange)97{98 if (typeof idbKeyRange === "undefined" || idbKeyRange === null)99 return null;100 var keyRange = {};101 keyRange.lower = WebInspector.IndexedDBModel.keyFromIDBKey(idbKeyRange.lower);102 keyRange.upper = WebInspector.IndexedDBModel.keyFromIDBKey(idbKeyRange.upper);103 keyRange.lowerOpen = idbKeyRange.lowerOpen;104 keyRange.upperOpen = idbKeyRange.upperOpen;105 return keyRange;106}107/**108 * @param {!IndexedDBAgent.KeyPath} keyPath109 * @return {?string|!Array.<string>|undefined}110 */111WebInspector.IndexedDBModel.idbKeyPathFromKeyPath = function(keyPath)112{113 var idbKeyPath;114 switch (keyPath.type) {115 case WebInspector.IndexedDBModel.KeyPathTypes.NullType:116 idbKeyPath = null;117 break;118 case WebInspector.IndexedDBModel.KeyPathTypes.StringType:119 idbKeyPath = keyPath.string;120 break;121 case WebInspector.IndexedDBModel.KeyPathTypes.ArrayType:122 idbKeyPath = keyPath.array;123 break;124 }125 return idbKeyPath;126}127/**128 * @param {?string|!Array.<string>|undefined} idbKeyPath129 * @return {?string}130 */131WebInspector.IndexedDBModel.keyPathStringFromIDBKeyPath = function(idbKeyPath)132{133 if (typeof idbKeyPath === "string")134 return "\"" + idbKeyPath + "\"";135 if (idbKeyPath instanceof Array)136 return "[\"" + idbKeyPath.join("\", \"") + "\"]";137 return null;138}139WebInspector.IndexedDBModel.EventTypes = {140 DatabaseAdded: "DatabaseAdded",141 DatabaseRemoved: "DatabaseRemoved",142 DatabaseLoaded: "DatabaseLoaded"143}144WebInspector.IndexedDBModel.prototype = {145 _reset: function()146 {147 for (var securityOrigin in this._databaseNamesBySecurityOrigin)148 this._removeOrigin(securityOrigin);149 var securityOrigins = this.target().resourceTreeModel.securityOrigins();150 for (var i = 0; i < securityOrigins.length; ++i)151 this._addOrigin(securityOrigins[i]);152 },153 refreshDatabaseNames: function()154 {155 for (var securityOrigin in this._databaseNamesBySecurityOrigin)156 this._loadDatabaseNames(securityOrigin);157 },158 /**159 * @param {!WebInspector.IndexedDBModel.DatabaseId} databaseId160 */161 refreshDatabase: function(databaseId)162 {163 this._loadDatabase(databaseId);164 },165 /**166 * @param {!WebInspector.IndexedDBModel.DatabaseId} databaseId167 * @param {string} objectStoreName168 * @param {function()} callback169 */170 clearObjectStore: function(databaseId, objectStoreName, callback)171 {172 this._agent.clearObjectStore(databaseId.securityOrigin, databaseId.name, objectStoreName, callback);173 },174 /**175 * @param {!WebInspector.Event} event176 */177 _securityOriginAdded: function(event)178 {179 var securityOrigin = /** @type {string} */ (event.data);180 this._addOrigin(securityOrigin);181 },182 /**183 * @param {!WebInspector.Event} event184 */185 _securityOriginRemoved: function(event)186 {187 var securityOrigin = /** @type {string} */ (event.data);188 this._removeOrigin(securityOrigin);189 },190 /**191 * @param {string} securityOrigin192 */193 _addOrigin: function(securityOrigin)194 {195 console.assert(!this._databaseNamesBySecurityOrigin[securityOrigin]);196 this._databaseNamesBySecurityOrigin[securityOrigin] = [];197 this._loadDatabaseNames(securityOrigin);198 },199 /**200 * @param {string} securityOrigin201 */202 _removeOrigin: function(securityOrigin)203 {204 console.assert(this._databaseNamesBySecurityOrigin[securityOrigin]);205 for (var i = 0; i < this._databaseNamesBySecurityOrigin[securityOrigin].length; ++i)206 this._databaseRemoved(securityOrigin, this._databaseNamesBySecurityOrigin[securityOrigin][i]);207 delete this._databaseNamesBySecurityOrigin[securityOrigin];208 },209 /**210 * @param {string} securityOrigin211 * @param {!Array.<string>} databaseNames212 */213 _updateOriginDatabaseNames: function(securityOrigin, databaseNames)214 {215 var newDatabaseNames = {};216 for (var i = 0; i < databaseNames.length; ++i)217 newDatabaseNames[databaseNames[i]] = true;218 var oldDatabaseNames = {};219 for (var i = 0; i < this._databaseNamesBySecurityOrigin[securityOrigin].length; ++i)220 oldDatabaseNames[this._databaseNamesBySecurityOrigin[securityOrigin][i]] = true;221 this._databaseNamesBySecurityOrigin[securityOrigin] = databaseNames;222 for (var databaseName in oldDatabaseNames) {223 if (!newDatabaseNames[databaseName])224 this._databaseRemoved(securityOrigin, databaseName);225 }226 for (var databaseName in newDatabaseNames) {227 if (!oldDatabaseNames[databaseName])228 this._databaseAdded(securityOrigin, databaseName);229 }230 },231 /**232 * @param {string} securityOrigin233 * @param {string} databaseName234 */235 _databaseAdded: function(securityOrigin, databaseName)236 {237 var databaseId = new WebInspector.IndexedDBModel.DatabaseId(securityOrigin, databaseName);238 this.dispatchEventToListeners(WebInspector.IndexedDBModel.EventTypes.DatabaseAdded, databaseId);239 },240 /**241 * @param {string} securityOrigin242 * @param {string} databaseName243 */244 _databaseRemoved: function(securityOrigin, databaseName)245 {246 var databaseId = new WebInspector.IndexedDBModel.DatabaseId(securityOrigin, databaseName);247 this.dispatchEventToListeners(WebInspector.IndexedDBModel.EventTypes.DatabaseRemoved, databaseId);248 },249 /**250 * @param {string} securityOrigin251 */252 _loadDatabaseNames: function(securityOrigin)253 {254 /**255 * @param {?Protocol.Error} error256 * @param {!Array.<string>} databaseNames257 * @this {WebInspector.IndexedDBModel}258 */259 function callback(error, databaseNames)260 {261 if (error) {262 console.error("IndexedDBAgent error: " + error);263 return;264 }265 if (!this._databaseNamesBySecurityOrigin[securityOrigin])266 return;267 this._updateOriginDatabaseNames(securityOrigin, databaseNames);268 }269 this._agent.requestDatabaseNames(securityOrigin, callback.bind(this));270 },271 /**272 * @param {!WebInspector.IndexedDBModel.DatabaseId} databaseId273 */274 _loadDatabase: function(databaseId)275 {276 /**277 * @param {?Protocol.Error} error278 * @param {!IndexedDBAgent.DatabaseWithObjectStores} databaseWithObjectStores279 * @this {WebInspector.IndexedDBModel}280 */281 function callback(error, databaseWithObjectStores)282 {283 if (error) {284 console.error("IndexedDBAgent error: " + error);285 return;286 }287 if (!this._databaseNamesBySecurityOrigin[databaseId.securityOrigin])288 return;289 var databaseModel = new WebInspector.IndexedDBModel.Database(databaseId, databaseWithObjectStores.version, databaseWithObjectStores.intVersion);290 this._databases.put(databaseId, databaseModel);291 for (var i = 0; i < databaseWithObjectStores.objectStores.length; ++i) {292 var objectStore = databaseWithObjectStores.objectStores[i];293 var objectStoreIDBKeyPath = WebInspector.IndexedDBModel.idbKeyPathFromKeyPath(objectStore.keyPath);294 var objectStoreModel = new WebInspector.IndexedDBModel.ObjectStore(objectStore.name, objectStoreIDBKeyPath, objectStore.autoIncrement);295 for (var j = 0; j < objectStore.indexes.length; ++j) {296 var index = objectStore.indexes[j];297 var indexIDBKeyPath = WebInspector.IndexedDBModel.idbKeyPathFromKeyPath(index.keyPath);298 var indexModel = new WebInspector.IndexedDBModel.Index(index.name, indexIDBKeyPath, index.unique, index.multiEntry);299 objectStoreModel.indexes[indexModel.name] = indexModel;300 }301 databaseModel.objectStores[objectStoreModel.name] = objectStoreModel;302 }303 this.dispatchEventToListeners(WebInspector.IndexedDBModel.EventTypes.DatabaseLoaded, databaseModel);304 }305 this._agent.requestDatabase(databaseId.securityOrigin, databaseId.name, callback.bind(this));306 },307 /**308 * @param {!WebInspector.IndexedDBModel.DatabaseId} databaseId309 * @param {string} objectStoreName310 * @param {?IDBKeyRange} idbKeyRange311 * @param {number} skipCount312 * @param {number} pageSize313 * @param {function(!Array.<!WebInspector.IndexedDBModel.Entry>, boolean)} callback314 */315 loadObjectStoreData: function(databaseId, objectStoreName, idbKeyRange, skipCount, pageSize, callback)316 {317 this._requestData(databaseId, databaseId.name, objectStoreName, "", idbKeyRange, skipCount, pageSize, callback);318 },319 /**320 * @param {!WebInspector.IndexedDBModel.DatabaseId} databaseId321 * @param {string} objectStoreName322 * @param {string} indexName323 * @param {?IDBKeyRange} idbKeyRange324 * @param {number} skipCount325 * @param {number} pageSize326 * @param {function(!Array.<!WebInspector.IndexedDBModel.Entry>, boolean)} callback327 */328 loadIndexData: function(databaseId, objectStoreName, indexName, idbKeyRange, skipCount, pageSize, callback)329 {330 this._requestData(databaseId, databaseId.name, objectStoreName, indexName, idbKeyRange, skipCount, pageSize, callback);331 },332 /**333 * @param {!WebInspector.IndexedDBModel.DatabaseId} databaseId334 * @param {string} databaseName335 * @param {string} objectStoreName336 * @param {string} indexName337 * @param {?IDBKeyRange} idbKeyRange338 * @param {number} skipCount339 * @param {number} pageSize340 * @param {function(!Array.<!WebInspector.IndexedDBModel.Entry>, boolean)} callback341 */342 _requestData: function(databaseId, databaseName, objectStoreName, indexName, idbKeyRange, skipCount, pageSize, callback)343 {344 /**345 * @param {?Protocol.Error} error346 * @param {!Array.<!IndexedDBAgent.DataEntry>} dataEntries347 * @param {boolean} hasMore348 * @this {WebInspector.IndexedDBModel}349 */350 function innerCallback(error, dataEntries, hasMore)351 {352 if (error) {353 console.error("IndexedDBAgent error: " + error);354 return;355 }356 if (!this._databaseNamesBySecurityOrigin[databaseId.securityOrigin])357 return;358 var entries = [];359 for (var i = 0; i < dataEntries.length; ++i) {360 var key = WebInspector.RemoteObject.fromLocalObject(JSON.parse(dataEntries[i].key));361 var primaryKey = WebInspector.RemoteObject.fromLocalObject(JSON.parse(dataEntries[i].primaryKey));362 var value = WebInspector.RemoteObject.fromLocalObject(JSON.parse(dataEntries[i].value));363 entries.push(new WebInspector.IndexedDBModel.Entry(key, primaryKey, value));364 }365 callback(entries, hasMore);366 }367 var keyRange = WebInspector.IndexedDBModel.keyRangeFromIDBKeyRange(idbKeyRange);368 this._agent.requestData(databaseId.securityOrigin, databaseName, objectStoreName, indexName, skipCount, pageSize, keyRange ? keyRange : undefined, innerCallback.bind(this));369 },370 __proto__: WebInspector.TargetAwareObject.prototype371}372/**373 * @constructor374 * @param {!WebInspector.RemoteObject} key375 * @param {!WebInspector.RemoteObject} primaryKey376 * @param {!WebInspector.RemoteObject} value377 */378WebInspector.IndexedDBModel.Entry = function(key, primaryKey, value)379{380 this.key = key;381 this.primaryKey = primaryKey;382 this.value = value;383}384/**385 * @constructor386 * @param {string} securityOrigin387 * @param {string} name388 */389WebInspector.IndexedDBModel.DatabaseId = function(securityOrigin, name)390{391 this.securityOrigin = securityOrigin;392 this.name = name;393}394WebInspector.IndexedDBModel.DatabaseId.prototype = {395 /**396 * @param {!WebInspector.IndexedDBModel.DatabaseId} databaseId397 * @return {boolean}398 */399 equals: function(databaseId)400 {401 return this.name === databaseId.name && this.securityOrigin === databaseId.securityOrigin;402 },403}404/**405 * @constructor406 * @param {!WebInspector.IndexedDBModel.DatabaseId} databaseId407 * @param {string} version408 * @param {number} intVersion409 */410WebInspector.IndexedDBModel.Database = function(databaseId, version, intVersion)411{412 this.databaseId = databaseId;413 this.version = version;414 this.intVersion = intVersion;415 this.objectStores = {};416}417/**418 * @constructor419 * @param {string} name420 * @param {*} keyPath421 * @param {boolean} autoIncrement422 */423WebInspector.IndexedDBModel.ObjectStore = function(name, keyPath, autoIncrement)424{425 this.name = name;426 this.keyPath = keyPath;427 this.autoIncrement = autoIncrement;428 this.indexes = {};429}430WebInspector.IndexedDBModel.ObjectStore.prototype = {431 /**432 * @type {string}433 */434 get keyPathString()435 {436 return WebInspector.IndexedDBModel.keyPathStringFromIDBKeyPath(this.keyPath);437 }438}439/**440 * @constructor441 * @param {string} name442 * @param {*} keyPath443 * @param {boolean} unique444 * @param {boolean} multiEntry445 */446WebInspector.IndexedDBModel.Index = function(name, keyPath, unique, multiEntry)447{448 this.name = name;449 this.keyPath = keyPath;450 this.unique = unique;451 this.multiEntry = multiEntry;452}453WebInspector.IndexedDBModel.Index.prototype = {454 /**455 * @type {string}456 */457 get keyPathString()458 {459 return WebInspector.IndexedDBModel.keyPathStringFromIDBKeyPath(this.keyPath);460 }...

Full Screen

Full Screen

pair22.js

Source:pair22.js Github

copy

Full Screen

1function FileData_Pairs(x)2{3x.t("-2014","software");4x.t("yyyymmdd_hhmmss","log");5x.t("breaches","addition");6x.t("parameter","refresh");7x.t("2007","-2014");8x.t("integration","server");9x.t("various","times");10x.t("newest","oldest");11x.t("newest","starting");12x.t("action","security");13x.t("action","performed");14x.t("action","server");15x.t("enabled","auditing");16x.t("current","oldest");17x.t("current","display");18x.t("permanently","change");19x.t("user","identity");20x.t("user","performing");21x.t("field","settings");22x.t("auditing","enabled");23x.t("auditing","configuration");24x.t("modified","webmethods");25x.t("administrator","displays");26x.t("administrator","privileges");27x.t("displays","recent");28x.t("times","security");29x.t("open","security");30x.t("change","default");31x.t("change","number");32x.t("originated","user");33x.t("type","specific");34x.t("oldest","newest");35x.t("oldest","current");36x.t("oldest","number");37x.t("oldest","starting");38x.t("time","stamp");39x.t("time","entry");40x.t("darmstadt","germany");41x.t("back","regularly");42x.t("default","integration");43x.t("default","refresh");44x.t("default","value");45x.t("default","seconds");46x.t("contents","recent");47x.t("wmsecurity_","yyyymmdd_hhmmss");48x.t("security","breaches");49x.t("security","action");50x.t("security","auditing");51x.t("security","security");52x.t("security","actions");53x.t("security","logs");54x.t("security","event");55x.t("security","configuration");56x.t("security","purposes");57x.t("security","audit");58x.t("security","operations");59x.t("security","log");60x.t("actions","settings");61x.t("actions","server");62x.t("machine","logs");63x.t("menu","navigation");64x.t("beginning","view");65x.t("stamp","date");66x.t("guide","information");67x.t("check","audit");68x.t("entry","written");69x.t("identity","integration");70x.t("settings","logging");71x.t("settings","extended");72x.t("settings","specify");73x.t("stored","becomes");74x.t("name","server");75x.t("logging","guide");76x.t("logging","screen");77x.t("provides","information");78x.t("area","integration");79x.t("records","log");80x.t("address","host");81x.t("addition","back");82x.t("recent","security");83x.t("recent","entries");84x.t("request","originated");85x.t("display","default");86x.t("display","changing");87x.t("display","controls");88x.t("display","log");89x.t("refresh","click");90x.t("refresh","interval");91x.t("button","update");92x.t("number","entries");93x.t("written","log");94x.t("software","darmstadt");95x.t("heading","logs");96x.t("starting","beginning");97x.t("starting","end");98x.t("hh:mm:ss","time");99x.t("end","view");100x.t("client","address");101x.t("adds","records");102x.t("logs","security");103x.t("logs","menu");104x.t("logs","stored");105x.t("extended","page");106x.t("message","provides");107x.t("performing","security");108x.t("webmethods","audit");109x.t("click","security");110x.t("click","button");111x.t("event","type");112x.t("regularly","check");113x.t("regularly","case");114x.t("displayed","tip");115x.t("changing","log");116x.t("configuration","modified");117x.t("configuration","security");118x.t("value","field");119x.t("interval","log");120x.t("running","client");121x.t("depending","settings");122x.t("specific","area");123x.t("view","contents");124x.t("view","entries");125x.t("screen","security");126x.t("screen","heading");127x.t("screen","click");128x.t("screen","view");129x.t("screen","screen");130x.t("screen","server");131x.t("trail","security");132x.t("panel","log");133x.t("purposes","regularly");134x.t("tip","administrator");135x.t("page","modify");136x.t("information","security");137x.t("information","log");138x.t("becomes","unavailable");139x.t("privileges","permanently");140x.t("privileges","change");141x.t("host","name");142x.t("host","request");143x.t("mm-dd","hh:mm:ss");144x.t("viewi","security");145x.t("case","machine");146x.t("unavailable","open");147x.t("executes","depending");148x.t("note","security");149x.t("date","time");150x.t("audit","logging");151x.t("audit","logs");152x.t("audit","trail");153x.t("audit","log");154x.t("controls","display");155x.t("controls","tip");156x.t("controls","note");157x.t("navigation","panel");158x.t("operations","log");159x.t("maintains","audit");160x.t("modify","watt.server.log.maxentries");161x.t("modify","watt.server.log.refreshinterval");162x.t("yyyy","mm-dd");163x.t("performed","2007");164x.t("log","various");165x.t("log","current");166x.t("log","change");167x.t("log","oldest");168x.t("log","wmsecurity_");169x.t("log","security");170x.t("log","display");171x.t("log","logs");172x.t("log","message");173x.t("log","screen");174x.t("log","viewi");175x.t("log","maintains");176x.t("log","entries");177x.t("entries","newest");178x.t("entries","oldest");179x.t("entries","default");180x.t("entries","display");181x.t("entries","displayed");182x.t("entries","yyyy");183x.t("entries","log");184x.t("server","integration");185x.t("server","user");186x.t("server","administrator");187x.t("server","security");188x.t("server","address");189x.t("server","adds");190x.t("server","running");191x.t("server","executes");192x.t("specify","security");193x.t("watt.server.log.maxentries","parameter");194x.t("update","display");195x.t("seconds","settings");196x.t("watt.server.log.refreshinterval","security"); ...

Full Screen

Full Screen

security-question-api.js

Source:security-question-api.js Github

copy

Full Screen

1/*2============================================3; Title: security-question-api.js4; Author: Professor Krasso5; Date: 17 January 20216; Modified By: Becca Buechle, Rochelle Markham, Rhonda Rivas, King Major7; Description: Model for MongoDB SecurityQuestions collection8;===========================================9*/10// require statements11const express = require('express');12const SecurityQuestion = require('../db-models/security-question');13// configurations14const router = express.Router();15/**16 * FindAll17 */18router.get('/', function (req, res, next) {19 SecurityQuestion.find({}).where('isDisabled').equals(false).exec(function(err, securityQuestions) {20 if (err) {21 console.log(err);22 return next(err);23 } else {24 console.log(securityQuestions);25 res.json(securityQuestions);26 }27 })28});29/**30 * FindById31 */32router.get('/:id', function (req, res, next) {33 SecurityQuestion.findOne({'_id': req.params.id}, function (err, securityQuestion) {34 if (err) {35 console.log(err);36 return next(err);37 } else {38 console.log(securityQuestion);39 res.json(securityQuestion);40 }41 })42});43/**44 * CreateSecurityQuestion45 */46router.post('/', function (req, res, next) {47 let sq = {48 text: req.body.text49 };50 SecurityQuestion.create(sq, function (err, securityQuestion) {51 if (err) {52 console.log(err);53 return next(err);54 } else {55 console.log(securityQuestion);56 res.json(securityQuestion);57 }58 })59});60/**61 * UpdateSecurityQuestion62 */63router.put('/:id', function (req, res, next) {64 SecurityQuestion.findOne({'_id': req.params.id}, function (err, securityQuestion) {65 if (err) {66 console.log(err);67 return next(err);68 } else {69 console.log(securityQuestion);70 securityQuestion.set({71 text: req.body.text72 });73 securityQuestion.save(function (err, securityQuestion) {74 if (err) {75 console.log(err);76 return next(err);77 } else {78 console.log(securityQuestion);79 res.json(securityQuestion);80 }81 })82 }83 })84});85/**86 * DeleteSecurityQuestion87 */88router.delete('/:id', function (req, res, next) {89 SecurityQuestion.findOne({'_id': req.params.id}, function(err, securityQuestion) {90 if (err) {91 console.log(err);92 return next(err);93 } else {94 console.log(securityQuestion);95 if (securityQuestion) {96 securityQuestion.set({97 isDisabled: true98 });99 securityQuestion.save(function(err, savedSecurityQuestion) {100 if (err) {101 console.log(err);102 return next(err);103 } else {104 console.log(savedSecurityQuestion);105 res.json(savedSecurityQuestion);106 }107 })108 }109 }110 });111});112/**113 * API - Find Security Questions by Id's114 * FindSecurityQuestionsByIds115 */116router.post('/find-by-ids', function (req, res, next) {117 const question1 = req.body.question1;118 const question2 = req.body.question2;119 const question3 = req.body.question3;120 SecurityQuestion.find({121 $or: [122 {'_id': question1},123 {'_id': question2},124 {'_id': question3}125 ]126 }).exec(function (err, securityQuestions) {127 if (err) {128 console.log(err);129 return next(err);130 } else {131 console.log(securityQuestions);132 res.json(securityQuestions);133 }134 })135});136//exports...

Full Screen

Full Screen

settings.js

Source:settings.js Github

copy

Full Screen

1export default {2 'app.settings.menuMap.basic': 'Basic Settings',3 'app.settings.menuMap.security': 'Security Settings',4 'app.settings.menuMap.binding': 'Account Binding',5 'app.settings.menuMap.notification': 'New Message Notification',6 'app.settings.basic.avatar': 'Avatar',7 'app.settings.basic.change-avatar': 'Change avatar',8 'app.settings.basic.email': 'Email',9 'app.settings.basic.email-message': 'Please input your email!',10 'app.settings.basic.nickname': 'Nickname',11 'app.settings.basic.nickname-message': 'Please input your Nickname!',12 'app.settings.basic.profile': 'Personal profile',13 'app.settings.basic.profile-message': 'Please input your personal profile!',14 'app.settings.basic.profile-placeholder': 'Brief introduction to yourself',15 'app.settings.basic.country': 'Country/Region',16 'app.settings.basic.country-message': 'Please input your country!',17 'app.settings.basic.geographic': 'Province or city',18 'app.settings.basic.geographic-message': 'Please input your geographic info!',19 'app.settings.basic.address': 'Street Address',20 'app.settings.basic.address-message': 'Please input your address!',21 'app.settings.basic.phone': 'Phone Number',22 'app.settings.basic.phone-message': 'Please input your phone!',23 'app.settings.basic.update': 'Update Information',24 'app.settings.security.strong': 'Strong',25 'app.settings.security.medium': 'Medium',26 'app.settings.security.weak': 'Weak',27 'app.settings.security.password': 'Account Password',28 'app.settings.security.password-description': 'Current password strength',29 'app.settings.security.phone': 'Security Phone',30 'app.settings.security.phone-description': 'Bound phone',31 'app.settings.security.question': 'Security Question',32 'app.settings.security.question-description':33 'The security question is not set, and the security policy can effectively protect the account security',34 'app.settings.security.email': 'Backup Email',35 'app.settings.security.email-description': 'Bound Email',36 'app.settings.security.mfa': 'MFA Device',37 'app.settings.security.mfa-description':38 'Unbound MFA device, after binding, can be confirmed twice',39 'app.settings.security.modify': 'Modify',40 'app.settings.security.set': 'Set',41 'app.settings.security.bind': 'Bind',42 'app.settings.binding.taobao': 'Binding Taobao',43 'app.settings.binding.taobao-description': 'Currently unbound Taobao account',44 'app.settings.binding.alipay': 'Binding Alipay',45 'app.settings.binding.alipay-description': 'Currently unbound Alipay account',46 'app.settings.binding.dingding': 'Binding DingTalk',47 'app.settings.binding.dingding-description': 'Currently unbound DingTalk account',48 'app.settings.binding.bind': 'Bind',49 'app.settings.notification.password': 'Account Password',50 'app.settings.notification.password-description':51 'Messages from other users will be notified in the form of a station letter',52 'app.settings.notification.messages': 'System Messages',53 'app.settings.notification.messages-description':54 'System messages will be notified in the form of a station letter',55 'app.settings.notification.todo': 'To-do Notification',56 'app.settings.notification.todo-description':57 'The to-do list will be notified in the form of a letter from the station',58 'app.settings.open': 'Open',59 'app.settings.close': 'Close',...

Full Screen

Full Screen

security-prefs.js

Source:security-prefs.js Github

copy

Full Screen

1pref("general.useragent.security", "U");2pref("security.enable_ssl2", false);3pref("security.enable_ssl3", true);4pref("security.enable_tls", true);5pref("security.ssl2.rc4_128", false);6pref("security.ssl2.rc2_128", false);7pref("security.ssl2.des_ede3_192", false);8pref("security.ssl2.des_64", false);9pref("security.ssl2.rc4_40", false);10pref("security.ssl2.rc2_40", false);11pref("security.ssl3.rsa_rc4_128_md5", true);12pref("security.ssl3.rsa_rc4_128_sha", true);13pref("security.ssl3.rsa_fips_des_ede3_sha", true);14pref("security.ssl3.rsa_des_ede3_sha", true);15pref("security.ssl3.rsa_fips_des_sha", false);16pref("security.ssl3.rsa_des_sha", false);17pref("security.ssl3.rsa_1024_rc4_56_sha", false);18pref("security.ssl3.rsa_1024_des_cbc_sha", false);19pref("security.ssl3.rsa_rc4_40_md5", false);20pref("security.ssl3.rsa_rc2_40_md5", false);21pref("security.ssl3.dhe_rsa_aes_256_sha", true);22pref("security.ssl3.dhe_dss_aes_256_sha", true);23pref("security.ssl3.rsa_aes_256_sha", true);24pref("security.ssl3.ecdhe_ecdsa_aes_256_sha", true);25pref("security.ssl3.ecdhe_ecdsa_aes_128_sha", true);26pref("security.ssl3.ecdhe_ecdsa_des_ede3_sha", true);27pref("security.ssl3.ecdhe_ecdsa_rc4_128_sha", true);28pref("security.ssl3.ecdhe_ecdsa_null_sha", false);29pref("security.ssl3.ecdhe_rsa_aes_256_sha", true);30pref("security.ssl3.ecdhe_rsa_aes_128_sha", true);31pref("security.ssl3.ecdhe_rsa_des_ede3_sha", true);32pref("security.ssl3.ecdhe_rsa_rc4_128_sha", true);33pref("security.ssl3.ecdhe_rsa_null_sha", false);34pref("security.ssl3.ecdh_ecdsa_aes_256_sha", true);35pref("security.ssl3.ecdh_ecdsa_aes_128_sha", true);36pref("security.ssl3.ecdh_ecdsa_des_ede3_sha", true);37pref("security.ssl3.ecdh_ecdsa_rc4_128_sha", true);38pref("security.ssl3.ecdh_ecdsa_null_sha", false);39pref("security.ssl3.ecdh_rsa_aes_256_sha", true);40pref("security.ssl3.ecdh_rsa_aes_128_sha", true);41pref("security.ssl3.ecdh_rsa_des_ede3_sha", true);42pref("security.ssl3.ecdh_rsa_rc4_128_sha", true);43pref("security.ssl3.ecdh_rsa_null_sha", false);44pref("security.ssl3.dhe_rsa_aes_128_sha", true);45pref("security.ssl3.dhe_dss_aes_128_sha", true);46pref("security.ssl3.rsa_aes_128_sha", true);47pref("security.ssl3.dhe_rsa_des_ede3_sha", true);48pref("security.ssl3.dhe_dss_des_ede3_sha", true);49pref("security.ssl3.dhe_rsa_des_sha", false);50pref("security.ssl3.dhe_dss_des_sha", false);51pref("security.ssl3.rsa_null_sha", false);52pref("security.ssl3.rsa_null_md5", false);53pref("security.default_personal_cert", "Ask Every Time");54pref("security.remember_cert_checkbox_default_setting", true);55pref("security.ask_for_password", 0);56pref("security.password_lifetime", 30);57pref("security.warn_entering_secure", true);58pref("security.warn_entering_weak", true);59pref("security.warn_leaving_secure", true);60pref("security.warn_viewing_mixed", true);61pref("security.warn_submit_insecure", true);62pref("security.OCSP.enabled", 0);...

Full Screen

Full Screen

SecurityView.js

Source:SecurityView.js Github

copy

Full Screen

1import React, { Component, Fragment } from 'react';2import { formatMessage, FormattedMessage } from 'umi/locale';3import { List } from 'antd';4// import { getTimeDistance } from '@/utils/utils';5const passwordStrength = {6 strong: (7 <font className="strong">8 <FormattedMessage id="app.settings.security.strong" defaultMessage="Strong" />9 </font>10 ),11 medium: (12 <font className="medium">13 <FormattedMessage id="app.settings.security.medium" defaultMessage="Medium" />14 </font>15 ),16 weak: (17 <font className="weak">18 <FormattedMessage id="app.settings.security.weak" defaultMessage="Weak" />19 Weak20 </font>21 ),22};23class SecurityView extends Component {24 getData = () => [25 {26 title: formatMessage({ id: 'app.settings.security.password' }, {}),27 description: (28 <Fragment>29 {formatMessage({ id: 'app.settings.security.password-description' })}:30 {passwordStrength.strong}31 </Fragment>32 ),33 actions: [34 <a>35 <FormattedMessage id="app.settings.security.modify" defaultMessage="Modify" />36 </a>,37 ],38 },39 {40 title: formatMessage({ id: 'app.settings.security.phone' }, {}),41 description: `${formatMessage(42 { id: 'app.settings.security.phone-description' },43 {}44 )}:138****8293`,45 actions: [46 <a>47 <FormattedMessage id="app.settings.security.modify" defaultMessage="Modify" />48 </a>,49 ],50 },51 {52 title: formatMessage({ id: 'app.settings.security.question' }, {}),53 description: formatMessage({ id: 'app.settings.security.question-description' }, {}),54 actions: [55 <a>56 <FormattedMessage id="app.settings.security.set" defaultMessage="Set" />57 </a>,58 ],59 },60 {61 title: formatMessage({ id: 'app.settings.security.email' }, {}),62 description: `${formatMessage(63 { id: 'app.settings.security.email-description' },64 {}65 )}:ant***sign.com`,66 actions: [67 <a>68 <FormattedMessage id="app.settings.security.modify" defaultMessage="Modify" />69 </a>,70 ],71 },72 {73 title: formatMessage({ id: 'app.settings.security.mfa' }, {}),74 description: formatMessage({ id: 'app.settings.security.mfa-description' }, {}),75 actions: [76 <a>77 <FormattedMessage id="app.settings.security.bind" defaultMessage="Bind" />78 </a>,79 ],80 },81 ];82 render() {83 return (84 <Fragment>85 <List86 itemLayout="horizontal"87 dataSource={this.getData()}88 renderItem={item => (89 <List.Item actions={item.actions}>90 <List.Item.Meta title={item.title} description={item.description} />91 </List.Item>92 )}93 />94 </Fragment>95 );96 }97}...

Full Screen

Full Screen

tokens.js

Source:tokens.js Github

copy

Full Screen

1import security from '../lib/security';2import SecurityTokensService from '../services/security/tokens';3class SecurityTokensRoute {4 constructor(router) {5 this.router = router;6 this.registerRoutes();7 }8 registerRoutes() {9 this.router.get(10 '/v1/security/tokens',11 security.checkUserScope.bind(this, security.scope.ADMIN),12 this.getTokens.bind(this)13 );14 this.router.get(15 '/v1/security/tokens/blacklist',16 security.checkUserScope.bind(this, security.scope.ADMIN),17 this.getTokensBlacklist.bind(this)18 );19 this.router.post(20 '/v1/security/tokens',21 security.checkUserScope.bind(this, security.scope.ADMIN),22 this.addToken.bind(this)23 );24 this.router.get(25 '/v1/security/tokens/:id',26 security.checkUserScope.bind(this, security.scope.ADMIN),27 this.getSingleToken.bind(this)28 );29 this.router.put(30 '/v1/security/tokens/:id',31 security.checkUserScope.bind(this, security.scope.ADMIN),32 this.updateToken.bind(this)33 );34 this.router.delete(35 '/v1/security/tokens/:id',36 security.checkUserScope.bind(this, security.scope.ADMIN),37 this.deleteToken.bind(this)38 );39 this.router.post('/v1/authorize', this.sendDashboardSigninUrl.bind(this));40 }41 getTokens(req, res, next) {42 SecurityTokensService.getTokens(req.query)43 .then(data => {44 res.send(data);45 })46 .catch(next);47 }48 getTokensBlacklist(req, res, next) {49 SecurityTokensService.getTokensBlacklist()50 .then(data => {51 res.send(data);52 })53 .catch(next);54 }55 getSingleToken(req, res, next) {56 SecurityTokensService.getSingleToken(req.params.id)57 .then(data => {58 if (data) {59 res.send(data);60 } else {61 res.status(404).end();62 }63 })64 .catch(next);65 }66 addToken(req, res, next) {67 SecurityTokensService.addToken(req.body)68 .then(data => {69 res.send(data);70 })71 .catch(next);72 }73 updateToken(req, res, next) {74 SecurityTokensService.updateToken(req.params.id, req.body)75 .then(data => {76 if (data) {77 res.send(data);78 } else {79 res.status(404).end();80 }81 })82 .catch(next);83 }84 deleteToken(req, res, next) {85 SecurityTokensService.deleteToken(req.params.id)86 .then(data => {87 res.end();88 })89 .catch(next);90 }91 sendDashboardSigninUrl(req, res, next) {92 SecurityTokensService.sendDashboardSigninUrl(req)93 .then(data => {94 res.send(data);95 })96 .catch(next);97 }98}...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1const { addMatchImageSnapshotCommand } = require('cypress-image-snapshot/command');2addMatchImageSnapshotCommand({3});4describe('My First Test', () => {5 it('Does not do much!', () => {6 cy.contains('type').click()7 cy.url().should('include', '/commands/actions')8 cy.get('.action-email')9 .type('

Full Screen

Using AI Code Generation

copy

Full Screen

1describe('Login Test', function() {2 it('Login', function() {3 cy.get('input[name="q"]').type('Cypress')4 cy.get('input[name="btnK"]').click()5 })6})7{8 "env": {9 }10}

Full Screen

Cypress Tutorial

Cypress is a renowned Javascript-based open-source, easy-to-use end-to-end testing framework primarily used for testing web applications. Cypress is a relatively new player in the automation testing space and has been gaining much traction lately, as evidenced by the number of Forks (2.7K) and Stars (42.1K) for the project. LambdaTest’s Cypress Tutorial covers step-by-step guides that will help you learn from the basics till you run automation tests on LambdaTest.

Chapters:

  1. What is Cypress? -
  2. Why Cypress? - Learn why Cypress might be a good choice for testing your web applications.
  3. Features of Cypress Testing - Learn about features that make Cypress a powerful and flexible tool for testing web applications.
  4. Cypress Drawbacks - Although Cypress has many strengths, it has a few limitations that you should be aware of.
  5. Cypress Architecture - Learn more about Cypress architecture and how it is designed to be run directly in the browser, i.e., it does not have any additional servers.
  6. Browsers Supported by Cypress - Cypress is built on top of the Electron browser, supporting all modern web browsers. Learn browsers that support Cypress.
  7. Selenium vs Cypress: A Detailed Comparison - Compare and explore some key differences in terms of their design and features.
  8. Cypress Learning: Best Practices - Take a deep dive into some of the best practices you should use to avoid anti-patterns in your automation tests.
  9. How To Run Cypress Tests on LambdaTest? - Set up a LambdaTest account, and now you are all set to learn how to run Cypress tests.

Certification

You can elevate your expertise with end-to-end testing using the Cypress automation framework and stay one step ahead in your career by earning a Cypress certification. Check out our Cypress 101 Certification.

YouTube

Watch this 3 hours of complete tutorial to learn the basics of Cypress and various Cypress commands with the Cypress testing at LambdaTest.

Run Cypress automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful