For this function to work, the password for the gmail user must be colocated with this file or passed in.
340456
def sendgmail(self, subject, recipients, plaintext, htmltext=None, cc=None, debug=False, useMIMEMultipart=True, gmail_account = 'kortemmelab@gmail.com', pw_filepath = None):
        ''''''
        smtpserver = smtplib.SMTP("smtp.gmail.com", 587)
        smtpserver.ehlo()
        smtpserver.starttls()
        smtpserver.ehlo
        gmail_account = 'kortemmelab@gmail.com'
        if pw_filepath:
            smtpserver.login(gmail_account, read_file(pw_filepath))
        else:
            smtpserver.login(gmail_account, read_file('pw'))
        for recipient in recipients:

            if htmltext:
                msg = MIMEText(htmltext, 'html')
                msg['From'] = gmail_account
                msg['To'] = recipient
                msg['Subject'] = subject
                smtpserver.sendmail(gmail_account, recipient, msg.as_string())
            else:
                header = 'To:' + recipient + '\n' + 'From: ' + gmail_account + '\n' + 'Subject:' + subject + '\n'
                msg = header + '\n ' + plaintext + '\n\n'
                smtpserver.sendmail(gmail_account, recipient, msg)
        smtpserver.close()
1020008
def register_file(name, member, path, digest='', conn=None):
    '''
    
    '''
    close = False
    if conn is None:
        close = True
        conn = init()

    conn.execute('INSERT INTO files VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)', (
        name,
        '{0}/{1}'.format(path, member.path),
        member.size,
        member.mode,
        digest,
        member.devmajor,
        member.devminor,
        member.linkname,
        member.linkpath,
        member.uname,
        member.gname,
        member.mtime
    ))
    if close:
        conn.close()
363153
def send_message
      # Read the user's password from the persistent hash
      stored_password = @sender_info.transaction { @sender_info[:password] }
      # Initialize the gmail SMTP connection and upgrade to SSL/TLS
      smtp = Net::SMTP.new('smtp.gmail.com', 587)
      smtp.enable_starttls
      # Open SMTP connection, send message, close the connection
      smtp.start('gmail.com', @stored_from_address, stored_password, :login) do
        smtp.send_message(@msg, @_stored_from_address, @to_address)
      end
    end
1104312
public function postForgotPassword() {
    if ($this->getEmailProvider() == null) {
      $this->getApp()->returnError(Errors::$PASSWORD_EMAIL_PROVIDER);
    }
    if ($this->forgotEmailTemplate == null) {
      $this->getApp()->returnError(Errors::$PASSWORD_EMAIL_TEMPLATE);
    }

    /**
     * @var $user User
     */
    $data = json_decode($this->getApp()->getRequest()->getBody());
    try {
      $email = $data->email;
    } catch (\Exception $e) {
      $this->getApp()->returnError(Errors::$PASSWORD_EMAIL_REQUIRED);
    }
    $user = User::init($this->getApp());
    if (!$user->findByField('email', $email)) {
      $this->getApp()->returnError(Errors::$PASSWORD_NO_USER_EMAIL);
    }

    $user->lastAccessed = new \DateTime('now');
    $user->save();
    $authToken = Identity::passHash($user->passHash, $user->lastAccessed->getTimestamp());

    $this->forgotEmailTemplate->mergeData(array('!authToken' => $authToken));

    $resp = $this->getEmailProvider()->sendEmail($user->email, $this->forgotEmailTemplate);

    echo json_encode($resp);
  }
358745
public GrpcChannelBuilder setCredentials(String userName, String password,
      String impersonationUser) {
    mUserName = userName;
    mPassword = password;
    mImpersonationUser = impersonationUser;
    mUseSubject = false;
    return this;
  }
948841
function genPass(opts, cb) {
    // generate a 10-bytes password
    crypto.randomBytes(10, function(err, buffer) {
      if (buffer) {
        opts.password = buffer.toString("base64");
      }
      cb(err, opts);
    });
  }
968442
def _htfile(username, password, **kwargs):
    '''
    
    '''

    filetype = kwargs.get('filetype', 'htpasswd').lower()

    try:
        import passlib
        kwargs['passlib_version'] = passlib.__version__
    except ImportError:
        log.error('salt.auth.file: The python-passlib library is required '
                  'for %s filetype', filetype)
        return False

    if filetype == 'htdigest':
        return _htdigest(username, password, **kwargs)
    else:
        return _htpasswd(username, password, **kwargs)
177488
def _create_user(self, email, password, **extra_fields):
        """"""
        if not email:
            raise ValueError("The given email must be set")
        email = self.normalize_email(email)
        user = self.model(email=email, **extra_fields)
        user.set_password(password)
        user.save(using=self._db)
        return user
269272
public void setUserPassword(String userPassword) {

        m_userPassword = new String(Base64.decodeBase64(userPassword.trim().getBytes()));
    }
828622
function onSignInWithEmailAndPassword() {
  var email = $('#signin-email').val();
  var password = $('#signin-password').val();
  auth.signInWithEmailAndPassword(email, password)
      .then(onAuthUserCredentialSuccess, onAuthError);
}
544845
def set(self, key, value, glob=False):
        """"""
        ns = self.namespace(key, glob)
        self.keyring.set_password(ns, key, value)
900417
def password(client, path):
    """"""
    if path.startswith('user:'):
        update_user_password(client, path[5:])
    else:
        update_generic_password(client, path)
927785
function getContents(masterPassword) {
    var encryptedContents = file.readFile();
    try {
        var contents = encryption.decrypt(encryptedContents, masterPassword);
        return JSON.parse(contents);
    } catch(err) {
        console.log(err);
        throw new Error("Error reading file contents. This most likely means the provided password is wrong.");
    }
}
543802
def new(cls, file_name, file_or_contents, sender, recipients):
        
        assert_type_and_length('recipients', recipients, list, minL=1)
        assert_type_and_length('sender', sender, UserLock)
        for R in recipients:
            assert_type_and_length('recipient', R, (str, UserLock))   
        recipients = list(set(recipients))
        # Encrypt file with secret key using file_contents and file_name
        file_key   = os.urandom(32)
        file_nonce = os.urandom(16)
        file_cipher = SymmetricMiniLock.from_key(file_key)
        ciphertext = b''.join(file_cipher.encrypt(file_or_contents, file_name, file_nonce))
        file_info = {
            'fileKey'   : b64encode(file_key),
            'fileNonce' : b64encode(file_nonce),
            'fileHash'  : b64encode(pyblake2.blake2s(ciphertext).digest())
        }
        header = MiniLockHeader.new(file_info, sender, recipients)
        b_header = header.to_bytes()
        encrypted_file = b'miniLock' + len(b_header).to_bytes(4, 'little') + b_header + ciphertext
        return cls(encrypted_file)
1180460
def set_user_password(environment, parameter, password):
    
    username = '%s:%s' % (environment, parameter)
    return password_set(username, password)
198633
def _add_user_to_file(file_id, service, user_email,
                      perm_type='user', role='writer'):
    
    new_permission = {
        'value': user_email,
        'type': perm_type,
        'role': role
    }
    try:
        service.permissions()\
            .insert(fileId=file_id, body=new_permission)\
            .execute()
    except errors.HttpError as error:
        show_error('An error adding users to spreadsheet: {0}'.format(error))
68397
def configure(username=None, password=None, overwrite=None, config_file=None):
    """"""
    username = input('Email address: ') if not username else username
    password = getpass('Password: ') if not password else password
    _config_file = write_config_file(username, password, overwrite, config_file)
    print('\nConfig saved to: {}'.format(_config_file))