Generate loginCheckPath & logoutPath.
188785
protected function generatePaths()
    {
        if ($this->loginPath && !$this->loginCheckPath) {
            foreach ($this->patterns as $pattern) {
                // remove the ^ prefix
                $base = substr($pattern, 1);
                // skip a regex pattern
                if (preg_quote($base) != $base) {
                    continue;
                }
                // now that we found one
                if (substr($base, -1) != '/') {
                    $base .= '/';
                }
                $this->loginCheckPath = $base.'login_check';
                $this->logoutPath     = $base.'logout';
                break;
            }
            // unable to generate since all patterns are regex
            if (!$this->loginCheckPath) {
                static $underscorePad = 0;
                $underscorePad++;
                $this->loginCheckPath = '/'.str_repeat('_', $underscorePad).'login_check';
                $this->logoutPath     = '/'.str_repeat('_', $underscorePad).'logout';
                $this->patterns[]     = "^{$this->loginCheckPath}$";
                $this->patterns[]     = "^{$this->logoutPath}$";
            }
        }
    }
814702
def after_sign_out_path_for(resource_or_scope)
      if request.referer.blank? || request.referer.to_s =~ /admin/
        root_path
      else
        request.referer
      end
    end
1333207
def process_login(context, request):
    """"""
    username = request.json['username']
    password = request.json['password']

    # Do the password validation.
    user = context.authenticate(username, password)
    if not user:
        @request.after
        def adjust_status(response):
            response.status = 401
        return {
            'status': 'error',
            'error': {
                'code': 401,
                'message': 'Invalid Username / Password'
            }
        }

    @request.after
    def remember(response):
        """Remember the identity of the user logged in."""
        # We pass the extra info to the identity object.
        response.headers.add('Access-Control-Expose-Headers', 'Authorization')
        identity = user.identity
        request.app.remember_identity(response, request, identity)

    return {
        'status': 'success'
    }
1094331
def logout_path(user = current_user, app = main_app)
      path = security.logout_path
      path ||=
        if defined? ::Devise
          scope = ::Devise::Mapping.find_scope! user
          "destroy_#{scope}_session_path"
        end
      ModuleUtils.try_to app, path
    end
285825
function createGenerateLog(inPath) {
    if (!inPath) {
        throw new Error('Input path argument is required');
    }

    return function generateLog() {
        return gulp.src(inPath)
            .pipe(conventionalChangelog({ preset: 'angular' }))
            .pipe(gulp.dest(file => file.base));
    };
}
853272
def dispatch(self, request, *args, **kwargs):
        
        if self.requires_login:
            if settings.LOGIN_URL is None or settings.LOGOUT_URL is None:
                raise ImproperlyConfigured(
                    "LOGIN_URL and LOGOUT_URL "
                    "has to be defined if requires_login is True"
                )

            if not request.user.is_authenticated:
                return redirect(
                    "%s?next=%s"
                    % (
                        resolve_url(settings.LOGIN_URL),
                        quote(request.get_full_path()),
                    )
                )

        return super(View, self).dispatch(request, *args, **kwargs)
738899
function logOutput(options, parts) {
  const msg = `${ 'Generated '.blue }${ path.resolve.apply(path, parts).cyan }`
  log(options, msg)
}
648837
function cmd_logout(args, done) {
    var seneca = this
    var userent = seneca.make(user_canon)
    var loginent = seneca.make(login_canon)

    var q = { id: args.token }

    loginent.load$(q, function(err, login) {
      if (err) return done(err)

      if (!login) {
        return done(null, { ok: true })
      }

      login.active = false
      login.ended = new Date().getTime()
      login.save$(function(err, login) {
        if (err) {
          return done(err)
        }

        userent.load$({ id: login.user }, function(err, user) {
          if (err) {
            return done(err)
          }

          seneca.log.debug('logout', user, login)
          done(null, { user: user, login: login, ok: true })
        })
      })
    })
  }
379439
def do_login(self, line):
        ""
        if line:
            args = self.getargs(line)
            self.connect(args[0], args[1])
        else:
            self.connect()

        self.do_tables('')
1164039
def generate_quickstart(project_path):
    """"""
    ensure_path_exists(project_path)
    ensure_file_exists(os.path.join(project_path, "config.yml"), DEFAULT_CONFIG_CONTENT)
    ensure_path_exists(os.path.join(project_path, 'models'))
    ensure_path_exists(os.path.join(project_path, 'data'))
    ensure_path_exists(os.path.join(project_path, 'themes'))
    ensure_path_exists(os.path.join(project_path, 'templates'))
    ensure_path_exists(os.path.join(project_path, 'templatetags'))
    ensure_path_exists(os.path.join(project_path, 'views'))
    ensure_path_exists(os.path.join(project_path, 'assets'))
