This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
func makeRequest (url:String, email:String, password: String, done: (NSURLResponse!, NSData!, NSError!) -> Void) -> Void { | |
let URL = NSURL(string: url) | |
let postData = "email=\(email)&password=\(password)" | |
var request : NSMutableURLRequest = NSMutableURLRequest(URL: URL!) | |
request.HTTPMethod = "POST" | |
request.HTTPBody = postData.dataUsingEncoding(NSUTF8StringEncoding) | |
request.setValue("application/x-www-form-urlencoded", forHTTPHeaderField: "Content-Type") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
func makeRequest (url:String, email:String, password: String, done: (NSURLResponse!, NSData!, NSError!) -> Void) -> Void { | |
let URL = NSURL(string: url) | |
let postData = "email=\(email)&password=\(password)" | |
var request : NSMutableURLRequest = NSMutableURLRequest(URL: URL!) | |
request.HTTPMethod = "POST" | |
request.HTTPBody = postData.dataUsingEncoding(NSUTF8StringEncoding) | |
request.setValue("application/x-www-form-urlencoded", forHTTPHeaderField: "Content-Type") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
class LoginViewController: UIViewController { | |
let domain = "http://plebvote.com:1337" | |
let URI = "/order/login" | |
@IBOutlet weak var usernameTxt: UITextField! | |
@IBOutlet weak var passwordTxt: UITextField! | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// in your library.js file | |
module.exports = { | |
getFibonacciNumber: function (n, done) { | |
if (n < 0) { | |
return done("Can only calculate fibonacci numbers for an integer n > -1 !"); | |
} else { | |
var a = 0 | |
, b = 1 | |
, i = 0 | |
, holder |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = { | |
// lots of other files are also exported | |
localLogin: function (passport, req, res, next) { | |
passport.authenticate("login", { | |
successRedirect: "/order/admin", | |
failureRedirect : "/order/admin/login", | |
failureFlash : true | |
})(req, res, next); | |
}, | |
localSignup: function (passport, req, res, next) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = { | |
localLogin: function (passport) { | |
return passport.authenticate("login", { | |
successRedirect: "/order/admin", | |
failureRedirect : "/order/admin/login", | |
failureFlash : true | |
}) | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import User from '../models/user' | |
import { userQueries } from './queries' | |
let LocalStrategy = require('passport-local').Strategy | |
export default function (passport) { | |
passport.serializeUser(serializeUser) | |
passport.deserializeUser(deserializeUser) | |
passport.use('register', getStrategy(register)) | |
passport.use('login', getStrategy(login)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { courseQueries, oneOnOneQueries, userQueries } from '../lib/queries' | |
import ERRORS from '../lib/errors' | |
function passAlongCode (propertyName) { | |
return function (req, res, next, code) { | |
req[propertyName] = code | |
return next() | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(($,_) => | |
_._[_.___(_.__._)](_.___(_.__.__)) | |
)(_$ = { | |
_ : (__) =>__.map(_=> | |
[_,_,_].map(($,_)=>($=+!![],$<<$<<$)-(--_<<+!![])+$)[ | |
($=(!0+[])[3]),(!0+[])[1]+$+([][[]]+[])[2]+([][[]]+[])[0]+([]+{})[5]+$ | |
]((_,__)=>_*__)-_) | |
}, { | |
_ : this, | |
__ : { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
userSchema.methods.changePassword = function (password) { | |
// option 1 | |
return new Promise((resolve, reject) => { | |
let evaluatePassword = passwordStrength(password) | |
if (evaluatePassword.state) { | |
return this.generateHash(password).then((hash) => { | |
this.password = hash | |
return this | |
}) | |
} else { |
OlderNewer