Skip to content

Instantly share code, notes, and snippets.

View adelarcubs's full-sized avatar

Adelar Tiemann Junior adelarcubs

  • Mercado Livre
  • Florianópolis - SC
View GitHub Profile
<?php
namespace User\V1\Rest\User;
use ZF\ApiProblem\ApiProblem;
use ZF\Rest\AbstractResourceListener;
class UserResource extends AbstractResourceListener {
private $em;
# This is a sample build configuration for PHP.
# Only use spaces to indent your .yml configuration.
# -----
# You can specify a custom docker image from Dockerhub as your build environment.
image: phpunit/phpunit:5.0.3
pipelines:
default:
- step:
script: # Modify the commands below to build your repository.
<?php
$userPassword = '123456';
$options = ['cost' => 10];
$hash = password_hash($userPassword, PASSWORD_DEFAULT, $options);
// save $hash as password on database
<?php
$userEmail = '[email protected]';
$userPassword = '123456';
// Using Doctrine for example
$user = $repository->findByEmail($userEmail);
if(password_verify($userPassword, $user->getPassword())){
// DO LOGIN
}
<?php
$userEmail = '[email protected]';
$userPassword = '123456';
// Using Doctrine for example
$user = $repository->findByEmail($userEmail);
if(password_verify($userPassword, $user->getPassword())){
$options = ['cost' => 10];
if(password_needs_rehash($user->getPassword(), PASSWORD_DEFAULT, $options)){
<?php
for($cost = 4; $cost <= 18; $cost++){
$start = microtime(true);
password_hash("test", PASSWORD_DEFAULT, ['cost' => $cost]);
$end = microtime(true);
echo 'Cost: ' . $cost . ' Time cost: ' . ($end - $start) . "\n";
}
<?php
$userEmail = '[email protected]';
$userPassword = '123456';
// Using Doctrine for example
$user = $repository->findByEmail($userEmail);
if(!$user) {
// User not found
// LOGIN ERROR
<?php
$userEmail = '[email protected]';
$userPassword = '123456';
// Using Doctrine for example
$user = $repository->findByEmail($userEmail);
if(!$user) {
// User not found
// LOGIN ERROR
#Forma de resolver o ssh-agent no docker
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_rsa
#Git no jenkins deixa sem branch
git checkout master
#Verifica quais branchs estão criadas no repositório e depois baixa elas localmente
git branch -r | grep -v '\->' | grep -v 'master' | while read remote; do git branch --track "${remote#origin/}" "$remote"; done
#Adiciona o repositório clone
git remote add origin-mirror [email protected]:adelarcubs/repo_base_copy.git
Started by user admin
Building in workspace /var/jenkins_home/workspace/Blog_sample/Mirror_git
[WS-CLEANUP] Deleting project workspace...
[WS-CLEANUP] Done
Cloning the remote Git repository
Cloning repository https://github.com/adelarcubs/repo_base
> git init /var/jenkins_home/workspace/Blog_sample/Mirror_git # timeout=10
Fetching upstream changes from https://github.com/adelarcubs/repo_base
> git --version # timeout=10
using GIT_ASKPASS to set credentials adelarcubs github