1179257
def cli(ctx, overwrite):
    """"""
    credentials_path = os.path.join(os.path.expanduser('~'), '.keep', '.credentials')
    if not os.path.exists(credentials_path):
        click.echo('You are not registered.')
        utils.register()
    else:
        utils.pull(ctx, overwrite)
1298650
def check_login(cookie, tokens, username):
    '''
    '''
    url = ''.join([
        const.PASSPORT_URL,
        '?logincheck',
        '&token=', tokens['token'],
        '&tpl=mm&apiver=v3',
        '&tt=', util.timestamp(),
        '&username=', encoder.encode_uri_component(username),
        '&isphone=false',
    ])
    headers={
        'Cookie': cookie.header_output(),
        'Referer': const.REFERER,
    }
    req = net.urlopen(url, headers=headers)
    if req:
        ubi = req.headers.get_all('Set-Cookie')
        return ubi, json.loads(req.data.decode())
    else:
        return None
646555
def login(username, password, development_mode=False):
        """"""
        retval = None
        try:
            user = User.fetch_by(username=username)
            if user and (development_mode or user.verify_password(password)):
                retval = user
        except OperationalError:
            pass
        return retval
1126716
def process_paths(options, candidates=None, error=True):
    """"""
    errors = check_path(options, rootdir=CURDIR, candidates=candidates)

    if options.format in ['pycodestyle', 'pep8']:
        pattern = "%(filename)s:%(lnum)s:%(col)s: %(text)s"
    elif options.format == 'pylint':
        pattern = "%(filename)s:%(lnum)s: [%(type)s] %(text)s"
    else:  # 'parsable'
        pattern = "%(filename)s:%(lnum)s:%(col)s: [%(type)s] %(text)s"

    for er in errors:
        if options.abspath:
            er._info['filename'] = op.abspath(er.filename)
        LOGGER.warning(pattern, er._info)

    if error:
        sys.exit(int(bool(errors)))

    return errors
993101
def _validate_login(self):
        
        '''  '''
        
        title = '%s.validate_login' % self.__class__.__name__
            
    # verbosity
        windows_insert = ' On windows, run in cmd.exe'
        self.printer('Checking heroku credentials ... ', flush=True)

    # validate netrc exists
        from os import path
        netrc_path = path.join(self.localhost.home, '.netrc')
    # TODO verify path exists on Windows
        if not path.exists(netrc_path):
            error_msg = '.netrc file is missing. Try: heroku login, then heroku auth:token'
            if self.localhost.os.sysname in ('Windows'):
                error_msg += windows_insert
            self.printer('ERROR.')
            raise Exception(error_msg)

    # replace value in netrc
        netrc_text = self._update_netrc(netrc_path, self.token, self.email)

    # verify remote access
        def handle_invalid(stdout, proc):

        # define process closing helper
            def _close_process(_proc):
            # close process
                import psutil
                process = psutil.Process(_proc.pid)
                for proc in process.children(recursive=True):
                    proc.kill()
                process.kill()
            # restore values to netrc
                with open(netrc_path, 'wt') as f:
                    f.write(netrc_text)
                    f.close()

        # invalid credentials
            if stdout.find('Invalid credentials') > -1:
                _close_process(proc)
                self.printer('ERROR.')
                raise Exception('Permission denied. Heroku auth token is not valid.\nTry: "heroku login", then "heroku auth:token"')

        sys_command = 'heroku apps --json'
        response = self._handle_command(sys_command, interactive=handle_invalid, handle_error=True)

        if response.find('Warning: heroku update') > -1:
            self.printer('WARNING: heroku update available.')
            self.printer('Try: npm install -g -U heroku\nor see https://devcenter.heroku.com/articles/heroku-cli#staying-up-to-date')
            self.printer('Checking heroku credentials ... ')
            response_lines = response.splitlines()
            response = '\n'.join(response_lines[1:])

    # add list to object
        import json
        try:
            self.apps = json.loads(response)
        except:
            self.printer('ERROR.')
            raise Exception(response)

        self.printer('done.')

        return self
311212
def path(project, credentials):
        """"""
        user, oauth_access_token = parsecredentials(credentials) #pylint: disable=unused-variable
        return settings.ROOT + "projects/" + user + '/' + project + "/"
559511
def loggin(self, user_id, mdp, autolog):
        """"""
        r = sql.abstractRequetesSQL.check_mdp_user(user_id, mdp)
        if r():
            # update auto-log params
            self.autolog[user_id] = autolog and mdp or False
            self.modules = self.users[user_id]["modules"]  # load modules list

            dic = {"autolog": self.autolog, "modules": self.modules}
            s = json.dumps(dic, indent=4, ensure_ascii=False)
            b = security.protege_data(s, True)
            with open("local/init", "wb") as f:
                f.write(b)

            self.mode_online = True  # authorization to execute bakground tasks
            return True
        else:
            logging.debug("Bad password !")