Example #1
0
def add_password(username):
    password = str(request.form['password'])
    confirm_password = str(request.form['confirm_password'])
    existing_password = str(request.form['existing_password'])

    params = {
        'username': username,
        'password': password,
    }

    user = User.fetch(db, username)

    error = None

    if not user.getPassword(existing_password):
        error = "The existing password you entered was not found."

    if error is None and password != confirm_password:
        error = "The password you entered to confirm was not the same as entered originally."

    if error:
        return render_template('private/unknown.htm', error=error, **params)

    log_event('add-password', {
        'username': username,
    })

    user.addPasswordHash(createHash(password))

    params = {
        'username': username,
        'message': 'Your new password is now available.'
    }
    return render_template('private/index.htm', **params)
Example #2
0
def add_password(username):
  password = str(request.form['password'])
  confirm_password = str(request.form['confirm_password'])
  existing_password = str(request.form['existing_password'])
  
  params = {
    'username': username,
    'password': password,
  }

  user = User.fetch(db, username)

  error = None

  if not user.getPassword(existing_password):
    error = "The existing password you entered was not found."

  if error is None and password != confirm_password:
    error = "The password you entered to confirm was not the same as entered originally."

  if error:
    return render_template('private/unknown.htm', error=error, **params)
    

  log_event('add-password', {
    'username': username,
    })

  user.addPasswordHash(createHash(password))

  params = {
      'username': username,
      'message': 'Your new password is now available.'
  }
  return render_template('private/index.htm', **params)
Example #3
0
def public_post(name=None):

  password = str(request.form['password'])
  site = str(request.form['site'])
  
  result = generatePassword(password, site)
  params = {
    'password': password,
    'hash': createHash(password),
    'site': site,
    'result': result
  }

  log_event('public-generate')
  return render_template('public/password.htm', **params)