def user_post(username): password = str(request.form['password']) site = str(request.form['site']) params = { 'username': username, 'password': password, 'site': site, } user_password = UserPassword.fetch(db, username, password) if not user_password: log_event('password-unknown', { 'username': username, }) return render_template('private/unknown.htm', **params) comment = user_password.getComment(site) if comment is not None: params['comment'] = comment params['result'] = generatePassword(password, site) log_event('user-generate', { 'username': username, 'new': (comment is not None) }) return render_template('private/password.htm', **params)
def save_comment(username): password = str(request.form['password']) site = str(request.form['site']) comment = str(request.form['comment']) params = { 'username': username, 'password': password, 'site': site, } user_password = UserPassword.fetch(db, username, password) new = user_password.getComment(site) is None if new: params['message'] = 'Your new site was saved.' else: params['message'] = 'Your comment was saved.' user_password.setSite(site, comment) params['comment'] = user_password.getComment(site) params['result'] = generatePassword(password, site) log_event('save-comment', {'username': username, 'new': new}) return render_template('private/password.htm', **params)
def save_comment(username): password = str(request.form['password']) site = str(request.form['site']) comment = str(request.form['comment']) params = { 'username': username, 'password': password, 'site': site, } user_password = UserPassword.fetch(db, username, password) new = user_password.getComment(site) is None if new: params['message'] = 'Your new site was saved.' else: params['message'] = 'Your comment was saved.' user_password.setSite(site, comment) params['comment'] = user_password.getComment(site) params['result'] = generatePassword(password, site) log_event('save-comment', { 'username': username, 'new': new }) return render_template('private/password.htm', **params)